summaryrefslogtreecommitdiff
path: root/common/quicktime_win32/HFSVolumes.h
blob: 0604a10e3d539f90d725430b6a395481d924cb3a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
/*
     File:       HFSVolumes.h
 
     Contains:   On-disk data structures for HFS and HFS Plus volumes.
 
     Version:    QuickTime 7.3
 
     Copyright:  (c) 2007 (c) 1984-2001 by Apple Computer, Inc.  All rights reserved.
 
     Bugs?:      For bug reports, consult the following page on
                 the World Wide Web:
 
                     http://developer.apple.com/bugreporter/
 
*/
#ifndef __HFSVOLUMES__
#define __HFSVOLUMES__

#ifndef __MACTYPES__
#include <MacTypes.h>
#endif

#ifndef __FILES__
#include <Files.h>
#endif

#ifndef __FINDER__
#include <Finder.h>
#endif




#if PRAGMA_ONCE
#pragma once
#endif

#if PRAGMA_IMPORT
#pragma import on
#endif

#if PRAGMA_STRUCT_ALIGN
    #pragma options align=mac68k
#elif PRAGMA_STRUCT_PACKPUSH
    #pragma pack(push, 2)
#elif PRAGMA_STRUCT_PACK
    #pragma pack(2)
#endif

/* Signatures used to differentiate between HFS and HFS Plus volumes */
enum {
  kHFSSigWord                   = 0x4244, /* 'BD' in ASCII */
  kHFSPlusSigWord               = 0x482B, /* 'H+' in ASCII */
  kHFSPlusVersion               = 0x0004, /* will change as format changes (version 4 shipped with Mac OS 8.1) */
  kHFSPlusMountVersion          = FOUR_CHAR_CODE('8.10') /* will change as implementations change ('8.10' in Mac OS 8.1) */
};


/* CatalogNodeID is used to track catalog objects */
typedef UInt32                          HFSCatalogNodeID;
enum {
  kHFSMaxVolumeNameChars        = 27,
  kHFSMaxFileNameChars          = 31,
  kHFSPlusMaxFileNameChars      = 255
};


/* Extent overflow file data structures */
/* HFS Extent key */
struct HFSExtentKey {
  UInt8               keyLength;              /* length of key, excluding this field */
  UInt8               forkType;               /* 0 = data fork, FF = resource fork */
  HFSCatalogNodeID    fileID;                 /* file ID */
  UInt16              startBlock;             /* first file allocation block number in this extent */
};
typedef struct HFSExtentKey             HFSExtentKey;
/* HFS Plus Extent key */
struct HFSPlusExtentKey {
  UInt16              keyLength;              /* length of key, excluding this field */
  UInt8               forkType;               /* 0 = data fork, FF = resource fork */
  UInt8               pad;                    /* make the other fields align on 32-bit boundary */
  HFSCatalogNodeID    fileID;                 /* file ID */
  UInt32              startBlock;             /* first file allocation block number in this extent */
};
typedef struct HFSPlusExtentKey         HFSPlusExtentKey;
/* Number of extent descriptors per extent record */
enum {
  kHFSExtentDensity             = 3,
  kHFSPlusExtentDensity         = 8
};

/* HFS extent descriptor */
struct HFSExtentDescriptor {
  UInt16              startBlock;             /* first allocation block */
  UInt16              blockCount;             /* number of allocation blocks */
};
typedef struct HFSExtentDescriptor      HFSExtentDescriptor;
/* HFS Plus extent descriptor */
struct HFSPlusExtentDescriptor {
  UInt32              startBlock;             /* first allocation block */
  UInt32              blockCount;             /* number of allocation blocks */
};
typedef struct HFSPlusExtentDescriptor  HFSPlusExtentDescriptor;
/* HFS extent record */

typedef HFSExtentDescriptor             HFSExtentRecord[3];
/* HFS Plus extent record */
typedef HFSPlusExtentDescriptor         HFSPlusExtentRecord[8];

