home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 6 File / 06-File.zip / fst03f.zip / hpfs.h < prev    next >
C/C++ Source or Header  |  1996-01-09  |  6KB  |  274 lines

  1. /* hpfs.h -- HPFS definitions
  2.    Copyright (c) 1995-1996 by Eberhard Mattes
  3.  
  4. This file is part of fst.
  5.  
  6. fst is free software; you can redistribute it and/or modify it
  7. under the terms of the GNU General Public License as published by
  8. the Free Software Foundation; either version 2, or (at your option)
  9. any later version.
  10.  
  11. fst is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. GNU General Public License for more details.
  15.  
  16. You should have received a copy of the GNU General Public License
  17. along with fst; see the file COPYING.  If not, write to
  18. the Free Software Foundation, 59 Temple Place - Suite 330,
  19. Boston, MA 02111-1307, USA.  */
  20.  
  21.  
  22. #define SUPER_SIG1      0xf995e849
  23. #define SPARE_SIG1      0xf9911849
  24.  
  25. #define ALSEC_SIG1      0x37e40aae
  26. #define DIRBLK_SIG1     0x77e40aae
  27. #define FNODE_SIG1      0xf7e40aae
  28.  
  29. #define CPINFO_SIG1     0x494521f7
  30. #define CPDATA_SIG1     0x894521f7
  31.  
  32. #define SUPER_SIG2      0xfa53e9c5
  33. #define SPARE_SIG2      0xfa5229c5
  34.  
  35. #define SPF_DIRT        0x01    /* File system is dirty */
  36. #define SPF_SPARE       0x02    /* Spare DIRBLKs are used */
  37. #define SPF_HFUSED      0x04    /* Hot fix sectors are used */
  38. #define SPF_BADSEC      0x08    /* Bad sector */
  39. #define SPF_BADBM       0x10    /* Bad bitmap */
  40. #define SPF_FASTFMT     0x20    /* Fast format was used */
  41. #define SPF_VER         0x80    /* Written by old IFS */
  42.  
  43. #define FNF_DIR         0x01    /* FNODE is for a directory */
  44.  
  45. #define ABF_NODE        0x80    /* ALNODEs are following (not ALLEAFs) */
  46. #define ABF_FNP         0x20    /* ALBLK is in an FNODE */
  47.  
  48. #define DF_SPEC         0x01    /* Special ".." entry */
  49. #define DF_ACL          0x02    /* ACL present*/
  50. #define DF_BTP          0x04    /* B-tree down pointer present */
  51. #define DF_END          0x08    /* Dummy end entry */
  52. #define DF_ATTR         0x10    /* EA list present */
  53. #define DF_PERM         0x20    /* Extended permissions list present */
  54. #define DF_XACL         0x40    /* Explicit ACL present */
  55. #define DF_NEEDEAS      0x80    /* "Need" EAs present */
  56.  
  57. typedef ULONG LSN;
  58.  
  59. #pragma pack(1)
  60.  
  61. typedef struct
  62. {
  63.   USHORT usCountryCode;
  64.   USHORT usCodePageID;
  65.   ULONG  cksCP;
  66.   LSN    lsnCPData;
  67.   USHORT iCPVol;
  68.   USHORT cDBCSRange;
  69. } CPINFOENTRY;
  70.  
  71. typedef struct
  72. {
  73.   UCHAR ucStart;
  74.   UCHAR ucEnd;
  75. } DBCSRG;
  76.  
  77. typedef struct
  78. {
  79.   USHORT usCountryCode;
  80.   USHORT usCodePageID;
  81.   USHORT cDBCSRange;
  82.   BYTE   bCaseMapTable[128];
  83.   DBCSRG DBCSRange[1];
  84. } CPDATAENTRY;
  85.  
  86. typedef struct
  87. {
  88.   LSN lsnMain;
  89.   LSN lsnSpare;
  90. } RSP;
  91.  
  92. /* SPTR: A storage pointer specifying a run length (number of bytes)
  93.    and either the starting sector of the run or the sector number of
  94.    an ALSEC which maps the data. */
  95.  
  96. typedef struct
  97. {
  98.   ULONG cbRun;
  99.   LSN   lsn;
  100. } SPTR;
  101.  
  102. typedef struct
  103. {
  104.   SPTR   sp;
  105.   USHORT usFNL;
  106.   BYTE   bDat;
  107. } AUXINFO;
  108.  
  109. typedef struct
  110. {
  111.   ULONG lsnLog;
  112.   ULONG csecRun;
  113.   ULONG lsnPhys;
  114. } ALLEAF;
  115.  
  116. typedef struct
  117. {
  118.   ULONG lsnLog;
  119.   ULONG lsnPhys;
  120. } ALNODE;
  121.  
  122. typedef struct
  123. {
  124.   BYTE   bFlag;
  125.   BYTE   bPad[3];
  126.   BYTE   cFree;
  127.   BYTE   cUsed;
  128.   USHORT oFree;
  129. } ALBLK;
  130.  
  131. typedef struct
  132. {
  133.   ALBLK alb;
  134.   union
  135.     {
  136.       ALLEAF aall[8];
  137.       ALNODE aaln[12];
  138.     } a;
  139.   ULONG ulVLen;
  140. } FILESTORAGE;
  141.  
  142. typedef struct
  143. {
  144.   USHORT cchThisEntry;
  145.   BYTE   bFlags;
  146.   BYTE   bAttr;
  147.   LSN    lsnFNode;
  148.   ULONG  timLastMod;
  149.   ULONG  cchFSize;
  150.   ULONG  timLastAccess;
  151.   ULONG  timCreate;
  152.   ULONG  ulEALen;
  153.   BYTE   bFlex;
  154.   BYTE   bCodePage;
  155.   BYTE   cchName;
  156.   BYTE   bName[1];
  157. } DIRENT;
  158.  
  159. typedef struct
  160. {
  161.   ULONG       sig;
  162.   ULONG       ulSRHist;
  163.   ULONG       ulFRHist;
  164.   BYTE        achName[16];
  165.   LSN         lsnContDir;
  166.   AUXINFO     aiACL;
  167.   BYTE        cHistBits;
  168.   AUXINFO     aiEA;
  169.   BYTE        bFlag;
  170.   FILESTORAGE fst;
  171.   ULONG       ulRefCount;
  172.   BYTE        achUID[16];
  173.   USHORT      usACLBase;
  174.   BYTE        abSpare[10];
  175.   BYTE        abFree[1];
  176. } FNODE;
  177.  
  178. typedef struct
  179. {
  180.   ULONG  sig1;
  181.   ULONG  sig2;
  182.   BYTE   bVersion;
  183.   BYTE   bFuncVersion;
  184.   USHORT usDummy;
  185.   LSN    lsnRootFNode;
  186.   ULONG  culSectsOnVol;
  187.   ULONG  culNumBadSects;
  188.   RSP    rspBitMapIndBlk;
  189.   RSP    rspBadBlkList;
  190.   ULONG  datLastChkdsk;
  191.   ULONG  datLastOptimize;
  192.   ULONG  clsnDirBlkBand;
  193.   LSN    lsnFirstDirBlk;
  194.   LSN    lsnLastDirBlk;
  195.   LSN    lsnDirBlkMap;
  196.   BYTE   achVolumeName[32];
  197.   LSN    lsnSidTab;
  198. } SUPERB;
  199.  
  200. typedef struct
  201. {
  202.   ULONG  sig1;
  203.   ULONG  sig2;
  204.   BYTE   bFlag;
  205.   BYTE   bAlign[3];
  206.   LSN    lsnHotFix;
  207.   ULONG  culHotFixes;
  208.   ULONG  culMaxHotFixes;
  209.   ULONG  cdbSpares;
  210.   ULONG  cdbMaxSpare;
  211.   LSN    lsnCPInfo;
  212.   ULONG  culCP;
  213.   ULONG  aulExtra[17];
  214.   LSN    alsnSpareDirBlks[101];
  215. } SPAREB;
  216.  
  217. typedef  struct
  218. {
  219.   ULONG       sig;
  220.   ULONG       cCodePage;
  221.   ULONG       iFirstCP;
  222.   LSN         lsnNext;
  223.   CPINFOENTRY CPInfoEnt[31];
  224. } CPINFOSEC;
  225.  
  226. typedef struct
  227. {
  228.   ULONG  sig;
  229.   USHORT cCodePage;
  230.   USHORT iFirstCP;
  231.   ULONG  cksCP[3];
  232.   USHORT offCPData[3];
  233. } CPDATASEC;
  234.  
  235. typedef struct
  236. {
  237.   ULONG sig;
  238.   ULONG lsnSelf;
  239.   ULONG lsnRent;
  240.   ALBLK alb;
  241.   union
  242.   {
  243.     ALLEAF aall[40];
  244.     ALNODE aaln[60];
  245.   } a;
  246. } ALSEC;
  247.  
  248. typedef union
  249. {
  250.   BYTE      raw[512];
  251.   SUPERB    superb;
  252.   SPAREB    spareb;
  253.   CPINFOSEC cpinfosec;
  254.   CPDATASEC cpdatasec;
  255.   FNODE     fnode;
  256.   ALSEC     alsec;
  257. } HPFS_SECTOR;
  258.  
  259. typedef union
  260. {
  261.   BYTE raw[4*512];
  262.   struct
  263.     {
  264.       ULONG  sig;
  265.       ULONG  offulFirstFree;
  266.       ULONG  culChange;
  267.       LSN    lsnParent;
  268.       LSN    lsnThisDir;
  269.       DIRENT dirent[1];
  270.     } dirblk;
  271. } DIRBLK;
  272.  
  273. #pragma pack()
  274.