home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 6 File / 06-File.zip / ramfs102.zip / src / ramfs.h < prev    next >
C/C++ Source or Header  |  2002-09-28  |  4KB  |  149 lines

  1. #ifndef __COMPACT__
  2.   #error Please use Compact memory model!
  3. #endif
  4.  
  5. /*
  6. #pragma option -a-
  7. */
  8.  
  9. /* DIRENTRY.fDOSattr flags */
  10. #define DOSATTR_READONLY    0x01
  11. #define DOSATTR_HIDDEN        0x02
  12. #define DOSATTR_SYSTEM        0x04
  13. #define DOSATTR_DIRECTORY    0x10
  14. #define DOSATTR_ARCHIVED    0x20
  15. #define DOSATTR_NON83        0x40
  16. #define DOSATTR_NEEDEA        0x80
  17.  
  18. #define SHARE_DENYREAD        0x01
  19. #define SHARE_DENYWRITE        0x02
  20. #define ACCESS_READ        0x01
  21. #define ACCESS_WRITE        0x02
  22.  
  23. /* SEARCH.flatEntry if no more entries */
  24. #define SEARCH_END        0xFFFFFFFFul
  25.  
  26. typedef unsigned long FLAT;
  27.  
  28.  
  29. /* forwards */
  30. typedef struct _BLOCK    BLOCK;
  31. typedef struct _FBLOCK   FBLOCK;
  32. typedef struct _OPENFILE OPENFILE;
  33. typedef struct _CURDIR   CURDIR;
  34. typedef struct _SEARCH   SEARCH;
  35. typedef struct _VOLUME   VOLUME;
  36. typedef struct _DIRENTRY DIRENTRY;
  37.  
  38. typedef BLOCK    _ss *PBLOCK;
  39. typedef FBLOCK   _ss *PFBLOCK;
  40. typedef OPENFILE far *POPENFILE;
  41. typedef CURDIR   far *PCURDIR;
  42. typedef SEARCH   far *PSEARCH;
  43. typedef VOLUME   far *PVOLUME;
  44. typedef DIRENTRY far *PDIRENTRY;
  45.  
  46.  
  47. struct _BLOCK
  48. {
  49.   FLAT        flatAddr;
  50.   ULONG        cbSize;
  51. };
  52.  
  53. /* File data block - incorporates an array of FLAT pointers to individual
  54.    clusters */
  55.  
  56. struct _FBLOCK
  57. {
  58.   struct _BLOCK clusters;               /* Cluster array = block of FLATs */
  59.   ULONG        fSize;                  /* Size of the entire file */
  60. };
  61.  
  62. /* we allocate a OPENFILE on the near heap for each struct sffsd */
  63. /* size of a OPENFILE is sizeof(OPENFILE) + strlen(szName) */
  64. struct _OPENFILE
  65. {
  66.   POPENFILE pNextOpenfile;
  67.   FLAT      flatEntry;
  68.   UCHAR     fShare;
  69.   CHAR      szName[1];        /* asciiz name - for FS_FSCTL */
  70. };
  71.  
  72.  
  73. /* we allocate a CURDIR on the near heap for each struct cdfsd */
  74. /* size of a CURDIR is sizeof(CURDIR) + strlen(szDir) */
  75. struct _CURDIR
  76. {
  77.   PCURDIR   pNextCurdir;
  78.   PVOLUME   pVolume;        /* only used by FS_CHDIR, flag=2 */
  79.   FLAT      flatBlkDir;
  80.   CHAR      szDir[1];        /* full asciiz dir name - for FS_FSCTL */
  81. };
  82.  
  83.  
  84. /* we allocate a SEARCH on the near heap for each struct fsfsd */
  85. /* size of a SEARCH is sizeof(SEARCH) + strlen(szPattern) */
  86. struct _SEARCH
  87. {
  88.   PSEARCH   pNextSearch;
  89.   FLAT      flatBlkDir;
  90.   FLAT      flatEntry;
  91.   USHORT    usAttr;
  92.   CHAR      szPattern[1];    /* uppercased asciiz */
  93. };
  94.  
  95.  
  96. /* we allocate a VOLUME on the near heap for each struct vpfsd */
  97. struct _VOLUME
  98. {
  99.   BLOCK     blkRootDir;
  100.   FLAT      flatBlkRootDir;
  101.   POPENFILE pFirstOpenfile;
  102.   PCURDIR   pFirstCurdir;
  103.   PSEARCH   pFirstSearch;
  104.   CHAR      szLabel [VPBTEXTLEN];
  105. };
  106.  
  107.  
  108. /* OS/2 allocates struct vpfsd's */
  109. struct    vpfsd {
  110.   PVOLUME   pVolume;
  111.   char      vpd_unused[34];
  112. };  /* vpfsd   36 bytes total */
  113.  
  114.  
  115. /* OS/2 allocates struct sffsd's */
  116. struct  sffsd {
  117.   POPENFILE pOpenfile;
  118.   char      sfd_unused[28];
  119. };  /* sffsd   30 bytes total */
  120.  
  121.  
  122. /* OS/2 allocates struct cdfsd's */
  123. struct cdfsd {
  124.   PCURDIR   pCurdir;
  125.   char      cdd_unused[6];
  126. };  /* cdfsd   8 bytes total */
  127.  
  128.  
  129. /* OS/2 allocates struct fsfsd's */
  130. struct fsfsd {
  131.   PSEARCH   pSearch;
  132.   char      fsd_unused[22];
  133. };  /* fsfsd   24 bytes total */
  134.  
  135.  
  136. /* size of a DIRENTRY is sizeof(DIRENTRY)-sizeof(DIRENTRY.achName) + DIRENTRY.cbName */
  137. struct _DIRENTRY
  138. {
  139.   UCHAR        cbName;        /* length of achName */
  140.   UCHAR        fDOSattr;    /* DOSATTR_* flags */
  141.   FBLOCK        fblkFile;
  142.   BLOCK        blkEA;
  143.   ULONG        datiCreate;     /* date=low word, time=high word */
  144.   ULONG        datiAccess;    /* date=low word, time=high word */
  145.   ULONG        datiWrite;    /* date=low word, time=high word */
  146.   CHAR        achName[256];    /* not zero terminated while on disk */
  147.                 /* zero terminated while in RAM */
  148. };
  149.