/* Fork data info (HFS Plus only) - 80 bytes */
struct HFSPlusForkData {
  UInt64              logicalSize;            /* fork's logical size in bytes */
  UInt32              clumpSize;              /* fork's clump size in bytes */
  UInt32              totalBlocks;            /* total blocks used by this fork */
  HFSPlusExtentRecord  extents;               /* initial set of extents */
};
typedef struct HFSPlusForkData          HFSPlusForkData;
/* Permissions info (HFS Plus only) - 16 bytes */
struct HFSPlusPermissions {
  UInt32              ownerID;                /* user or group ID of file/folder owner */
  UInt32              groupID;                /* additional user of group ID */
  UInt32              permissions;            /* permissions (bytes: unused, owner, group, everyone) */
  UInt32              specialDevice;          /* UNIX: device for character or block special file */
};
typedef struct HFSPlusPermissions       HFSPlusPermissions;
/* Catalog file data structures */
enum {
  kHFSRootParentID              = 1,    /* Parent ID of the root folder */
  kHFSRootFolderID              = 2,    /* Folder ID of the root folder */
  kHFSExtentsFileID             = 3,    /* File ID of the extents file */
  kHFSCatalogFileID             = 4,    /* File ID of the catalog file */
  kHFSBadBlockFileID            = 5,    /* File ID of the bad allocation block file */
  kHFSAllocationFileID          = 6,    /* File ID of the allocation file (HFS Plus only) */
  kHFSStartupFileID             = 7,    /* File ID of the startup file (HFS Plus only) */
  kHFSAttributesFileID          = 8,    /* File ID of the attribute file (HFS Plus only) */
  kHFSBogusExtentFileID         = 15,   /* Used for exchanging extents in extents file */
  kHFSFirstUserCatalogNodeID    = 16
};


/* HFS catalog key */
struct HFSCatalogKey {
  UInt8               keyLength;              /* key length (in bytes) */
  UInt8               reserved;               /* reserved (set to zero) */
  HFSCatalogNodeID    parentID;               /* parent folder ID */
  Str31               nodeName;               /* catalog node name */
};
typedef struct HFSCatalogKey            HFSCatalogKey;
/* HFS Plus catalog key */
struct HFSPlusCatalogKey {
  UInt16              keyLength;              /* key length (in bytes) */
  HFSCatalogNodeID    parentID;               /* parent folder ID */
  HFSUniStr255        nodeName;               /* catalog node name */
};
typedef struct HFSPlusCatalogKey        HFSPlusCatalogKey;

/* Catalog record types */
enum {
                                        /* HFS Catalog Records */
  kHFSFolderRecord              = 0x0100, /* Folder record */
  kHFSFileRecord                = 0x0200, /* File record */
  kHFSFolderThreadRecord        = 0x0300, /* Folder thread record */
  kHFSFileThreadRecord          = 0x0400, /* File thread record */
                                        /* HFS Plus Catalog Records */
  kHFSPlusFolderRecord          = 1,    /* Folder record */
  kHFSPlusFileRecord            = 2,    /* File record */
  kHFSPlusFolderThreadRecord    = 3,    /* Folder thread record */
  kHFSPlusFileThreadRecord      = 4     /* File thread record */
};


/* Catalog file record flags */
enum {
  kHFSFileLockedBit             = 0x0000, /* file is locked and cannot be written to */
  kHFSFileLockedMask            = 0x0001,
  kHFSThreadExistsBit           = 0x0001, /* a file thread record exists for this file */
  kHFSThreadExistsMask          = 0x0002
};


