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 kHFSJSigWord
= 0x484a, /* 'HJ' in ASCII */
49 kHFSPlusVersion
= 0x0004, /* will change as format changes */
50 /* version 4 shipped with Mac OS 8.1 */
51 kHFSPlusMountVersion
= 0x31302E30, /* '10.0' for Mac OS X */
52 kHFSJMountVersion
= 0x4846534a /* 'HFSJ' for journaled HFS+ on OS X */
56 #ifdef __APPLE_API_PRIVATE
58 * Mac OS X has a special directory for linked and unlinked files (HFS Plus only).
59 * This directory and its contents are never exported from the filesystem under
62 * To make this folder name sort last, it has embedded null prefix.
63 * (0xC0, 0x80 in UTF-8)
65 #define HFSPLUSMETADATAFOLDER "\xC0\x80\xC0\x80\xC0\x80\xC0\x80HFS+ Private Data"
68 * Files in the HFS Private Data folder have one of the following prefixes
69 * followed by a decimal number (no leading zeros). For indirect nodes this
70 * number is a 32 bit random number. For unlinked (deleted) files that are
71 * still open, the number is the file ID for that file.
73 * e.g. iNode7182000 and temp3296
75 #define HFS_INODE_PREFIX "iNode"
76 #define HFS_DELETE_PREFIX "temp"
78 #endif /* __APPLE_API_PRIVATE */
81 * Indirect link files (hard links) have the following type/creator.
84 kHardLinkFileType
= 0x686C6E6B, /* 'hlnk' */
85 kHFSPlusCreator
= 0x6866732B /* 'hfs+' */
89 /* Unicode strings are used for HFS Plus file and folder names */
91 u_int16_t length
; /* number of unicode characters */
92 u_int16_t unicode
[255]; /* unicode characters */
94 typedef struct HFSUniStr255 HFSUniStr255
;
95 typedef const HFSUniStr255
*ConstHFSUniStr255Param
;
98 kHFSMaxVolumeNameChars
= 27,
99 kHFSMaxFileNameChars
= 31,
100 kHFSPlusMaxFileNameChars
= 255
104 /* Extent overflow file data structures */
107 struct HFSExtentKey
{
108 u_int8_t keyLength
; /* length of key, excluding this field */
109 u_int8_t forkType
; /* 0 = data fork, FF = resource fork */
110 u_int32_t fileID
; /* file ID */
111 u_int16_t startBlock
; /* first file allocation block number in this extent */
113 typedef struct HFSExtentKey HFSExtentKey
;
115 /* HFS Plus Extent key */
116 struct HFSPlusExtentKey
{
117 u_int16_t keyLength
; /* length of key, excluding this field */
118 u_int8_t forkType
; /* 0 = data fork, FF = resource fork */
119 u_int8_t pad
; /* make the other fields align on 32-bit boundary */
120 u_int32_t fileID
; /* file ID */
121 u_int32_t startBlock
; /* first file allocation block number in this extent */
123 typedef struct HFSPlusExtentKey HFSPlusExtentKey
;
125 /* Number of extent descriptors per extent record */
127 kHFSExtentDensity
= 3,
128 kHFSPlusExtentDensity
= 8
131 /* HFS extent descriptor */
132 struct HFSExtentDescriptor
{
133 u_int16_t startBlock
; /* first allocation block */
134 u_int16_t blockCount
; /* number of allocation blocks */
136 typedef struct HFSExtentDescriptor HFSExtentDescriptor
;
138 /* HFS Plus extent descriptor */
139 struct HFSPlusExtentDescriptor
{
140 u_int32_t startBlock
; /* first allocation block */
141 u_int32_t blockCount
; /* number of allocation blocks */
143 typedef struct HFSPlusExtentDescriptor HFSPlusExtentDescriptor
;
145 /* HFS extent record */
146 typedef HFSExtentDescriptor HFSExtentRecord
[3];
148 /* HFS Plus extent record */
149 typedef HFSPlusExtentDescriptor HFSPlusExtentRecord
[8];
152 /* Finder information */
153 struct FndrFileInfo
{
154 u_int32_t fdType
; /* file type */
155 u_int32_t fdCreator
; /* file creator */
156 u_int16_t fdFlags
; /* Finder flags */
158 int16_t v
; /* file's location */
163 typedef struct FndrFileInfo FndrFileInfo
;
166 struct { /* folder's window rectangle */
172 unsigned short frFlags
; /* Finder flags */
174 u_int16_t v
; /* folder's location */
179 typedef struct FndrDirInfo FndrDirInfo
;
181 struct FndrOpaqueInfo
{
184 typedef struct FndrOpaqueInfo FndrOpaqueInfo
;
187 /* HFS Plus Fork data info - 80 bytes */
188 struct HFSPlusForkData
{
189 u_int64_t logicalSize
; /* fork's logical size in bytes */
190 u_int32_t clumpSize
; /* fork's clump size in bytes */
191 u_int32_t totalBlocks
; /* total blocks used by this fork */
192 HFSPlusExtentRecord extents
; /* initial set of extents */
194 typedef struct HFSPlusForkData HFSPlusForkData
;
197 /* Mac OS X has 16 bytes worth of "BSD" info.
199 * Note: Mac OS 9 implementations and applications
200 * should preserve, but not change, this information.
202 struct HFSPlusBSDInfo
{
203 u_int32_t ownerID
; /* user or group ID of file/folder owner */
204 u_int32_t groupID
; /* additional user of group ID */
205 u_int8_t adminFlags
; /* super-user changeable flags */
206 u_int8_t ownerFlags
; /* owner changeable flags */
207 u_int16_t fileMode
; /* file type and permission bits */
209 u_int32_t iNodeNum
; /* indirect node number (hard links only) */
210 u_int32_t linkCount
; /* links that refer to this indirect node */
211 u_int32_t rawDevice
; /* special file device (FBLK and FCHR only) */
214 typedef struct HFSPlusBSDInfo HFSPlusBSDInfo
;
217 /* Catalog file data structures */
220 kHFSRootParentID
= 1, /* Parent ID of the root folder */
221 kHFSRootFolderID
= 2, /* Folder ID of the root folder */
222 kHFSExtentsFileID
= 3, /* File ID of the extents file */
223 kHFSCatalogFileID
= 4, /* File ID of the catalog file */
224 kHFSBadBlockFileID
= 5, /* File ID of the bad allocation block file */
225 kHFSAllocationFileID
= 6, /* File ID of the allocation file (HFS Plus only) */
226 kHFSStartupFileID
= 7, /* File ID of the startup file (HFS Plus only) */
227 kHFSAttributesFileID
= 8, /* File ID of the attribute file (HFS Plus only) */
228 kHFSBogusExtentFileID
= 15, /* Used for exchanging extents in extents file */
229 kHFSFirstUserCatalogNodeID
= 16
232 /* HFS catalog key */
233 struct HFSCatalogKey
{
234 u_int8_t keyLength
; /* key length (in bytes) */
235 u_int8_t reserved
; /* reserved (set to zero) */
236 u_int32_t parentID
; /* parent folder ID */
237 u_char nodeName
[kHFSMaxFileNameChars
+ 1]; /* catalog node name */
239 typedef struct HFSCatalogKey HFSCatalogKey
;
241 /* HFS Plus catalog key */
242 struct HFSPlusCatalogKey
{
243 u_int16_t keyLength
; /* key length (in bytes) */
244 u_int32_t parentID
; /* parent folder ID */
245 HFSUniStr255 nodeName
; /* catalog node name */
247 typedef struct HFSPlusCatalogKey HFSPlusCatalogKey
;
249 /* Catalog record types */
251 /* HFS Catalog Records */
252 kHFSFolderRecord
= 0x0100, /* Folder record */
253 kHFSFileRecord
= 0x0200, /* File record */
254 kHFSFolderThreadRecord
= 0x0300, /* Folder thread record */
255 kHFSFileThreadRecord
= 0x0400, /* File thread record */
257 /* HFS Plus Catalog Records */
258 kHFSPlusFolderRecord
= 1, /* Folder record */
259 kHFSPlusFileRecord
= 2, /* File record */
260 kHFSPlusFolderThreadRecord
= 3, /* Folder thread record */
261 kHFSPlusFileThreadRecord
= 4 /* File thread record */
265 /* Catalog file record flags */
267 kHFSFileLockedBit
= 0x0000, /* file is locked and cannot be written to */
268 kHFSFileLockedMask
= 0x0001,
269 kHFSThreadExistsBit
= 0x0001, /* a file thread record exists for this file */
270 kHFSThreadExistsMask
= 0x0002
274 /* HFS catalog folder record - 70 bytes */
275 struct HFSCatalogFolder
{
276 int16_t recordType
; /* == kHFSFolderRecord */
277 u_int16_t flags
; /* folder flags */
278 u_int16_t valence
; /* folder valence */
279 u_int32_t folderID
; /* folder ID */
280 u_int32_t createDate
; /* date and time of creation */
281 u_int32_t modifyDate
; /* date and time of last modification */
282 u_int32_t backupDate
; /* date and time of last backup */
283 FndrDirInfo userInfo
; /* Finder information */
284 FndrOpaqueInfo finderInfo
; /* additional Finder information */
285 u_int32_t reserved
[4]; /* reserved - initialized as zero */
287 typedef struct HFSCatalogFolder HFSCatalogFolder
;
289 /* HFS Plus catalog folder record - 88 bytes */
290 struct HFSPlusCatalogFolder
{
291 int16_t recordType
; /* == kHFSPlusFolderRecord */
292 u_int16_t flags
; /* file flags */
293 u_int32_t valence
; /* folder's valence (limited to 2^16 in Mac OS) */
294 u_int32_t folderID
; /* folder ID */
295 u_int32_t createDate
; /* date and time of creation */
296 u_int32_t contentModDate
; /* date and time of last content modification */
297 u_int32_t attributeModDate
; /* date and time of last attribute modification */
298 u_int32_t accessDate
; /* date and time of last access (MacOS X only) */
299 u_int32_t backupDate
; /* date and time of last backup */
300 HFSPlusBSDInfo bsdInfo
; /* permissions (for MacOS X) */
301 FndrDirInfo userInfo
; /* Finder information */
302 FndrOpaqueInfo finderInfo
; /* additional Finder information */
303 u_int32_t textEncoding
; /* hint for name conversions */
304 u_int32_t reserved
; /* reserved - initialized as zero */
306 typedef struct HFSPlusCatalogFolder HFSPlusCatalogFolder
;
308 /* HFS catalog file record - 102 bytes */
309 struct HFSCatalogFile
{
310 int16_t recordType
; /* == kHFSFileRecord */
311 u_int8_t flags
; /* file flags */
312 int8_t fileType
; /* file type (unused ?) */
313 FndrFileInfo userInfo
; /* Finder information */
314 u_int32_t fileID
; /* file ID */
315 u_int16_t dataStartBlock
; /* not used - set to zero */
316 int32_t dataLogicalSize
; /* logical EOF of data fork */
317 int32_t dataPhysicalSize
; /* physical EOF of data fork */
318 u_int16_t rsrcStartBlock
; /* not used - set to zero */
319 int32_t rsrcLogicalSize
; /* logical EOF of resource fork */
320 int32_t rsrcPhysicalSize
; /* physical EOF of resource fork */
321 u_int32_t createDate
; /* date and time of creation */
322 u_int32_t modifyDate
; /* date and time of last modification */
323 u_int32_t backupDate
; /* date and time of last backup */
324 FndrOpaqueInfo finderInfo
; /* additional Finder information */
325 u_int16_t clumpSize
; /* file clump size (not used) */
326 HFSExtentRecord dataExtents
; /* first data fork extent record */
327 HFSExtentRecord rsrcExtents
; /* first resource fork extent record */
328 u_int32_t reserved
; /* reserved - initialized as zero */
330 typedef struct HFSCatalogFile HFSCatalogFile
;
332 /* HFS Plus catalog file record - 248 bytes */
333 struct HFSPlusCatalogFile
{
334 int16_t recordType
; /* == kHFSPlusFileRecord */
335 u_int16_t flags
; /* file flags */
336 u_int32_t reserved1
; /* reserved - initialized as zero */
337 u_int32_t fileID
; /* file ID */
338 u_int32_t createDate
; /* date and time of creation */
339 u_int32_t contentModDate
; /* date and time of last content modification */
340 u_int32_t attributeModDate
; /* date and time of last attribute modification */
341 u_int32_t accessDate
; /* date and time of last access (MacOS X only) */
342 u_int32_t backupDate
; /* date and time of last backup */
343 HFSPlusBSDInfo bsdInfo
; /* permissions (for MacOS X) */
344 FndrFileInfo userInfo
; /* Finder information */
345 FndrOpaqueInfo finderInfo
; /* additional Finder information */
346 u_int32_t textEncoding
; /* hint for name conversions */
347 u_int32_t reserved2
; /* reserved - initialized as zero */
349 /* Note: these start on double long (64 bit) boundry */
350 HFSPlusForkData dataFork
; /* size and block data for data fork */
351 HFSPlusForkData resourceFork
; /* size and block data for resource fork */
353 typedef struct HFSPlusCatalogFile HFSPlusCatalogFile
;
355 /* HFS catalog thread record - 46 bytes */
356 struct HFSCatalogThread
{
357 int16_t recordType
; /* == kHFSFolderThreadRecord or kHFSFileThreadRecord */
358 int32_t reserved
[2]; /* reserved - initialized as zero */
359 u_int32_t parentID
; /* parent ID for this catalog node */
360 u_char nodeName
[kHFSMaxFileNameChars
+ 1]; /* name of this catalog node */
362 typedef struct HFSCatalogThread HFSCatalogThread
;
364 /* HFS Plus catalog thread record -- 264 bytes */
365 struct HFSPlusCatalogThread
{
366 int16_t recordType
; /* == kHFSPlusFolderThreadRecord or kHFSPlusFileThreadRecord */
367 int16_t reserved
; /* reserved - initialized as zero */
368 u_int32_t parentID
; /* parent ID for this catalog node */
369 HFSUniStr255 nodeName
; /* name of this catalog node (variable length) */
371 typedef struct HFSPlusCatalogThread HFSPlusCatalogThread
;
373 #ifdef __APPLE_API_UNSTABLE
375 These are the types of records in the attribute B-tree. The values were
376 chosen so that they wouldn't conflict with the catalog record types.
379 kHFSPlusAttrInlineData
= 0x10, /* if size < kAttrOverflowSize */
380 kHFSPlusAttrForkData
= 0x20, /* if size >= kAttrOverflowSize */
381 kHFSPlusAttrExtents
= 0x30 /* overflow extents for large attributes */
386 HFSPlusAttrInlineData
387 For small attributes, whose entire value is stored within this one
389 There would not be any other records for this attribute.
391 struct HFSPlusAttrInlineData
{
392 u_int32_t recordType
; /* == kHFSPlusAttrInlineData*/
394 u_int32_t logicalSize
; /* size in bytes of userData*/
395 u_int8_t userData
[2]; /* variable length; space allocated is a multiple of 2 bytes*/
397 typedef struct HFSPlusAttrInlineData HFSPlusAttrInlineData
;
402 For larger attributes, whose value is stored in allocation blocks.
403 If the attribute has more than 8 extents, there will be additonal
404 records (of type HFSPlusAttrExtents) for this attribute.
406 struct HFSPlusAttrForkData
{
407 u_int32_t recordType
; /* == kHFSPlusAttrForkData*/
409 HFSPlusForkData theFork
; /* size and first extents of value*/
411 typedef struct HFSPlusAttrForkData HFSPlusAttrForkData
;
415 This record contains information about overflow extents for large,
416 fragmented attributes.
418 struct HFSPlusAttrExtents
{
419 u_int32_t recordType
; /* == kHFSPlusAttrExtents*/
421 HFSPlusExtentRecord extents
; /* additional extents*/
423 typedef struct HFSPlusAttrExtents HFSPlusAttrExtents
;
425 /* A generic Attribute Record*/
426 union HFSPlusAttrRecord
{
427 u_int32_t recordType
;
428 HFSPlusAttrInlineData inlineData
;
429 HFSPlusAttrForkData forkData
;
430 HFSPlusAttrExtents overflowExtents
;
432 typedef union HFSPlusAttrRecord HFSPlusAttrRecord
;
434 /* Key and node lengths */
436 kHFSPlusExtentKeyMaximumLength
= sizeof(HFSPlusExtentKey
) - sizeof(u_int16_t
),
437 kHFSExtentKeyMaximumLength
= sizeof(HFSExtentKey
) - sizeof(u_int8_t
),
438 kHFSPlusCatalogKeyMaximumLength
= sizeof(HFSPlusCatalogKey
) - sizeof(u_int16_t
),
439 kHFSPlusCatalogKeyMinimumLength
= kHFSPlusCatalogKeyMaximumLength
- sizeof(HFSUniStr255
) + sizeof(u_int16_t
),
440 kHFSCatalogKeyMaximumLength
= sizeof(HFSCatalogKey
) - sizeof(u_int8_t
),
441 kHFSCatalogKeyMinimumLength
= kHFSCatalogKeyMaximumLength
- (kHFSMaxFileNameChars
+ 1) + sizeof(u_int8_t
),
442 kHFSPlusCatalogMinNodeSize
= 4096,
443 kHFSPlusExtentMinNodeSize
= 512,
444 kHFSPlusAttrMinNodeSize
= 4096
446 #endif /* __APPLE_API_UNSTABLE */
448 /* HFS and HFS Plus volume attribute bits */
450 /* Bits 0-6 are reserved (always cleared by MountVol call) */
451 kHFSVolumeHardwareLockBit
= 7, /* volume is locked by hardware */
452 kHFSVolumeUnmountedBit
= 8, /* volume was successfully unmounted */
453 kHFSVolumeSparedBlocksBit
= 9, /* volume has bad blocks spared */
454 kHFSVolumeNoCacheRequiredBit
= 10, /* don't cache volume blocks (i.e. RAM or ROM disk) */
455 kHFSBootVolumeInconsistentBit
= 11, /* boot volume is inconsistent (System 7.6 and later) */
456 kHFSCatalogNodeIDsReusedBit
= 12,
457 kHFSVolumeJournaledBit
= 13, /* this volume has a journal on it */
458 /* Bit 14 is reserved for future use */
459 kHFSVolumeSoftwareLockBit
= 15, /* volume is locked by software */
461 kHFSVolumeHardwareLockMask
= 1 << kHFSVolumeHardwareLockBit
,
462 kHFSVolumeUnmountedMask
= 1 << kHFSVolumeUnmountedBit
,
463 kHFSVolumeSparedBlocksMask
= 1 << kHFSVolumeSparedBlocksBit
,
464 kHFSVolumeNoCacheRequiredMask
= 1 << kHFSVolumeNoCacheRequiredBit
,
465 kHFSBootVolumeInconsistentMask
= 1 << kHFSBootVolumeInconsistentBit
,
466 kHFSCatalogNodeIDsReusedMask
= 1 << kHFSCatalogNodeIDsReusedBit
,
467 kHFSVolumeJournaledMask
= 1 << kHFSVolumeJournaledBit
,
468 kHFSVolumeSoftwareLockMask
= 1 << kHFSVolumeSoftwareLockBit
,
469 kHFSMDBAttributesMask
= 0x8380
473 /* HFS Master Directory Block - 162 bytes */
474 /* Stored at sector #2 (3rd sector) and second-to-last sector. */
475 struct HFSMasterDirectoryBlock
{
476 u_int16_t drSigWord
; /* == kHFSSigWord */
477 u_int32_t drCrDate
; /* date and time of volume creation */
478 u_int32_t drLsMod
; /* date and time of last modification */
479 u_int16_t drAtrb
; /* volume attributes */
480 u_int16_t drNmFls
; /* number of files in root folder */
481 u_int16_t drVBMSt
; /* first block of volume bitmap */
482 u_int16_t drAllocPtr
; /* start of next allocation search */
483 u_int16_t drNmAlBlks
; /* number of allocation blocks in volume */
484 u_int32_t drAlBlkSiz
; /* size (in bytes) of allocation blocks */
485 u_int32_t drClpSiz
; /* default clump size */
486 u_int16_t drAlBlSt
; /* first allocation block in volume */
487 u_int32_t drNxtCNID
; /* next unused catalog node ID */
488 u_int16_t drFreeBks
; /* number of unused allocation blocks */
489 u_char drVN
[kHFSMaxVolumeNameChars
+ 1]; /* volume name */
490 u_int32_t drVolBkUp
; /* date and time of last backup */
491 u_int16_t drVSeqNum
; /* volume backup sequence number */
492 u_int32_t drWrCnt
; /* volume write count */
493 u_int32_t drXTClpSiz
; /* clump size for extents overflow file */
494 u_int32_t drCTClpSiz
; /* clump size for catalog file */
495 u_int16_t drNmRtDirs
; /* number of directories in root folder */
496 u_int32_t drFilCnt
; /* number of files in volume */
497 u_int32_t drDirCnt
; /* number of directories in volume */
498 u_int32_t drFndrInfo
[8]; /* information used by the Finder */
499 u_int16_t drEmbedSigWord
; /* embedded volume signature (formerly drVCSize) */
500 HFSExtentDescriptor drEmbedExtent
; /* embedded volume location and size (formerly drVBMCSize and drCtlCSize) */
501 u_int32_t drXTFlSize
; /* size of extents overflow file */
502 HFSExtentRecord drXTExtRec
; /* extent record for extents overflow file */
503 u_int32_t drCTFlSize
; /* size of catalog file */
504 HFSExtentRecord drCTExtRec
; /* extent record for catalog file */
506 typedef struct HFSMasterDirectoryBlock HFSMasterDirectoryBlock
;
509 /* HFS Plus Volume Header - 512 bytes */
510 /* Stored at sector #2 (3rd sector) and second-to-last sector. */
511 struct HFSPlusVolumeHeader
{
512 u_int16_t signature
; /* == kHFSPlusSigWord */
513 u_int16_t version
; /* == kHFSPlusVersion */
514 u_int32_t attributes
; /* volume attributes */
515 u_int32_t lastMountedVersion
; /* implementation version which last mounted volume */
516 //XXXdbg u_int32_t reserved; /* reserved - initialized as zero */
517 u_int32_t journalInfoBlock
; /* block addr of journal info (if volume is journaled, zero otherwise) */
519 u_int32_t createDate
; /* date and time of volume creation */
520 u_int32_t modifyDate
; /* date and time of last modification */
521 u_int32_t backupDate
; /* date and time of last backup */
522 u_int32_t checkedDate
; /* date and time of last disk check */
524 u_int32_t fileCount
; /* number of files in volume */
525 u_int32_t folderCount
; /* number of directories in volume */
527 u_int32_t blockSize
; /* size (in bytes) of allocation blocks */
528 u_int32_t totalBlocks
; /* number of allocation blocks in volume (includes this header and VBM*/
529 u_int32_t freeBlocks
; /* number of unused allocation blocks */
531 u_int32_t nextAllocation
; /* start of next allocation search */
532 u_int32_t rsrcClumpSize
; /* default resource fork clump size */
533 u_int32_t dataClumpSize
; /* default data fork clump size */
534 u_int32_t nextCatalogID
; /* next unused catalog node ID */
536 u_int32_t writeCount
; /* volume write count */
537 u_int64_t encodingsBitmap
; /* which encodings have been use on this volume */
539 u_int8_t finderInfo
[32]; /* information used by the Finder */
541 HFSPlusForkData allocationFile
; /* allocation bitmap file */
542 HFSPlusForkData extentsFile
; /* extents B-tree file */
543 HFSPlusForkData catalogFile
; /* catalog B-tree file */
544 HFSPlusForkData attributesFile
; /* extended attributes B-tree file */
545 HFSPlusForkData startupFile
; /* boot file (secondary loader) */
547 typedef struct HFSPlusVolumeHeader HFSPlusVolumeHeader
;
550 /* B-tree structures */
559 u_int8_t rawData
[kMaxKeyLength
+2];
561 typedef union BTreeKey BTreeKey
;
563 /* BTNodeDescriptor -- Every B-tree node starts with these fields. */
564 struct BTNodeDescriptor
{
565 u_int32_t fLink
; /* next node at this level*/
566 u_int32_t bLink
; /* previous node at this level*/
567 int8_t kind
; /* kind of node (leaf, index, header, map)*/
568 u_int8_t height
; /* zero for header, map; child is one more than parent*/
569 u_int16_t numRecords
; /* number of records in this node*/
570 u_int16_t reserved
; /* reserved - initialized as zero */
572 typedef struct BTNodeDescriptor BTNodeDescriptor
;
574 /* Constants for BTNodeDescriptor kind */
582 /* BTHeaderRec -- The first record of a B-tree header node */
584 u_int16_t treeDepth
; /* maximum height (usually leaf nodes) */
585 u_int32_t rootNode
; /* node number of root node */
586 u_int32_t leafRecords
; /* number of leaf records in all leaf nodes */
587 u_int32_t firstLeafNode
; /* node number of first leaf node */
588 u_int32_t lastLeafNode
; /* node number of last leaf node */
589 u_int16_t nodeSize
; /* size of a node, in bytes */
590 u_int16_t maxKeyLength
; /* reserved */
591 u_int32_t totalNodes
; /* total number of nodes in tree */
592 u_int32_t freeNodes
; /* number of unused (free) nodes in tree */
593 u_int16_t reserved1
; /* unused */
594 u_int32_t clumpSize
; /* reserved */
595 u_int8_t btreeType
; /* reserved */
596 u_int8_t reserved2
; /* reserved */
597 u_int32_t attributes
; /* persistent attributes about the tree */
598 u_int32_t reserved3
[16]; /* reserved */
600 typedef struct BTHeaderRec BTHeaderRec
;
602 /* Constants for BTHeaderRec attributes */
604 kBTBadCloseMask
= 0x00000001, /* reserved */
605 kBTBigKeysMask
= 0x00000002, /* key length field is 16 bits */
606 kBTVariableIndexKeysMask
= 0x00000004 /* keys in index nodes are variable length */
609 /* JournalInfoBlock - Structure that describes where our journal lives */
610 struct JournalInfoBlock
{
612 u_int32_t device_signature
[8]; // signature used to locate our device.
613 u_int64_t offset
; // byte offset to the journal on the device
614 u_int64_t size
; // size in bytes of the journal
615 u_int32_t reserved
[32];
617 typedef struct JournalInfoBlock JournalInfoBlock
;
620 kJIJournalInFSMask
= 0x00000001,
621 kJIJournalOnOtherDeviceMask
= 0x00000002,
622 kJIJournalNeedInitMask
= 0x00000004
626 #pragma options align=reset
632 #endif /* __HFS_FORMAT__ */