HFSVolumes.h
上传用户:xjjlds
上传日期:2015-12-05
资源大小:22823k
文件大小:29k
源码类别:

多媒体编程

开发平台:

Visual C++

  1. /*
  2.      File:       HFSVolumes.h
  3.  
  4.      Contains:   On-disk data structures for HFS and HFS Plus volumes.
  5.  
  6.      Version:    Technology: Mac OS 8.1
  7.                  Release:    QuickTime 6.0.2
  8.  
  9.      Copyright:  (c) 1984-2001 by Apple Computer, Inc.  All rights reserved.
  10.  
  11.      Bugs?:      For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __HFSVOLUMES__
  18. #define __HFSVOLUMES__
  19. #ifndef __MACTYPES__
  20. #include "MacTypes.h"
  21. #endif
  22. #ifndef __FILES__
  23. #include "Files.h"
  24. #endif
  25. #ifndef __FINDER__
  26. #include "Finder.h"
  27. #endif
  28. #if PRAGMA_ONCE
  29. #pragma once
  30. #endif
  31. #ifdef __cplusplus
  32. extern "C" {
  33. #endif
  34. #if PRAGMA_IMPORT
  35. #pragma import on
  36. #endif
  37. #if PRAGMA_STRUCT_ALIGN
  38.     #pragma options align=mac68k
  39. #elif PRAGMA_STRUCT_PACKPUSH
  40.     #pragma pack(push, 2)
  41. #elif PRAGMA_STRUCT_PACK
  42.     #pragma pack(2)
  43. #endif
  44. /* Signatures used to differentiate between HFS and HFS Plus volumes */
  45. enum {
  46.     kHFSSigWord                 = 0x4244,                       /* 'BD' in ASCII */
  47.     kHFSPlusSigWord             = 0x482B,                       /* 'H+' in ASCII */
  48.     kHFSPlusVersion             = 0x0004,                       /* will change as format changes (version 4 shipped with Mac OS 8.1) */
  49.     kHFSPlusMountVersion        = FOUR_CHAR_CODE('8.10')        /* will change as implementations change ('8.10' in Mac OS 8.1) */
  50. };
  51. /* CatalogNodeID is used to track catalog objects */
  52. typedef UInt32                          HFSCatalogNodeID;
  53. enum {
  54.     kHFSMaxVolumeNameChars      = 27,
  55.     kHFSMaxFileNameChars        = 31,
  56.     kHFSPlusMaxFileNameChars    = 255
  57. };
  58. /* Extent overflow file data structures */
  59. /* HFS Extent key */
  60. struct HFSExtentKey {
  61.     UInt8                           keyLength;                  /* length of key, excluding this field */
  62.     UInt8                           forkType;                   /* 0 = data fork, FF = resource fork */
  63.     HFSCatalogNodeID                fileID;                     /* file ID */
  64.     UInt16                          startBlock;                 /* first file allocation block number in this extent */
  65. };
  66. typedef struct HFSExtentKey             HFSExtentKey;
  67. /* HFS Plus Extent key */
  68. struct HFSPlusExtentKey {
  69.     UInt16                          keyLength;                  /* length of key, excluding this field */
  70.     UInt8                           forkType;                   /* 0 = data fork, FF = resource fork */
  71.     UInt8                           pad;                        /* make the other fields align on 32-bit boundary */
  72.     HFSCatalogNodeID                fileID;                     /* file ID */
  73.     UInt32                          startBlock;                 /* first file allocation block number in this extent */
  74. };
  75. typedef struct HFSPlusExtentKey         HFSPlusExtentKey;
  76. /* Number of extent descriptors per extent record */
  77. enum {
  78.     kHFSExtentDensity           = 3,
  79.     kHFSPlusExtentDensity       = 8
  80. };
  81. /* HFS extent descriptor */
  82. struct HFSExtentDescriptor {
  83.     UInt16                          startBlock;                 /* first allocation block */
  84.     UInt16                          blockCount;                 /* number of allocation blocks */
  85. };
  86. typedef struct HFSExtentDescriptor      HFSExtentDescriptor;
  87. /* HFS Plus extent descriptor */
  88. struct HFSPlusExtentDescriptor {
  89.     UInt32                          startBlock;                 /* first allocation block */
  90.     UInt32                          blockCount;                 /* number of allocation blocks */
  91. };
  92. typedef struct HFSPlusExtentDescriptor  HFSPlusExtentDescriptor;
  93. /* HFS extent record */
  94. typedef HFSExtentDescriptor             HFSExtentRecord[3];
  95. /* HFS Plus extent record */
  96. typedef HFSPlusExtentDescriptor         HFSPlusExtentRecord[8];
  97. /* Fork data info (HFS Plus only) - 80 bytes */
  98. struct HFSPlusForkData {
  99.     UInt64                          logicalSize;                /* fork's logical size in bytes */
  100.     UInt32                          clumpSize;                  /* fork's clump size in bytes */
  101.     UInt32                          totalBlocks;                /* total blocks used by this fork */
  102.     HFSPlusExtentRecord             extents;                    /* initial set of extents */
  103. };
  104. typedef struct HFSPlusForkData          HFSPlusForkData;
  105. /* Permissions info (HFS Plus only) - 16 bytes */
  106. struct HFSPlusPermissions {
  107.     UInt32                          ownerID;                    /* user or group ID of file/folder owner */
  108.     UInt32                          groupID;                    /* additional user of group ID */
  109.     UInt32                          permissions;                /* permissions (bytes: unused, owner, group, everyone) */
  110.     UInt32                          specialDevice;              /* UNIX: device for character or block special file */
  111. };
  112. typedef struct HFSPlusPermissions       HFSPlusPermissions;
  113. /* Catalog file data structures */
  114. enum {
  115.     kHFSRootParentID            = 1,                            /* Parent ID of the root folder */
  116.     kHFSRootFolderID            = 2,                            /* Folder ID of the root folder */
  117.     kHFSExtentsFileID           = 3,                            /* File ID of the extents file */
  118.     kHFSCatalogFileID           = 4,                            /* File ID of the catalog file */
  119.     kHFSBadBlockFileID          = 5,                            /* File ID of the bad allocation block file */
  120.     kHFSAllocationFileID        = 6,                            /* File ID of the allocation file (HFS Plus only) */
  121.     kHFSStartupFileID           = 7,                            /* File ID of the startup file (HFS Plus only) */
  122.     kHFSAttributesFileID        = 8,                            /* File ID of the attribute file (HFS Plus only) */
  123.     kHFSBogusExtentFileID       = 15,                           /* Used for exchanging extents in extents file */
  124.     kHFSFirstUserCatalogNodeID  = 16
  125. };
  126. /* HFS catalog key */
  127. struct HFSCatalogKey {
  128.     UInt8                           keyLength;                  /* key length (in bytes) */
  129.     UInt8                           reserved;                   /* reserved (set to zero) */
  130.     HFSCatalogNodeID                parentID;                   /* parent folder ID */
  131.     Str31                           nodeName;                   /* catalog node name */
  132. };
  133. typedef struct HFSCatalogKey            HFSCatalogKey;
  134. /* HFS Plus catalog key */
  135. struct HFSPlusCatalogKey {
  136.     UInt16                          keyLength;                  /* key length (in bytes) */
  137.     HFSCatalogNodeID                parentID;                   /* parent folder ID */
  138.     HFSUniStr255                    nodeName;                   /* catalog node name */
  139. };
  140. typedef struct HFSPlusCatalogKey        HFSPlusCatalogKey;
  141. /* Catalog record types */
  142. enum {
  143.                                                                 /* HFS Catalog Records */
  144.     kHFSFolderRecord            = 0x0100,                       /* Folder record */
  145.     kHFSFileRecord              = 0x0200,                       /* File record */
  146.     kHFSFolderThreadRecord      = 0x0300,                       /* Folder thread record */
  147.     kHFSFileThreadRecord        = 0x0400,                       /* File thread record */
  148.                                                                 /* HFS Plus Catalog Records */
  149.     kHFSPlusFolderRecord        = 1,                            /* Folder record */
  150.     kHFSPlusFileRecord          = 2,                            /* File record */
  151.     kHFSPlusFolderThreadRecord  = 3,                            /* Folder thread record */
  152.     kHFSPlusFileThreadRecord    = 4                             /* File thread record */
  153. };
  154. /* Catalog file record flags */
  155. enum {
  156.     kHFSFileLockedBit           = 0x0000,                       /* file is locked and cannot be written to */
  157.     kHFSFileLockedMask          = 0x0001,
  158.     kHFSThreadExistsBit         = 0x0001,                       /* a file thread record exists for this file */
  159.     kHFSThreadExistsMask        = 0x0002
  160. };
  161. /* HFS catalog folder record - 70 bytes */
  162. struct HFSCatalogFolder {
  163.     SInt16                          recordType;                 /* record type */
  164.     UInt16                          flags;                      /* folder flags */
  165.     UInt16                          valence;                    /* folder valence */
  166.     HFSCatalogNodeID                folderID;                   /* folder ID */
  167.     UInt32                          createDate;                 /* date and time of creation */
  168.     UInt32                          modifyDate;                 /* date and time of last modification */
  169.     UInt32                          backupDate;                 /* date and time of last backup */
  170.     DInfo                           userInfo;                   /* Finder information */
  171.     DXInfo                          finderInfo;                 /* additional Finder information */
  172.     UInt32                          reserved[4];                /* reserved - set to zero */
  173. };
  174. typedef struct HFSCatalogFolder         HFSCatalogFolder;
  175. /* HFS Plus catalog folder record - 88 bytes */
  176. struct HFSPlusCatalogFolder {
  177.     SInt16                          recordType;                 /* record type = HFS Plus folder record */
  178.     UInt16                          flags;                      /* file flags */
  179.     UInt32                          valence;                    /* folder's valence (limited to 2^16 in Mac OS) */
  180.     HFSCatalogNodeID                folderID;                   /* folder ID */
  181.     UInt32                          createDate;                 /* date and time of creation */
  182.     UInt32                          contentModDate;             /* date and time of last content modification */
  183.     UInt32                          attributeModDate;           /* date and time of last attribute modification */
  184.     UInt32                          accessDate;                 /* date and time of last access (Rhapsody only) */
  185.     UInt32                          backupDate;                 /* date and time of last backup */
  186.     HFSPlusPermissions              permissions;                /* permissions (for Rhapsody) */
  187.     DInfo                           userInfo;                   /* Finder information */
  188.     DXInfo                          finderInfo;                 /* additional Finder information */
  189.     UInt32                          textEncoding;               /* hint for name conversions */
  190.     UInt32                          reserved;                   /* reserved - set to zero */
  191. };
  192. typedef struct HFSPlusCatalogFolder     HFSPlusCatalogFolder;
  193. /* HFS catalog file record - 102 bytes */
  194. struct HFSCatalogFile {
  195.     SInt16                          recordType;                 /* record type */
  196.     UInt8                           flags;                      /* file flags */
  197.     SInt8                           fileType;                   /* file type (unused ?) */
  198.     FInfo                           userInfo;                   /* Finder information */
  199.     HFSCatalogNodeID                fileID;                     /* file ID */
  200.     UInt16                          dataStartBlock;             /* not used - set to zero */
  201.     SInt32                          dataLogicalSize;            /* logical EOF of data fork */
  202.     SInt32                          dataPhysicalSize;           /* physical EOF of data fork */
  203.     UInt16                          rsrcStartBlock;             /* not used - set to zero */
  204.     SInt32                          rsrcLogicalSize;            /* logical EOF of resource fork */
  205.     SInt32                          rsrcPhysicalSize;           /* physical EOF of resource fork */
  206.     UInt32                          createDate;                 /* date and time of creation */
  207.     UInt32                          modifyDate;                 /* date and time of last modification */
  208.     UInt32                          backupDate;                 /* date and time of last backup */
  209.     FXInfo                          finderInfo;                 /* additional Finder information */
  210.     UInt16                          clumpSize;                  /* file clump size (not used) */
  211.     HFSExtentRecord                 dataExtents;                /* first data fork extent record */
  212.     HFSExtentRecord                 rsrcExtents;                /* first resource fork extent record */
  213.     UInt32                          reserved;                   /* reserved - set to zero */
  214. };
  215. typedef struct HFSCatalogFile           HFSCatalogFile;
  216. /* HFS Plus catalog file record - 248 bytes */
  217. struct HFSPlusCatalogFile {
  218.     SInt16                          recordType;                 /* record type = HFS Plus file record */
  219.     UInt16                          flags;                      /* file flags */
  220.     UInt32                          reserved1;                  /* reserved - set to zero */
  221.     HFSCatalogNodeID                fileID;                     /* file ID */
  222.     UInt32                          createDate;                 /* date and time of creation */
  223.     UInt32                          contentModDate;             /* date and time of last content modification */
  224.     UInt32                          attributeModDate;           /* date and time of last attribute modification */
  225.     UInt32                          accessDate;                 /* date and time of last access (Rhapsody only) */
  226.     UInt32                          backupDate;                 /* date and time of last backup */
  227.     HFSPlusPermissions              permissions;                /* permissions (for Rhapsody) */
  228.     FInfo                           userInfo;                   /* Finder information */
  229.     FXInfo                          finderInfo;                 /* additional Finder information */
  230.     UInt32                          textEncoding;               /* hint for name conversions */
  231.     UInt32                          reserved2;                  /* reserved - set to zero */
  232.                                                                 /* start on double long (64 bit) boundry */
  233.     HFSPlusForkData                 dataFork;                   /* size and block data for data fork */
  234.     HFSPlusForkData                 resourceFork;               /* size and block data for resource fork */
  235. };
  236. typedef struct HFSPlusCatalogFile       HFSPlusCatalogFile;
  237. /* HFS catalog thread record - 46 bytes */
  238. struct HFSCatalogThread {
  239.     SInt16                          recordType;                 /* record type */
  240.     SInt32                          reserved[2];                /* reserved - set to zero */
  241.     HFSCatalogNodeID                parentID;                   /* parent ID for this catalog node */
  242.     Str31                           nodeName;                   /* name of this catalog node */
  243. };
  244. typedef struct HFSCatalogThread         HFSCatalogThread;
  245. /* HFS Plus catalog thread record -- 264 bytes */
  246. struct HFSPlusCatalogThread {
  247.     SInt16                          recordType;                 /* record type */
  248.     SInt16                          reserved;                   /* reserved - set to zero */
  249.     HFSCatalogNodeID                parentID;                   /* parent ID for this catalog node */
  250.     HFSUniStr255                    nodeName;                   /* name of this catalog node (variable length) */
  251. };
  252. typedef struct HFSPlusCatalogThread     HFSPlusCatalogThread;
  253. /*
  254.     These are the types of records in the attribute B-tree.  The values were chosen
  255.     so that they wouldn't conflict with the catalog record types.
  256. */
  257. enum {
  258.     kHFSPlusAttrInlineData      = 0x10,                         /* if size <  kAttrOverflowSize */
  259.     kHFSPlusAttrForkData        = 0x20,                         /* if size >= kAttrOverflowSize */
  260.     kHFSPlusAttrExtents         = 0x30                          /* overflow extents for large attributes */
  261. };
  262. /*
  263.     HFSPlusAttrInlineData
  264.     For small attributes, whose entire value is stored within this one
  265.     B-tree record.
  266.     There would not be any other records for this attribute.
  267. */
  268. struct HFSPlusAttrInlineData {
  269.     UInt32                          recordType;                 /*    = kHFSPlusAttrInlineData*/
  270.     UInt32                          reserved;
  271.     UInt32                          logicalSize;                /*    size in bytes of userData*/
  272.     UInt8                           userData[2];                /*    variable length; space allocated is a multiple of 2 bytes*/
  273. };
  274. typedef struct HFSPlusAttrInlineData    HFSPlusAttrInlineData;
  275. /*
  276.     HFSPlusAttrForkData
  277.     For larger attributes, whose value is stored in allocation blocks.
  278.     If the attribute has more than 8 extents, there will be additonal
  279.     records (of type HFSPlusAttrExtents) for this attribute.
  280. */
  281. struct HFSPlusAttrForkData {
  282.     UInt32                          recordType;                 /*    = kHFSPlusAttrForkData*/
  283.     UInt32                          reserved;
  284.     HFSPlusForkData                 theFork;                    /*    size and first extents of value*/
  285. };
  286. typedef struct HFSPlusAttrForkData      HFSPlusAttrForkData;
  287. /*
  288.     HFSPlusAttrExtents
  289.     This record contains information about overflow extents for large,
  290.     fragmented attributes.
  291. */
  292. struct HFSPlusAttrExtents {
  293.     UInt32                          recordType;                 /*    = kHFSPlusAttrExtents*/
  294.     UInt32                          reserved;
  295.     HFSPlusExtentRecord             extents;                    /*    additional extents*/
  296. };
  297. typedef struct HFSPlusAttrExtents       HFSPlusAttrExtents;
  298. /*  A generic Attribute Record*/
  299. union HFSPlusAttrRecord {
  300.     UInt32                          recordType;
  301.     HFSPlusAttrInlineData           inlineData;
  302.     HFSPlusAttrForkData             forkData;
  303.     HFSPlusAttrExtents              overflowExtents;
  304. };
  305. typedef union HFSPlusAttrRecord         HFSPlusAttrRecord;
  306. /* Key and node lengths */
  307. enum {
  308.     kHFSPlusExtentKeyMaximumLength = sizeof(HFSPlusExtentKey) - sizeof(UInt16),
  309.     kHFSExtentKeyMaximumLength  = sizeof(HFSExtentKey) - sizeof(UInt8),
  310.     kHFSPlusCatalogKeyMaximumLength = sizeof(HFSPlusCatalogKey) - sizeof(UInt16),
  311.     kHFSPlusCatalogKeyMinimumLength = kHFSPlusCatalogKeyMaximumLength - sizeof(HFSUniStr255) + sizeof(UInt16),
  312.     kHFSCatalogKeyMaximumLength = sizeof(HFSCatalogKey) - sizeof(UInt8),
  313.     kHFSCatalogKeyMinimumLength = kHFSCatalogKeyMaximumLength - sizeof(Str31) + sizeof(UInt8),
  314.     kHFSPlusCatalogMinNodeSize  = 4096,
  315.     kHFSPlusExtentMinNodeSize   = 512,
  316.     kHFSPlusAttrMinNodeSize     = 4096
  317. };
  318. /* HFS and HFS Plus volume attribute bits */
  319. enum {
  320.                                                                 /* Bits 0-6 are reserved (always cleared by MountVol call) */
  321.     kHFSVolumeHardwareLockBit   = 7,                            /* volume is locked by hardware */
  322.     kHFSVolumeUnmountedBit      = 8,                            /* volume was successfully unmounted */
  323.     kHFSVolumeSparedBlocksBit   = 9,                            /* volume has bad blocks spared */
  324.     kHFSVolumeNoCacheRequiredBit = 10,                          /* don't cache volume blocks (i.e. RAM or ROM disk) */
  325.     kHFSBootVolumeInconsistentBit = 11,                         /* boot volume is inconsistent (System 7.6 and later) */
  326.                                                                 /* Bits 12-14 are reserved for future use */
  327.     kHFSVolumeSoftwareLockBit   = 15,                           /* volume is locked by software */
  328.     kHFSVolumeHardwareLockMask  = 1 << kHFSVolumeHardwareLockBit,
  329.     kHFSVolumeUnmountedMask     = 1 << kHFSVolumeUnmountedBit,
  330.     kHFSVolumeSparedBlocksMask  = 1 << kHFSVolumeSparedBlocksBit,
  331.     kHFSVolumeNoCacheRequiredMask = 1 << kHFSVolumeNoCacheRequiredBit,
  332.     kHFSBootVolumeInconsistentMask = 1 << kHFSBootVolumeInconsistentBit,
  333.     kHFSVolumeSoftwareLockMask  = 1 << kHFSVolumeSoftwareLockBit,
  334.     kHFSMDBAttributesMask       = 0x8380
  335. };
  336. /* Master Directory Block (HFS only) - 162 bytes */
  337. /* Stored at sector #2 (3rd sector) */
  338. struct HFSMasterDirectoryBlock {
  339.                                                                 /* These first fields are also used by MFS */
  340.     UInt16                          drSigWord;                  /* volume signature */
  341.     UInt32                          drCrDate;                   /* date and time of volume creation */
  342.     UInt32                          drLsMod;                    /* date and time of last modification */
  343.     UInt16                          drAtrb;                     /* volume attributes */
  344.     UInt16                          drNmFls;                    /* number of files in root folder */
  345.     UInt16                          drVBMSt;                    /* first block of volume bitmap */
  346.     UInt16                          drAllocPtr;                 /* start of next allocation search */
  347.     UInt16                          drNmAlBlks;                 /* number of allocation blocks in volume */
  348.     UInt32                          drAlBlkSiz;                 /* size (in bytes) of allocation blocks */
  349.     UInt32                          drClpSiz;                   /* default clump size */
  350.     UInt16                          drAlBlSt;                   /* first allocation block in volume */
  351.     UInt32                          drNxtCNID;                  /* next unused catalog node ID */
  352.     UInt16                          drFreeBks;                  /* number of unused allocation blocks */
  353.     Str27                           drVN;                       /* volume name */
  354.                                                                 /* Master Directory Block extensions for HFS */
  355.     UInt32                          drVolBkUp;                  /* date and time of last backup */
  356.     UInt16                          drVSeqNum;                  /* volume backup sequence number */
  357.     UInt32                          drWrCnt;                    /* volume write count */
  358.     UInt32                          drXTClpSiz;                 /* clump size for extents overflow file */
  359.     UInt32                          drCTClpSiz;                 /* clump size for catalog file */
  360.     UInt16                          drNmRtDirs;                 /* number of directories in root folder */
  361.     UInt32                          drFilCnt;                   /* number of files in volume */
  362.     UInt32                          drDirCnt;                   /* number of directories in volume */
  363.     SInt32                          drFndrInfo[8];              /* information used by the Finder */
  364.     UInt16                          drEmbedSigWord;             /* embedded volume signature (formerly drVCSize) */
  365.     HFSExtentDescriptor             drEmbedExtent;              /* embedded volume location and size (formerly drVBMCSize and drCtlCSize) */
  366.     UInt32                          drXTFlSize;                 /* size of extents overflow file */
  367.     HFSExtentRecord                 drXTExtRec;                 /* extent record for extents overflow file */
  368.     UInt32                          drCTFlSize;                 /* size of catalog file */
  369.     HFSExtentRecord                 drCTExtRec;                 /* extent record for catalog file */
  370. };
  371. typedef struct HFSMasterDirectoryBlock  HFSMasterDirectoryBlock;
  372. /* HFSPlusVolumeHeader (HFS Plus only) - 512 bytes */
  373. /* Stored at sector #2 (3rd sector) and second-to-last sector. */
  374. struct HFSPlusVolumeHeader {
  375.     UInt16                          signature;                  /* volume signature == 'H+' */
  376.     UInt16                          version;                    /* current version is kHFSPlusVersion */
  377.     UInt32                          attributes;                 /* volume attributes */
  378.     UInt32                          lastMountedVersion;         /* implementation version which last mounted volume */
  379.     UInt32                          reserved;                   /* reserved - set to zero */
  380.     UInt32                          createDate;                 /* date and time of volume creation */
  381.     UInt32                          modifyDate;                 /* date and time of last modification */
  382.     UInt32                          backupDate;                 /* date and time of last backup */
  383.     UInt32                          checkedDate;                /* date and time of last disk check */
  384.     UInt32                          fileCount;                  /* number of files in volume */
  385.     UInt32                          folderCount;                /* number of directories in volume */
  386.     UInt32                          blockSize;                  /* size (in bytes) of allocation blocks */
  387.     UInt32                          totalBlocks;                /* number of allocation blocks in volume (includes this header and VBM*/
  388.     UInt32                          freeBlocks;                 /* number of unused allocation blocks */
  389.     UInt32                          nextAllocation;             /* start of next allocation search */
  390.     UInt32                          rsrcClumpSize;              /* default resource fork clump size */
  391.     UInt32                          dataClumpSize;              /* default data fork clump size */
  392.     HFSCatalogNodeID                nextCatalogID;              /* next unused catalog node ID */
  393.     UInt32                          writeCount;                 /* volume write count */
  394.     UInt64                          encodingsBitmap;            /* which encodings have been use  on this volume */
  395.     UInt8                           finderInfo[32];             /* information used by the Finder */
  396.     HFSPlusForkData                 allocationFile;             /* allocation bitmap file */
  397.     HFSPlusForkData                 extentsFile;                /* extents B-tree file */
  398.     HFSPlusForkData                 catalogFile;                /* catalog B-tree file */
  399.     HFSPlusForkData                 attributesFile;             /* extended attributes B-tree file */
  400.     HFSPlusForkData                 startupFile;                /* boot file */
  401. };
  402. typedef struct HFSPlusVolumeHeader      HFSPlusVolumeHeader;
  403. /* ---------- HFS and HFS Plus B-tree structures ---------- */
  404. /* BTNodeDescriptor -- Every B-tree node starts with these fields. */
  405. struct BTNodeDescriptor {
  406.     UInt32                          fLink;                      /*    next node at this level*/
  407.     UInt32                          bLink;                      /*    previous node at this level*/
  408.     SInt8                           kind;                       /*    kind of node (leaf, index, header, map)*/
  409.     UInt8                           height;                     /*    zero for header, map; child is one more than parent*/
  410.     UInt16                          numRecords;                 /*    number of records in this node*/
  411.     UInt16                          reserved;                   /*    reserved; set to zero*/
  412. };
  413. typedef struct BTNodeDescriptor         BTNodeDescriptor;
  414. /* Constants for BTNodeDescriptor kind */
  415. enum {
  416.     kBTLeafNode                 = -1,
  417.     kBTIndexNode                = 0,
  418.     kBTHeaderNode               = 1,
  419.     kBTMapNode                  = 2
  420. };
  421. /* BTHeaderRec -- The first record of a B-tree header node */
  422. struct BTHeaderRec {
  423.     UInt16                          treeDepth;                  /*    maximum height (usually leaf nodes)*/
  424.     UInt32                          rootNode;                   /*    node number of root node*/
  425.     UInt32                          leafRecords;                /*    number of leaf records in all leaf nodes*/
  426.     UInt32                          firstLeafNode;              /*    node number of first leaf node*/
  427.     UInt32                          lastLeafNode;               /*    node number of last leaf node*/
  428.     UInt16                          nodeSize;                   /*    size of a node, in bytes*/
  429.     UInt16                          maxKeyLength;               /*    reserved*/
  430.     UInt32                          totalNodes;                 /*    total number of nodes in tree*/
  431.     UInt32                          freeNodes;                  /*    number of unused (free) nodes in tree*/
  432.     UInt16                          reserved1;                  /*    unused*/
  433.     UInt32                          clumpSize;                  /*    reserved*/
  434.     UInt8                           btreeType;                  /*    reserved*/
  435.     UInt8                           reserved2;                  /*    reserved*/
  436.     UInt32                          attributes;                 /*    persistent attributes about the tree*/
  437.     UInt32                          reserved3[16];              /*    reserved*/
  438. };
  439. typedef struct BTHeaderRec              BTHeaderRec;
  440. /* Constants for BTHeaderRec attributes */
  441. enum {
  442.     kBTBadCloseMask             = 0x00000001,                   /*    reserved*/
  443.     kBTBigKeysMask              = 0x00000002,                   /*    key length field is 16 bits*/
  444.     kBTVariableIndexKeysMask    = 0x00000004                    /*    keys in index nodes are variable length*/
  445. };
  446. #if PRAGMA_STRUCT_ALIGN
  447.     #pragma options align=reset
  448. #elif PRAGMA_STRUCT_PACKPUSH
  449.     #pragma pack(pop)
  450. #elif PRAGMA_STRUCT_PACK
  451.     #pragma pack()
  452. #endif
  453. #ifdef PRAGMA_IMPORT_OFF
  454. #pragma import off
  455. #elif PRAGMA_IMPORT
  456. #pragma import reset
  457. #endif
  458. #ifdef __cplusplus
  459. }
  460. #endif
  461. #endif /* __HFSVOLUMES__ */