/* HFS catalog folder record - 70 bytes */
struct HFSCatalogFolder {
  SInt16              recordType;             /* record type */
  UInt16              flags;                  /* folder flags */
  UInt16              valence;                /* folder valence */
  HFSCatalogNodeID    folderID;               /* folder ID */
  UInt32              createDate;             /* date and time of creation */
  UInt32              modifyDate;             /* date and time of last modification */
  UInt32              backupDate;             /* date and time of last backup */
  DInfo               userInfo;               /* Finder information */
  DXInfo              finderInfo;             /* additional Finder information */
  UInt32              reserved[4];            /* reserved - set to zero */
};
typedef struct HFSCatalogFolder         HFSCatalogFolder;
/* HFS Plus catalog folder record - 88 bytes */
struct HFSPlusCatalogFolder {
  SInt16              recordType;             /* record type = HFS Plus folder record */
  UInt16              flags;                  /* file flags */
  UInt32              valence;                /* folder's valence (limited to 2^16 in Mac OS) */
  HFSCatalogNodeID    folderID;               /* folder ID */
  UInt32              createDate;             /* date and time of creation */
  UInt32              contentModDate;         /* date and time of last content modification */
  UInt32              attributeModDate;       /* date and time of last attribute modification */
  UInt32              accessDate;             /* date and time of last access (Rhapsody only) */
  UInt32              backupDate;             /* date and time of last backup */
  HFSPlusPermissions  permissions;            /* permissions (for Rhapsody) */
  DInfo               userInfo;               /* Finder information */
  DXInfo              finderInfo;             /* additional Finder information */
  UInt32              textEncoding;           /* hint for name conversions */
  UInt32              reserved;               /* reserved - set to zero */
};
typedef struct HFSPlusCatalogFolder     HFSPlusCatalogFolder;
/* HFS catalog file record - 102 bytes */
struct HFSCatalogFile {
  SInt16              recordType;             /* record type */
  UInt8               flags;                  /* file flags */
  SInt8               fileType;               /* file type (unused ?) */
  FInfo               userInfo;               /* Finder information */
  HFSCatalogNodeID    fileID;                 /* file ID */
  UInt16              dataStartBlock;         /* not used - set to zero */
  SInt32              dataLogicalSize;        /* logical EOF of data fork */
  SInt32              dataPhysicalSize;       /* physical EOF of data fork */
  UInt16              rsrcStartBlock;         /* not used - set to zero */
  SInt32              rsrcLogicalSize;        /* logical EOF of resource fork */
  SInt32              rsrcPhysicalSize;       /* physical EOF of resource fork */
  UInt32              createDate;             /* date and time of creation */
  UInt32              modifyDate;             /* date and time of last modification */
  UInt32              backupDate;             /* date and time of last backup */
  FXInfo              finderInfo;             /* additional Finder information */
  UInt16              clumpSize;              /* file clump size (not used) */
  HFSExtentRecord     dataExtents;            /* first data fork extent record */
  HFSExtentRecord     rsrcExtents;            /* first resource fork extent record */
  UInt32              reserved;               /* reserved - set to zero */
};
typedef struct HFSCatalogFile           HFSCatalogFile;
/* HFS Plus catalog file record - 248 bytes */
struct HFSPlusCatalogFile {
  SInt16              recordType;             /* record type = HFS Plus file record */
  UInt16              flags;                  /* file flags */
  UInt32              reserved1;              /* reserved - set to zero */
  HFSCatalogNodeID    fileID;                 /* file ID */
  UInt32              createDate;             /* date and time of creation */
  UInt32              contentModDate;         /* date and time of last content modification */
  UInt32              attributeModDate;       /* date and time of last attribute modification */
  UInt32              accessDate;             /* date and time of last access (Rhapsody only) */
  UInt32              backupDate;             /* date and time of last backup */
  HFSPlusPermissions  permissions;            /* permissions (for Rhapsody) */
  FInfo               userInfo;               /* Finder information */
  FXInfo              finderInfo;             /* additional Finder information */
  UInt32              textEncoding;           /* hint for name conversions */
  UInt32              reserved2;              /* reserved - set to zero */

                                              /* start on double long (64 bit) boundry */
  HFSPlusForkData     dataFork;               /* size and block data for data fork */
  HFSPlusForkData     resourceFork;           /* size and block data for resource fork */
};
typedef struct HFSPlusCatalogFile       HFSPlusCatalogFile;
/* HFS catalog thread record - 46 bytes */
struct HFSCatalogThread {
  SInt16              recordType;             /* record type */
  SInt32              reserved[2];            /* reserved - set to zero */
  HFSCatalogNodeID    parentID;               /* parent ID for this catalog node */
  Str31               nodeName;               /* name of this catalog node */
};
typedef struct HFSCatalogThread         HFSCatalogThread;
/* HFS Plus catalog thread record -- 264 bytes */
struct HFSPlusCatalogThread {
  SInt16              recordType;             /* record type */
  SInt16              reserved;               /* reserved - set to zero */
  HFSCatalogNodeID    parentID;               /* parent ID for this catalog node */
  HFSUniStr255        nodeName;               /* name of this catalog node (variable length) */
};
typedef struct HFSPlusCatalogThread     HFSPlusCatalogThread;

