2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
20 * @APPLE_LICENSE_HEADER_END@
22 #ifndef __HFS_FORMAT__
23 #define __HFS_FORMAT__
25 #include <sys/appleapiopts.h>
30 * This file describes the on-disk format for HFS and HFS Plus volumes.
31 * The HFS Plus volume format is desciibed in detail in Apple Technote 1150.
33 * http://developer.apple.com/technotes/tn/tn1150.html
41 /* some on-disk hfs structures have 68K alignment (misaligned) */
42 #pragma options align=mac68k
44 /* Signatures used to differentiate between HFS and HFS Plus volumes */
46 kHFSSigWord
= 0x4244, /* 'BD' in ASCII */
47 kHFSPlusSigWord
= 0x482B, /* 'H+' in ASCII */
48 kHFSPlusVersion
= 0x0004, /* will change as format changes */
49 /* version 4 shipped with Mac OS 8.1 */
50 kHFSPlusMountVersion
= 0x31302E30 /* '10.0' for Mac OS X */
54 #ifdef __APPLE_API_PRIVATE
56 * Mac OS X has a special directory for linked and unlinked files (HFS Plus only).
57 * This directory and its contents are never exported from the filesystem under
60 * To make this folder name sort last, it has embedded null prefix.
61 * (0xC0, 0x80 in UTF-8)
63 #define HFSPLUSMETADATAFOLDER "\xC0\x80\xC0\x80\xC0\x80\xC0\x80HFS+ Private Data"
66 * Files in the HFS Private Data folder have one of the following prefixes
67 * followed by a decimal number (no leading zeros). For indirect nodes this
68 * number is a 32 bit random number. For unlinked (deleted) files that are
69 * still open, the number is the file ID for that file.
71 * e.g. iNode7182000 and temp3296
73 #define HFS_INODE_PREFIX "iNode"
74 #define HFS_DELETE_PREFIX "temp"
76 #endif /* __APPLE_API_PRIVATE */
79 * Indirect link files (hard links) have the following type/creator.
82 kHardLinkFileType
= 0x686C6E6B, /* 'hlnk' */
83 kHFSPlusCreator
= 0x6866732B /* 'hfs+' */
87 /* Unicode strings are used for HFS Plus file and folder names */
89 u_int16_t length
; /* number of unicode characters */
90 u_int16_t unicode
[255]; /* unicode characters */
92 typedef struct HFSUniStr255 HFSUniStr255
;
93 typedef const HFSUniStr255
*ConstHFSUniStr255Param
;
96 kHFSMaxVolumeNameChars
= 27,
97 kHFSMaxFileNameChars
= 31,
98 kHFSPlusMaxFileNameChars
= 255
102 /* Extent overflow file data structures */
105 struct HFSExtentKey
{
106 u_int8_t keyLength
; /* length of key, excluding this field */
107 u_int8_t forkType
; /* 0 = data fork, FF = resource fork */
108 u_int32_t fileID
; /* file ID */
109 u_int16_t startBlock
; /* first file allocation block number in this extent */
111 typedef struct HFSExtentKey HFSExtentKey
;
113 /* HFS Plus Extent key */
114 struct HFSPlusExtentKey
{
115 u_int16_t keyLength
; /* length of key, excluding this field */
116 u_int8_t forkType
; /* 0 = data fork, FF = resource fork */
117 u_int8_t pad
; /* make the other fields align on 32-bit boundary */
118 u_int32_t fileID
; /* file ID */
119 u_int32_t startBlock
; /* first file allocation block number in this extent */
121 typedef struct HFSPlusExtentKey HFSPlusExtentKey
;
123 /* Number of extent descriptors per extent record */
125 kHFSExtentDensity
= 3,
126 kHFSPlusExtentDensity
= 8
129 /* HFS extent descriptor */
130 struct HFSExtentDescriptor
{
131 u_int16_t startBlock
; /* first allocation block */
132 u_int16_t blockCount
; /* number of allocation blocks */
134 typedef struct HFSExtentDescriptor HFSExtentDescriptor
;
136 /* HFS Plus extent descriptor */
137 struct HFSPlusExtentDescriptor
{
138 u_int32_t startBlock
; /* first allocation block */
139 u_int32_t blockCount
; /* number of allocation blocks */
141 typedef struct HFSPlusExtentDescriptor HFSPlusExtentDescriptor
;
143 /* HFS extent record */
144 typedef HFSExtentDescriptor HFSExtentRecord
[3];
146 /* HFS Plus extent record */
147 typedef HFSPlusExtentDescriptor HFSPlusExtentRecord
[8];
150 /* Finder information */
151 struct FndrFileInfo
{
152 u_int32_t fdType
; /* file type */
153 u_int32_t fdCreator
; /* file creator */
154 u_int16_t fdFlags
; /* Finder flags */
156 int16_t v
; /* file's location */
161 typedef struct FndrFileInfo FndrFileInfo
;
164 struct { /* folder's window rectangle */
170 unsigned short frFlags
; /* Finder flags */
172 u_int16_t v
; /* folder's location */
177 typedef struct FndrDirInfo FndrDirInfo
;
179 struct FndrOpaqueInfo
{
182 typedef struct FndrOpaqueInfo FndrOpaqueInfo
;
185 /* HFS Plus Fork data info - 80 bytes */
186 struct HFSPlusForkData
{
187 u_int64_t logicalSize
; /* fork's logical size in bytes */
188 u_int32_t clumpSize
; /* fork's clump size in bytes */
189 u_int32_t totalBlocks
; /* total blocks used by this fork */
190 HFSPlusExtentRecord extents
; /* initial set of extents */
192 typedef struct HFSPlusForkData HFSPlusForkData
;
195 /* Mac OS X has 16 bytes worth of "BSD" info.
197 * Note: Mac OS 9 implementations and applications
198 * should preserve, but not change, this information.
200 struct HFSPlusBSDInfo
{
201 u_int32_t ownerID
; /* user or group ID of file/folder owner */
202 u_int32_t groupID
; /* additional user of group ID */
203 u_int8_t adminFlags
; /* super-user changeable flags */
204 u_int8_t ownerFlags
; /* owner changeable flags */
205 u_int16_t fileMode
; /* file type and permission bits */
207 u_int32_t iNodeNum
; /* indirect node number (hard links only) */
208 u_int32_t linkCount
; /* links that refer to this indirect node */
209 u_int32_t rawDevice
; /* special file device (FBLK and FCHR only) */
212 typedef struct HFSPlusBSDInfo HFSPlusBSDInfo
;
215 /* Catalog file data structures */
218 kHFSRootParentID
= 1, /* Parent ID of the root folder */
219 kHFSRootFolderID
= 2, /* Folder ID of the root folder */
220 kHFSExtentsFileID
= 3, /* File ID of the extents file */
221 kHFSCatalogFileID
= 4, /* File ID of the catalog file */
222 kHFSBadBlockFileID
= 5, /* File ID of the bad allocation block file */
223 kHFSAllocationFileID
= 6, /* File ID of the allocation file (HFS Plus only) */
224 kHFSStartupFileID
= 7, /* File ID of the startup file (HFS Plus only) */
225 kHFSAttributesFileID
= 8, /* File ID of the attribute file (HFS Plus only) */
226 kHFSBogusExtentFileID
= 15, /* Used for exchanging extents in extents file */
227 kHFSFirstUserCatalogNodeID
= 16
230 /* HFS catalog key */
231 struct HFSCatalogKey
{
232 u_int8_t keyLength
; /* key length (in bytes) */
233 u_int8_t reserved
; /* reserved (set to zero) */
234 u_int32_t parentID
; /* parent folder ID */
235 u_char nodeName
[kHFSMaxFileNameChars
+ 1]; /* catalog node name */
237 typedef struct HFSCatalogKey HFSCatalogKey
;
239 /* HFS Plus catalog key */
240 struct HFSPlusCatalogKey
{
241 u_int16_t keyLength
; /* key length (in bytes) */
242 u_int32_t parentID
; /* parent folder ID */
243 HFSUniStr255 nodeName
; /* catalog node name */
245 typedef struct HFSPlusCatalogKey HFSPlusCatalogKey
;
247 /* Catalog record types */
249 /* HFS Catalog Records */
250 kHFSFolderRecord
= 0x0100, /* Folder record */
251 kHFSFileRecord
= 0x0200, /* File record */
252 kHFSFolderThreadRecord
= 0x0300, /* Folder thread record */
253 kHFSFileThreadRecord
= 0x0400, /* File thread record */
255 /* HFS Plus Catalog Records */
256 kHFSPlusFolderRecord
= 1, /* Folder record */
257 kHFSPlusFileRecord
= 2, /* File record */
258 kHFSPlusFolderThreadRecord
= 3, /* Folder thread record */
259 kHFSPlusFileThreadRecord
= 4 /* File thread record */
263 /* Catalog file record flags */
265 kHFSFileLockedBit
= 0x0000, /* file is locked and cannot be written to */
266 kHFSFileLockedMask
= 0x0001,
267 kHFSThreadExistsBit
= 0x0001, /* a file thread record exists for this file */
268 kHFSThreadExistsMask
= 0x0002
272 /* HFS catalog folder record - 70 bytes */
273 struct HFSCatalogFolder
{
274 int16_t recordType
; /* == kHFSFolderRecord */
275 u_int16_t flags
; /* folder flags */
276 u_int16_t valence
; /* folder valence */
277 u_int32_t folderID
; /* folder ID */
278 u_int32_t createDate
; /* date and time of creation */
279 u_int32_t modifyDate
; /* date and time of last modification */
280 u_int32_t backupDate
; /* date and time of last backup */
281 FndrDirInfo userInfo
; /* Finder information */
282 FndrOpaqueInfo finderInfo
; /* additional Finder information */
283 u_int32_t reserved
[4]; /* reserved - initialized as zero */
285 typedef struct HFSCatalogFolder HFSCatalogFolder
;
287 /* HFS Plus catalog folder record - 88 bytes */
288 struct HFSPlusCatalogFolder
{
289 int16_t recordType
; /* == kHFSPlusFolderRecord */
290 u_int16_t flags
; /* file flags */
291 u_int32_t valence
; /* folder's valence (limited to 2^16 in Mac OS) */
292 u_int32_t folderID
; /* folder ID */
293 u_int32_t createDate
; /* date and time of creation */
294 u_int32_t contentModDate
; /* date and time of last content modification */
295 u_int32_t attributeModDate
; /* date and time of last attribute modification */
296 u_int32_t accessDate
; /* date and time of last access (MacOS X only) */
297 u_int32_t backupDate
; /* date and time of last backup */
298 HFSPlusBSDInfo bsdInfo
; /* permissions (for MacOS X) */
299 FndrDirInfo userInfo
; /* Finder information */
300 FndrOpaqueInfo finderInfo
; /* additional Finder information */
301 u_int32_t textEncoding
; /* hint for name conversions */
302 u_int32_t reserved
; /* reserved - initialized as zero */
304 typedef struct HFSPlusCatalogFolder HFSPlusCatalogFolder
;
306 /* HFS catalog file record - 102 bytes */
307 struct HFSCatalogFile
{
308 int16_t recordType
; /* == kHFSFileRecord */
309 u_int8_t flags
; /* file flags */
310 int8_t fileType
; /* file type (unused ?) */
311 FndrFileInfo userInfo
; /* Finder information */
312 u_int32_t fileID
; /* file ID */
313 u_int16_t dataStartBlock
; /* not used - set to zero */
314 int32_t dataLogicalSize
; /* logical EOF of data fork */
315 int32_t dataPhysicalSize
; /* physical EOF of data fork */
316 u_int16_t rsrcStartBlock
; /* not used - set to zero */
317 int32_t rsrcLogicalSize
; /* logical EOF of resource fork */
318 int32_t rsrcPhysicalSize
; /* physical EOF of resource fork */
319 u_int32_t createDate
; /* date and time of creation */
320 u_int32_t modifyDate
; /* date and time of last modification */
321 u_int32_t backupDate
; /* date and time of last backup */
322 FndrOpaqueInfo finderInfo
; /* additional Finder information */
323 u_int16_t clumpSize
; /* file clump size (not used) */
324 HFSExtentRecord dataExtents
; /* first data fork extent record */
325 HFSExtentRecord rsrcExtents
; /* first resource fork extent record */
326 u_int32_t reserved
; /* reserved - initialized as zero */
328 typedef struct HFSCatalogFile HFSCatalogFile
;
330 /* HFS Plus catalog file record - 248 bytes */
331 struct HFSPlusCatalogFile
{
332 int16_t recordType
; /* == kHFSPlusFileRecord */
333 u_int16_t flags
; /* file flags */
334 u_int32_t reserved1
; /* reserved - initialized as zero */
335 u_int32_t fileID
; /* file ID */
336 u_int32_t createDate
; /* date and time of creation */
337 u_int32_t contentModDate
; /* date and time of last content modification */
338 u_int32_t attributeModDate
; /* date and time of last attribute modification */
339 u_int32_t accessDate
; /* date and time of last access (MacOS X only) */
340 u_int32_t backupDate
; /* date and time of last backup */
341 HFSPlusBSDInfo bsdInfo
; /* permissions (for MacOS X) */
342 FndrFileInfo userInfo
; /* Finder information */
343 FndrOpaqueInfo finderInfo
; /* additional Finder information */
344 u_int32_t textEncoding
; /* hint for name conversions */
345 u_int32_t reserved2
; /* reserved - initialized as zero */
347 /* Note: these start on double long (64 bit) boundry */
348 HFSPlusForkData dataFork
; /* size and block data for data fork */
349 HFSPlusForkData resourceFork
; /* size and block data for resource fork */
351 typedef struct HFSPlusCatalogFile HFSPlusCatalogFile
;
353 /* HFS catalog thread record - 46 bytes */
354 struct HFSCatalogThread
{
355 int16_t recordType
; /* == kHFSFolderThreadRecord or kHFSFileThreadRecord */
356 int32_t reserved
[2]; /* reserved - initialized as zero */
357 u_int32_t parentID
; /* parent ID for this catalog node */
358 u_char nodeName
[kHFSMaxFileNameChars
+ 1]; /* name of this catalog node */
360 typedef struct HFSCatalogThread HFSCatalogThread
;
362 /* HFS Plus catalog thread record -- 264 bytes */
363 struct HFSPlusCatalogThread
{
364 int16_t recordType
; /* == kHFSPlusFolderThreadRecord or kHFSPlusFileThreadRecord */
365 int16_t reserved
; /* reserved - initialized as zero */
366 u_int32_t parentID
; /* parent ID for this catalog node */
367 HFSUniStr255 nodeName
; /* name of this catalog node (variable length) */
369 typedef struct HFSPlusCatalogThread HFSPlusCatalogThread
;
371 #ifdef __APPLE_API_UNSTABLE
373 These are the types of records in the attribute B-tree. The values were
374 chosen so that they wouldn't conflict with the catalog record types.
377 kHFSPlusAttrInlineData
= 0x10, /* if size < kAttrOverflowSize */
378 kHFSPlusAttrForkData
= 0x20, /* if size >= kAttrOverflowSize */
379 kHFSPlusAttrExtents
= 0x30 /* overflow extents for large attributes */
384 HFSPlusAttrInlineData
385 For small attributes, whose entire value is stored within this one
387 There would not be any other records for this attribute.
389 struct HFSPlusAttrInlineData
{
390 u_int32_t recordType
; /* == kHFSPlusAttrInlineData*/
392 u_int32_t logicalSize
; /* size in bytes of userData*/
393 u_int8_t userData
[2]; /* variable length; space allocated is a multiple of 2 bytes*/
395 typedef struct HFSPlusAttrInlineData HFSPlusAttrInlineData
;
400 For larger attributes, whose value is stored in allocation blocks.
401 If the attribute has more than 8 extents, there will be additonal
402 records (of type HFSPlusAttrExtents) for this attribute.
404 struct HFSPlusAttrForkData
{
405 u_int32_t recordType
; /* == kHFSPlusAttrForkData*/
407 HFSPlusForkData theFork
; /* size and first extents of value*/
409 typedef struct HFSPlusAttrForkData HFSPlusAttrForkData
;
413 This record contains information about overflow extents for large,
414 fragmented attributes.
416 struct HFSPlusAttrExtents
{
417 u_int32_t recordType
; /* == kHFSPlusAttrExtents*/
419 HFSPlusExtentRecord extents
; /* additional extents*/
421 typedef struct HFSPlusAttrExtents HFSPlusAttrExtents
;
423 /* A generic Attribute Record*/
424 union HFSPlusAttrRecord
{
425 u_int32_t recordType
;
426 HFSPlusAttrInlineData inlineData
;
427 HFSPlusAttrForkData forkData
;
428 HFSPlusAttrExtents overflowExtents
;
430 typedef union HFSPlusAttrRecord HFSPlusAttrRecord
;
432 /* Key and node lengths */
434 kHFSPlusExtentKeyMaximumLength
= sizeof(HFSPlusExtentKey
) - sizeof(u_int16_t
),
435 kHFSExtentKeyMaximumLength
= sizeof(HFSExtentKey
) - sizeof(u_int8_t
),
436 kHFSPlusCatalogKeyMaximumLength
= sizeof(HFSPlusCatalogKey
) - sizeof(u_int16_t
),
437 kHFSPlusCatalogKeyMinimumLength
= kHFSPlusCatalogKeyMaximumLength
- sizeof(HFSUniStr255
) + sizeof(u_int16_t
),
438 kHFSCatalogKeyMaximumLength
= sizeof(HFSCatalogKey
) - sizeof(u_int8_t
),
439 kHFSCatalogKeyMinimumLength
= kHFSCatalogKeyMaximumLength
- (kHFSMaxFileNameChars
+ 1) + sizeof(u_int8_t
),
440 kHFSPlusCatalogMinNodeSize
= 4096,
441 kHFSPlusExtentMinNodeSize
= 512,
442 kHFSPlusAttrMinNodeSize
= 4096
444 #endif /* __APPLE_API_UNSTABLE */
446 /* HFS and HFS Plus volume attribute bits */
448 /* Bits 0-6 are reserved (always cleared by MountVol call) */
449 kHFSVolumeHardwareLockBit
= 7, /* volume is locked by hardware */
450 kHFSVolumeUnmountedBit
= 8, /* volume was successfully unmounted */
451 kHFSVolumeSparedBlocksBit
= 9, /* volume has bad blocks spared */
452 kHFSVolumeNoCacheRequiredBit
= 10, /* don't cache volume blocks (i.e. RAM or ROM disk) */
453 kHFSBootVolumeInconsistentBit
= 11, /* boot volume is inconsistent (System 7.6 and later) */
454 kHFSCatalogNodeIDsReusedBit
= 12,
455 /* Bits 13-14 are reserved for future use */
456 kHFSVolumeSoftwareLockBit
= 15, /* volume is locked by software */
458 kHFSVolumeHardwareLockMask
= 1 << kHFSVolumeHardwareLockBit
,
459 kHFSVolumeUnmountedMask
= 1 << kHFSVolumeUnmountedBit
,
460 kHFSVolumeSparedBlocksMask
= 1 << kHFSVolumeSparedBlocksBit
,
461 kHFSVolumeNoCacheRequiredMask
= 1 << kHFSVolumeNoCacheRequiredBit
,
462 kHFSBootVolumeInconsistentMask
= 1 << kHFSBootVolumeInconsistentBit
,
463 kHFSCatalogNodeIDsReusedMask
= 1 << kHFSCatalogNodeIDsReusedBit
,
464 kHFSVolumeSoftwareLockMask
= 1 << kHFSVolumeSoftwareLockBit
,
465 kHFSMDBAttributesMask
= 0x8380
469 /* HFS Master Directory Block - 162 bytes */
470 /* Stored at sector #2 (3rd sector) and second-to-last sector. */
471 struct HFSMasterDirectoryBlock
{
472 u_int16_t drSigWord
; /* == kHFSSigWord */
473 u_int32_t drCrDate
; /* date and time of volume creation */
474 u_int32_t drLsMod
; /* date and time of last modification */
475 u_int16_t drAtrb
; /* volume attributes */
476 u_int16_t drNmFls
; /* number of files in root folder */
477 u_int16_t drVBMSt
; /* first block of volume bitmap */
478 u_int16_t drAllocPtr
; /* start of next allocation search */
479 u_int16_t drNmAlBlks
; /* number of allocation blocks in volume */
480 u_int32_t drAlBlkSiz
; /* size (in bytes) of allocation blocks */
481 u_int32_t drClpSiz
; /* default clump size */
482 u_int16_t drAlBlSt
; /* first allocation block in volume */
483 u_int32_t drNxtCNID
; /* next unused catalog node ID */
484 u_int16_t drFreeBks
; /* number of unused allocation blocks */
485 u_char drVN
[kHFSMaxVolumeNameChars
+ 1]; /* volume name */
486 u_int32_t drVolBkUp
; /* date and time of last backup */
487 u_int16_t drVSeqNum
; /* volume backup sequence number */
488 u_int32_t drWrCnt
; /* volume write count */
489 u_int32_t drXTClpSiz
; /* clump size for extents overflow file */
490 u_int32_t drCTClpSiz
; /* clump size for catalog file */
491 u_int16_t drNmRtDirs
; /* number of directories in root folder */
492 u_int32_t drFilCnt
; /* number of files in volume */
493 u_int32_t drDirCnt
; /* number of directories in volume */
494 u_int32_t drFndrInfo
[8]; /* information used by the Finder */
495 u_int16_t drEmbedSigWord
; /* embedded volume signature (formerly drVCSize) */
496 HFSExtentDescriptor drEmbedExtent
; /* embedded volume location and size (formerly drVBMCSize and drCtlCSize) */
497 u_int32_t drXTFlSize
; /* size of extents overflow file */
498 HFSExtentRecord drXTExtRec
; /* extent record for extents overflow file */
499 u_int32_t drCTFlSize
; /* size of catalog file */
500 HFSExtentRecord drCTExtRec
; /* extent record for catalog file */
502 typedef struct HFSMasterDirectoryBlock HFSMasterDirectoryBlock
;
505 /* HFS Plus Volume Header - 512 bytes */
506 /* Stored at sector #2 (3rd sector) and second-to-last sector. */
507 struct HFSPlusVolumeHeader
{
508 u_int16_t signature
; /* == kHFSPlusSigWord */
509 u_int16_t version
; /* == kHFSPlusVersion */
510 u_int32_t attributes
; /* volume attributes */
511 u_int32_t lastMountedVersion
; /* implementation version which last mounted volume */
512 u_int32_t reserved
; /* reserved - initialized as zero */
514 u_int32_t createDate
; /* date and time of volume creation */
515 u_int32_t modifyDate
; /* date and time of last modification */
516 u_int32_t backupDate
; /* date and time of last backup */
517 u_int32_t checkedDate
; /* date and time of last disk check */
519 u_int32_t fileCount
; /* number of files in volume */
520 u_int32_t folderCount
; /* number of directories in volume */
522 u_int32_t blockSize
; /* size (in bytes) of allocation blocks */
523 u_int32_t totalBlocks
; /* number of allocation blocks in volume (includes this header and VBM*/
524 u_int32_t freeBlocks
; /* number of unused allocation blocks */
526 u_int32_t nextAllocation
; /* start of next allocation search */
527 u_int32_t rsrcClumpSize
; /* default resource fork clump size */
528 u_int32_t dataClumpSize
; /* default data fork clump size */
529 u_int32_t nextCatalogID
; /* next unused catalog node ID */
531 u_int32_t writeCount
; /* volume write count */
532 u_int64_t encodingsBitmap
; /* which encodings have been use on this volume */
534 u_int8_t finderInfo
[32]; /* information used by the Finder */
536 HFSPlusForkData allocationFile
; /* allocation bitmap file */
537 HFSPlusForkData extentsFile
; /* extents B-tree file */
538 HFSPlusForkData catalogFile
; /* catalog B-tree file */
539 HFSPlusForkData attributesFile
; /* extended attributes B-tree file */
540 HFSPlusForkData startupFile
; /* boot file (secondary loader) */
542 typedef struct HFSPlusVolumeHeader HFSPlusVolumeHeader
;
545 /* B-tree structures */
554 u_int8_t rawData
[kMaxKeyLength
+2];
556 typedef union BTreeKey BTreeKey
;
558 /* BTNodeDescriptor -- Every B-tree node starts with these fields. */
559 struct BTNodeDescriptor
{
560 u_int32_t fLink
; /* next node at this level*/
561 u_int32_t bLink
; /* previous node at this level*/
562 int8_t kind
; /* kind of node (leaf, index, header, map)*/
563 u_int8_t height
; /* zero for header, map; child is one more than parent*/
564 u_int16_t numRecords
; /* number of records in this node*/
565 u_int16_t reserved
; /* reserved - initialized as zero */
567 typedef struct BTNodeDescriptor BTNodeDescriptor
;
569 /* Constants for BTNodeDescriptor kind */
577 /* BTHeaderRec -- The first record of a B-tree header node */
579 u_int16_t treeDepth
; /* maximum height (usually leaf nodes) */
580 u_int32_t rootNode
; /* node number of root node */
581 u_int32_t leafRecords
; /* number of leaf records in all leaf nodes */
582 u_int32_t firstLeafNode
; /* node number of first leaf node */
583 u_int32_t lastLeafNode
; /* node number of last leaf node */
584 u_int16_t nodeSize
; /* size of a node, in bytes */
585 u_int16_t maxKeyLength
; /* reserved */
586 u_int32_t totalNodes
; /* total number of nodes in tree */
587 u_int32_t freeNodes
; /* number of unused (free) nodes in tree */
588 u_int16_t reserved1
; /* unused */
589 u_int32_t clumpSize
; /* reserved */
590 u_int8_t btreeType
; /* reserved */
591 u_int8_t reserved2
; /* reserved */
592 u_int32_t attributes
; /* persistent attributes about the tree */
593 u_int32_t reserved3
[16]; /* reserved */
595 typedef struct BTHeaderRec BTHeaderRec
;
597 /* Constants for BTHeaderRec attributes */
599 kBTBadCloseMask
= 0x00000001, /* reserved */
600 kBTBigKeysMask
= 0x00000002, /* key length field is 16 bits */
601 kBTVariableIndexKeysMask
= 0x00000004 /* keys in index nodes are variable length */
604 #pragma options align=reset
610 #endif /* __HFS_FORMAT__ */