/*
    These are the types of records in the attribute B-tree.  The values were chosen
    so that they wouldn't conflict with the catalog record types.
*/
enum {
  kHFSPlusAttrInlineData        = 0x10, /* if size <  kAttrOverflowSize */
  kHFSPlusAttrForkData          = 0x20, /* if size >= kAttrOverflowSize */
  kHFSPlusAttrExtents           = 0x30  /* overflow extents for large attributes */
};


/*
    HFSPlusAttrInlineData
    For small attributes, whose entire value is stored within this one
    B-tree record.
    There would not be any other records for this attribute.
*/
struct HFSPlusAttrInlineData {
  UInt32              recordType;             /*    = kHFSPlusAttrInlineData*/
  UInt32              reserved;
  UInt32              logicalSize;            /*    size in bytes of userData*/
  UInt8               userData[2];            /*    variable length; space allocated is a multiple of 2 bytes*/
};
typedef struct HFSPlusAttrInlineData    HFSPlusAttrInlineData;
/*
    HFSPlusAttrForkData
    For larger attributes, whose value is stored in allocation blocks.
    If the attribute has more than 8 extents, there will be additonal
    records (of type HFSPlusAttrExtents) for this attribute.
*/
struct HFSPlusAttrForkData {
  UInt32              recordType;             /*    = kHFSPlusAttrForkData*/
  UInt32              reserved;
  HFSPlusForkData     theFork;                /*    size and first extents of value*/
};
typedef struct HFSPlusAttrForkData      HFSPlusAttrForkData;
/*
    HFSPlusAttrExtents
    This record contains information about overflow extents for large,
    fragmented attributes.
*/
struct HFSPlusAttrExtents {
  UInt32              recordType;             /*    = kHFSPlusAttrExtents*/
  UInt32              reserved;
  HFSPlusExtentRecord  extents;               /*    additional extents*/
};
typedef struct HFSPlusAttrExtents       HFSPlusAttrExtents;
/*  A generic Attribute Record*/
union HFSPlusAttrRecord {
  UInt32              recordType;
  HFSPlusAttrInlineData  inlineData;
  HFSPlusAttrForkData  forkData;
  HFSPlusAttrExtents  overflowExtents;
};
typedef union HFSPlusAttrRecord         HFSPlusAttrRecord;
/* Key and node lengths */
enum {
  kHFSPlusExtentKeyMaximumLength = sizeof(HFSPlusExtentKey) - sizeof(UInt16),
  kHFSExtentKeyMaximumLength    = sizeof(HFSExtentKey) - sizeof(UInt8),
  kHFSPlusCatalogKeyMaximumLength = sizeof(HFSPlusCatalogKey) - sizeof(UInt16),
  kHFSPlusCatalogKeyMinimumLength = kHFSPlusCatalogKeyMaximumLength - sizeof(HFSUniStr255) + sizeof(UInt16),
  kHFSCatalogKeyMaximumLength   = sizeof(HFSCatalogKey) - sizeof(UInt8),
  kHFSCatalogKeyMinimumLength   = kHFSCatalogKeyMaximumLength - sizeof(Str31) + sizeof(UInt8),
  kHFSPlusCatalogMinNodeSize    = 4096,
  kHFSPlusExtentMinNodeSize     = 512,
  kHFSPlusAttrMinNodeSize       = 4096
};


/* HFS and HFS Plus volume attribute bits */
enum {
                                        /* Bits 0-6 are reserved (always cleared by MountVol call) */
  kHFSVolumeHardwareLockBit     = 7,    /* volume is locked by hardware */
  kHFSVolumeUnmountedBit        = 8,    /* volume was successfully unmounted */
  kHFSVolumeSparedBlocksBit     = 9,    /* volume has bad blocks spared */
  kHFSVolumeNoCacheRequiredBit  = 10,   /* don't cache volume blocks (i.e. RAM or ROM disk) */
  kHFSBootVolumeInconsistentBit = 11,   /* boot volume is inconsistent (System 7.6 and later) */
                                        /* Bits 12-14 are reserved for future use */
  kHFSVolumeSoftwareLockBit     = 15,   /* volume is locked by software */
  kHFSVolumeHardwareLockMask    = 1 << kHFSVolumeHardwareLockBit,
  kHFSVolumeUnmountedMask       = 1 << kHFSVolumeUnmountedBit,
  kHFSVolumeSparedBlocksMask    = 1 << kHFSVolumeSparedBlocksBit,
  kHFSVolumeNoCacheRequiredMask = 1 << kHFSVolumeNoCacheRequiredBit,
  kHFSBootVolumeInconsistentMask = 1 << kHFSBootVolumeInconsistentBit,
  kHFSVolumeSoftwareLockMask    = 1 << kHFSVolumeSoftwareLockBit,
  kHFSMDBAttributesMask         = 0x8380
};

/* Master Directory Block (HFS only) - 162 bytes */
/* Stored at sector #2 (3rd sector) */
struct HFSMasterDirectoryBlock {

                                              /* These first fields are also used by MFS */

  UInt16              drSigWord;              /* volume signature */
  UInt32              drCrDate;               /* date and time of volume creation */
  UInt32              drLsMod;                /* date and time of last modification */
  UInt16              drAtrb;                 /* volume attributes */
  UInt16              drNmFls;                /* number of files in root folder */
  UInt16              drVBMSt;                /* first block of volume bitmap */
  UInt16              drAllocPtr;             /* start of next allocation search */
  UInt16              drNmAlBlks;             /* number of allocation blocks in volume */
  UInt32              drAlBlkSiz;             /* size (in bytes) of allocation blocks */
  UInt32              drClpSiz;               /* default clump size */
  UInt16              drAlBlSt;               /* first allocation block in volume */
  UInt32              drNxtCNID;              /* next unused catalog node ID */
  UInt16              drFreeBks;              /* number of unused allocation blocks */
  Str27               drVN;                   /* volume name */

                                              /* Master Directory Block extensions for HFS */

  UInt32              drVolBkUp;              /* date and time of last backup */
  UInt16              drVSeqNum;              /* volume backup sequence number */
  UInt32              drWrCnt;                /* volume write count */
  UInt32              drXTClpSiz;             /* clump size for extents overflow file */
  UInt32              drCTClpSiz;             /* clump size for catalog file */
  UInt16              drNmRtDirs;             /* number of directories in root folder */
  UInt32              drFilCnt;               /* number of files in volume */
  UInt32              drDirCnt;               /* number of directories in volume */
  SInt32              drFndrInfo[8];          /* information used by the Finder */
  UInt16              drEmbedSigWord;         /* embedded volume signature (formerly drVCSize) */
  HFSExtentDescriptor  drEmbedExtent;         /* embedded volume location and size (formerly drVBMCSize and drCtlCSize) */
  UInt32              drXTFlSize;             /* size of extents overflow file */
  HFSExtentRecord     drXTExtRec;             /* extent record for extents overflow file */
  UInt32              drCTFlSize;             /* size of catalog file */
  HFSExtentRecord     drCTExtRec;             /* extent record for catalog file */
};
typedef struct HFSMasterDirectoryBlock  HFSMasterDirectoryBlock;
/* HFSPlusVolumeHeader (HFS Plus only) - 512 bytes */
/* Stored at sector #2 (3rd sector) and second-to-last sector. */
struct HFSPlusVolumeHeader {
  UInt16              signature;              /* volume signature == 'H+' */
  UInt16              version;                /* current version is kHFSPlusVersion */
  UInt32              attributes;             /* volume attributes */
  UInt32              lastMountedVersion;     /* implementation version which last mounted volume */
  UInt32              reserved;               /* reserved - set to zero */

  UInt32              createDate;             /* date and time of volume creation */
  UInt32              modifyDate;             /* date and time of last modification */
  UInt32              backupDate;             /* date and time of last backup */
  UInt32              checkedDate;            /* date and time of last disk check */

  UInt32              fileCount;              /* number of files in volume */
  UInt32              folderCount;            /* number of directories in volume */

  UInt32              blockSize;              /* size (in bytes) of allocation blocks */
  UInt32              totalBlocks;            /* number of allocation blocks in volume (includes this header and VBM*/
  UInt32              freeBlocks;             /* number of unused allocation blocks */

  UInt32              nextAllocation;         /* start of next allocation search */
  UInt32              rsrcClumpSize;          /* default resource fork clump size */
  UInt32              dataClumpSize;          /* default data fork clump size */
  HFSCatalogNodeID    nextCatalogID;          /* next unused catalog node ID */

  UInt32              writeCount;             /* volume write count */
  UInt64              encodingsBitmap;        /* which encodings have been use  on this volume */

  UInt8               finderInfo[32];         /* information used by the Finder */

  HFSPlusForkData     allocationFile;         /* allocation bitmap file */
  HFSPlusForkData     extentsFile;            /* extents B-tree file */
  HFSPlusForkData     catalogFile;            /* catalog B-tree file */
  HFSPlusForkData     attributesFile;         /* extended attributes B-tree file */
  HFSPlusForkData     startupFile;            /* boot file */
};
typedef struct HFSPlusVolumeHeader      HFSPlusVolumeHeader;
/* ---------- HFS and HFS Plus B-tree structures ---------- */
/* BTNodeDescriptor -- Every B-tree node starts with these fields. */
struct BTNodeDescriptor {
  UInt32              fLink;                  /*    next node at this level*/
  UInt32              bLink;                  /*    previous node at this level*/
  SInt8               kind;                   /*    kind of node (leaf, index, header, map)*/
  UInt8               height;                 /*    zero for header, map; child is one more than parent*/
  UInt16              numRecords;             /*    number of records in this node*/
  UInt16              reserved;               /*    reserved; set to zero*/
};
typedef struct BTNodeDescriptor         BTNodeDescriptor;
/* Constants for BTNodeDescriptor kind */
enum {
  kBTLeafNode                   = -1,
  kBTIndexNode                  = 0,
  kBTHeaderNode                 = 1,
  kBTMapNode                    = 2
};

/* BTHeaderRec -- The first record of a B-tree header node */
struct BTHeaderRec {
  UInt16              treeDepth;              /*    maximum height (usually leaf nodes)*/
  UInt32              rootNode;               /*    node number of root node*/
  UInt32              leafRecords;            /*    number of leaf records in all leaf nodes*/
  UInt32              firstLeafNode;          /*    node number of first leaf node*/
  UInt32              lastLeafNode;           /*    node number of last leaf node*/
  UInt16              nodeSize;               /*    size of a node, in bytes*/
  UInt16              maxKeyLength;           /*    reserved*/
  UInt32              totalNodes;             /*    total number of nodes in tree*/
  UInt32              freeNodes;              /*    number of unused (free) nodes in tree*/
  UInt16              reserved1;              /*    unused*/
  UInt32              clumpSize;              /*    reserved*/
  UInt8               btreeType;              /*    reserved*/
  UInt8               reserved2;              /*    reserved*/
  UInt32              attributes;             /*    persistent attributes about the tree*/
  UInt32              reserved3[16];          /*    reserved*/
};
typedef struct BTHeaderRec              BTHeaderRec;
/* Constants for BTHeaderRec attributes */
enum {
  kBTBadCloseMask               = 0x00000001, /*    reserved*/
  kBTBigKeysMask                = 0x00000002, /*    key length field is 16 bits*/
  kBTVariableIndexKeysMask      = 0x00000004 /*    keys in index nodes are variable length*/
};


#if PRAGMA_STRUCT_ALIGN
    #pragma options align=reset
#elif PRAGMA_STRUCT_PACKPUSH
    #pragma pack(pop)
#elif PRAGMA_STRUCT_PACK
    #pragma pack()
#endif

#ifdef PRAGMA_IMPORT_OFF
#pragma import off
#elif PRAGMA_IMPORT
#pragma import reset
#endif


#endif /* __HFSVOLUMES__ */