VirtualBox

source: vbox/trunk/include/iprt/formats/hfs.h@ 68407

Last change on this file since 68407 was 62474, checked in by vboxsync, 8 years ago

(C) 2016

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 23.3 KB
Line 
1/** @file
2 * IPRT - Hierarchical File System (HFS).
3 */
4
5/*
6 * Copyright (C) 2009-2016 Oracle Corporation
7 *
8 * This file is part of VirtualBox Open Source Edition (OSE), as
9 * available from http://www.virtualbox.org. This file is free software;
10 * you can redistribute it and/or modify it under the terms of the GNU
11 * General Public License (GPL) as published by the Free Software
12 * Foundation, in version 2 as it comes in the "COPYING" file of the
13 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
14 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
15 *
16 * The contents of this file may alternatively be used under the terms
17 * of the Common Development and Distribution License Version 1.0
18 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
19 * VirtualBox OSE distribution, in which case the provisions of the
20 * CDDL are applicable instead of those of the GPL.
21 *
22 * You may elect to license modified versions of this file under the
23 * terms and conditions of either the GPL or the CDDL or both.
24 */
25
26#ifndef ___iprt_formats_hfs_h
27#define ___iprt_formats_hfs_h
28
29
30#include <iprt/types.h>
31#include <iprt/assert.h>
32
33
34/** @defgroup grp_rt_fmt_hfs HFS - Hierarchical File System.
35 * @{
36 */
37
38
39/** @name HFS signature words (HFSPlusVolumeHeader::signature)
40 * @{ */
41#define kHFSSigWord UINT16_C(0x4244)
42#define kHFSPlusSigWord UINT16_C(0x482b)
43#define kHFSXSigWord UINT16_C(0x4858)
44/** @} */
45
46/** @name HFS version numbers (HFSPlusVolumeHeader::version).
47 * @{ */
48#define kHFSPlusVersion UINT16_C(4)
49#define kHFSXVersion UINT16_C(5)
50/** @} */
51
52/** @name HFS mount version numbers (HFSPlusVolumeHeader::lastMountedVersion).
53 * @{ */
54#define kHFSPlusMountVersion UINT32_C(0x31302e30)
55#define kHFSJMountVersion UINT32_C(0x4846534a)
56#define kFSKMountVersion UINT32_C(0x46534b21)
57/** @} */
58
59/** @name Hard link file creators & types.
60 * @{ */
61#define kHardLinkFileType UINT32_C(0x686c6e6b)
62#define kHFSPlusCreator UINT32_C(0x6866732b)
63/** @} */
64
65/** @name Symlink file creators & types.
66 * @{ */
67#define kSymLinkFileType UINT32_C(0x736c6e6b)
68#define kSymLinkCreator UINT32_C(0x72686170)
69/** @} */
70
71/** @name Name limits.
72 * @{ */
73#define kHFSMaxVolumeNameChars UINT8_C(0x1b)
74#define kHFSMaxFileNameChars UINT8_C(0x1f)
75#define kHFSPlusMaxFileNameChars UINT8_C(0xff)
76#define kHFSMaxAttrNameLen UINT8_C(0x7f)
77/** @} */
78
79/** @name Extent descriptor record densities
80 * @{ */
81#define kHFSExtentDensity UINT8_C(3)
82#define kHFSPlusExtentDensity UINT8_C(8)
83/** @} */
84
85
86/** @name File IDs (various fileID members).
87 * @{ */
88#define kHFSRootParentID UINT32_C(0x00000001)
89#define kHFSRootFolderID UINT32_C(0x00000002)
90#define kHFSExtentsFileID UINT32_C(0x00000003)
91#define kHFSCatalogFileID UINT32_C(0x00000004)
92#define kHFSBadBlockFileID UINT32_C(0x00000005)
93#define kHFSAllocationFileID UINT32_C(0x00000006)
94#define kHFSStartupFileID UINT32_C(0x00000007)
95#define kHFSAttributesFileID UINT32_C(0x00000008)
96#define kHFSAttributeDataFileID UINT32_C(0x0000000c)
97#define kHFSRepairCatalogFileID UINT32_C(0x0000000e)
98#define kHFSBogusExtentFileID UINT32_C(0x0000000f)
99#define kHFSFirstUserCatalogNodeID UINT32_C(0x00000010)
100/** @} */
101
102/** @name Catalog record types.
103 * @{ */
104#define kHFSFolderRecord UINT16_C(0x0100)
105#define kHFSFileRecord UINT16_C(0x0200)
106#define kHFSFolderThreadRecord UINT16_C(0x0300)
107#define kHFSFileThreadRecord UINT16_C(0x0400)
108#define kHFSPlusFolderRecord UINT16_C(0x0001)
109#define kHFSPlusFileRecord UINT16_C(0x0002)
110#define kHFSPlusFolderThreadRecord UINT16_C(0x0003)
111#define kHFSPlusFileThreadRecord UINT16_C(0x0004)
112/** @} */
113
114/** @name File record bits and masks.
115 * @{ */
116#define kHFSFileLockedBit 0
117#define kHFSThreadExistsBit 1
118#define kHFSHasAttributesBit 2
119#define kHFSHasSecurityBit 3
120#define kHFSHasFolderCountBit 4
121#define kHFSHasLinkChainBit 5
122#define kHFSHasChildLinkBit 6
123#define kHFSHasDateAddedBit 7
124
125#define kHFSFileLockedMask RT_BIT(kHFSFileLockedBit)
126#define kHFSThreadExistsMask RT_BIT(kHFSThreadExistsBit)
127#define kHFSHasAttributesMask RT_BIT(kHFSHasAttributesBit)
128#define kHFSHasSecurityMask RT_BIT(kHFSHasSecurityBit)
129#define kHFSHasFolderCountMask RT_BIT(kHFSHasFolderCountBit)
130#define kHFSHasLinkChainMask RT_BIT(kHFSHasLinkChainBit)
131#define kHFSHasChildLinkMask RT_BIT(kHFSHasChildLinkBit)
132#define kHFSHasDateAddedMask RT_BIT(kHFSHasDateAddedBit)
133/** @} */
134
135/** @name Key and node lengths.
136 * @{ */
137#define kHFSPlusAttrKeyMaximumLength ( sizeof(HFSPlusAttrKey) - sizeof(uint16_t) )
138#define kHFSPlusAttrKeyMinimumLength ( kHFSPlusAttrKeyMaximumLength - (kHFSMaxAttrNameLen * sizeof(uint16_t)) )
139#define kHFSPlusExtentKeyMaximumLength ( sizeof(HFSPlusExtentKey) - sizeof(uint16_t),
140#define kHFSExtentKeyMaximumLength ( sizeof(HFSExtentKey) - sizeof(uint8_t) )
141#define kHFSPlusCatalogKeyMaximumLength ( sizeof(HFSPlusCatalogKey) - sizeof(uint16_t) )
142#define kHFSPlusCatalogKeyMinimumLength ( kHFSPlusCatalogKeyMaximumLength - sizeof(HFSUniStr255) + sizeof(uint16_t) )
143#define kHFSCatalogKeyMaximumLength ( sizeof(HFSCatalogKey) - sizeof(uint8_t) )
144#define kHFSCatalogKeyMinimumLength ( kHFSCatalogKeyMaximumLength - kHFSMaxFileNameChars - 1 + sizeof(uint8_t) )
145#define kHFSPlusCatalogMinNodeSize UINT16_C(0x1000)
146#define kHFSPlusExtentMinNodeSize UINT16_C(0x0200)
147#define kHFSPlusAttrMinNodeSize UINT16_C(0x1000)
148/** @} */
149
150/** @name Volume Attribute bits and masks.
151 * @remarks HFS has only 16-bit wide field, HFS+ has 32-bit.
152 * @{ */
153#define kHFSVolumeHardwareLockBit 7
154#define kHFSVolumeUnmountedBit 8
155#define kHFSVolumeSparedBlocksBit 9
156#define kHFSVolumeNoCacheRequiredBit 10
157#define kHFSBootVolumeInconsistentBit 11
158#define kHFSCatalogNodeIDsReusedBit 12
159#define kHFSVolumeJournaledBit 13
160#define kHFSVolumeInconsistentBit 14
161#define kHFSVolumeSoftwareLockBit 15
162#define kHFSUnusedNodeFixBit 31
163#define kHFSContentProtectionBit 30
164
165#define kHFSVolumeHardwareLockMask RT_BIT(kHFSVolumeHardwareLockBit)
166#define kHFSVolumeUnmountedMask RT_BIT(kHFSVolumeUnmountedBit)
167#define kHFSVolumeSparedBlocksMask RT_BIT(kHFSVolumeSparedBlocksBit)
168#define kHFSVolumeNoCacheRequiredMask RT_BIT(kHFSVolumeNoCacheRequiredBit)
169#define kHFSBootVolumeInconsistentMask RT_BIT(kHFSBootVolumeInconsistentBit)
170#define kHFSCatalogNodeIDsReusedMask RT_BIT(kHFSCatalogNodeIDsReusedBit)
171#define kHFSVolumeJournaledMask RT_BIT(kHFSVolumeJournaledBit)
172#define kHFSVolumeInconsistentMask RT_BIT(kHFSVolumeInconsistentBit)
173#define kHFSVolumeSoftwareLockMask RT_BIT(kHFSVolumeSoftwareLockBit)
174#define kHFSUnusedNodeFixMask RT_BIT(kHFSUnusedNodeFixBit)
175#define kHFSContentProtectionMask RT_BIT(kHFSContentProtectionBit)
176
177#define kHFSMDBAttributesMask UINT16_C(0x8380)
178/** @} */
179
180/** @name Misc
181 * @{ */
182#define kHFSUnusedNodesFixDate UINT32_C(0xc5ef2480)
183
184#define HFSPLUSMETADATAFOLDER "\xE2\x90\x80\xE2\x90\x80\xE2\x90\x80\xE2\x90\x80HFS+ Private Data"
185#define HFSPLUS_DIR_METADATA_FOLDER ".HFS+ Private Directory Data\xd"
186#define HFS_INODE_PREFIX "iNode"
187#define HFS_DELETE_PREFIX "temp"
188#define HFS_DIRINODE_PREFIX "dir_"
189#define FIRST_LINK_XATTR_NAME "com.apple.system.hfs.firstlink"
190#define FIRST_LINK_XATTR_REC_SIZE ( sizeof(HFSPlusAttrData) + 10 )
191
192/* {b3e20f39-f292-11d6-97a4-00306543ecac} */
193#define HFS_UUID_NAMESPACE_ID "\xB3\xE2\x0F\x39\xF2\x92\x11\xD6\x97\xA4\x00\x30\x65\x43\xEC\xAC"
194
195#define SET_HFS_TEXT_ENCODING(a_uHint) (UINT32_C(0x656e6300) | (uint8_t)(a_uHint))
196#define GET_HFS_TEXT_ENCODING(a_uHint) ( ((a_uHint) & UINT32_C(0xffffff00)) == UINT32_C(0x656e6300) \
197 ? UINT32_C(0x000000ff)(a_uHint) : UINT32_MAX)
198/** @} */
199
200/** @name B-tree stuff.
201 * @{ */
202#define kMaxKeyLength 520
203
204#define kBTLeafNode (-1)
205#define kBTIndexNode 0
206#define kBTHeaderNode 1
207#define kBTMapNode 2
208
209#define kBTBadCloseMask RT_BIT_32(0)
210#define kBTBigKeysMask RT_BIT_32(1)
211#define kBTVariableIndexKeysMask RT_BIT_32(2)
212
213/** @} */
214
215/** @name B-tree compare types (BTHeaderRec::keyCompareType) */
216#define kHFSCaseFolding UINT8_C(0xcf)
217#define kHFSBinaryCompare UINT8_C(0xbc)
218/** @} */
219
220/** @name Journal stuff.
221 * @{ */
222#define JIB_RESERVED_SIZE ( sizeof(uint32_t) * 32 - 85 )
223
224#define kJIJournalInFSMask RT_BIT_32(0)
225#define kJIJournalOnOtherDeviceMask RT_BIT_32(1)
226#define kJIJournalNeedInitMask RT_BIT_32(2)
227
228#define EXTJNL_CONTENT_TYPE_UUID "4a6f7572-6e61-11aa-aa11-00306543ecac"
229/** @} */
230
231
232
233typedef struct HFSUniStr255
234{
235 uint16_t length;
236 RTUTF16 unicode[255];
237} HFSUniStr255;
238AssertCompileSize(HFSUniStr255, 0x200);
239typedef const HFSUniStr255 * ConstHFSUniStr255Param;
240
241#pragma pack(1)
242typedef struct HFSExtentKey
243{
244 uint8_t keyLength;
245 uint8_t forkType;
246 uint32_t fileID; /**< Misaligned. */
247 uint16_t startBLock;
248} HFSExtentKey;
249#pragma pack()
250AssertCompileSize(HFSExtentKey, 8);
251
252typedef struct HFSPlusExtentKey
253{
254 uint16_t keyLength;
255 uint8_t forkType;
256 uint8_t pad;
257 uint32_t fileID;
258 uint32_t startBlock;
259} HFSPlusExtentKey;
260AssertCompileSize(HFSPlusExtentKey, 12);
261
262typedef struct HFSExtentDescriptor
263{
264 uint16_t startBlock;
265 uint16_t blockCount;
266} HFSExtentDescriptor;
267AssertCompileSize(HFSExtentDescriptor, 4);
268
269typedef struct HFSPlusExtentDescriptor
270{
271 uint32_t startBlock;
272 uint32_t blockCount;
273} HFSPlusExtentDescriptor;
274AssertCompileSize(HFSPlusExtentDescriptor, 8);
275
276typedef HFSExtentDescriptor HFSExtentRecord[3];
277typedef HFSPlusExtentDescriptor HFSPlusExtentRecord[8];
278
279typedef struct FndrFileInfo
280{
281 uint32_t fdType;
282 uint32_t fdCreator;
283 uint16_t fdFlags;
284 struct
285 {
286 int16_t v;
287 int16_t h;
288 } fdLocation;
289 uint16_t opaque;
290} FndrFileInfo;
291AssertCompileSize(FndrFileInfo, 16);
292
293typedef struct FndrDirInfo
294{
295 struct
296 {
297 int16_t top;
298 int16_t left;
299 int16_t bottom;
300 int16_t right;
301 } frRect;
302 uint16_t frFlags;
303 struct
304 {
305 int16_t v;
306 int16_t h;
307 } fdLocation;
308 uint16_t opaque;
309} FndrDirInfo;
310AssertCompileSize(FndrDirInfo, 16);
311
312typedef struct FndrOpaqueInfo
313{
314 int8_t opaque[16];
315} FndrOpaqueInfo;
316AssertCompileSize(FndrOpaqueInfo, 16);
317
318typedef struct FndrExtendedFileInfo
319{
320 uint32_t reserved1;
321 uint32_t date_added;
322 uint16_t extended_flags;
323 uint16_t reserved2;
324 uint32_t reserved3;
325} FndrExtendedFileInfo;
326AssertCompileSize(FndrExtendedFileInfo, 16);
327
328typedef struct FndrExtendedDirInfo
329{
330 uint32_t point;
331 uint32_t date_added;
332 uint16_t extended_flags;
333 uint16_t reserved3;
334 uint32_t reserved4;
335} FndrExtendedDirInfo;
336AssertCompileSize(FndrExtendedDirInfo, 16);
337
338typedef struct HFSPlusForkData
339{
340 uint64_t logicalSize;
341 uint32_t clumpSize;
342 uint32_t totalBlocks;
343 HFSPlusExtentRecord extents;
344} HFSPlusForkData;
345AssertCompileSize(HFSPlusForkData, 80);
346
347typedef struct HFSPlusBSDInfo
348{
349 uint32_t ownerID;
350 uint32_t groupID;
351 uint8_t adminFlags;
352 uint8_t ownerFlags;
353 uint16_t fileMode;
354 union
355 {
356 uint32_t iNodeNum;
357 uint32_t linkCount;
358 uint32_t rawDevice;
359 } special;
360} HFSPlusBSDInfo;
361AssertCompileSize(HFSPlusBSDInfo, 16);
362
363#pragma pack(1)
364typedef struct HFSCatalogKey
365{
366 uint8_t keyLength;
367 uint8_t reserved;
368 uint32_t parentID; /**< Misaligned. */
369 uint8_t nodeName[kHFSMaxFileNameChars + 1];
370} HFSCatalogKey;
371#pragma pack()
372AssertCompileSize(HFSCatalogKey, 0x26);
373
374#pragma pack(1)
375typedef struct HFSPlusCatalogKey
376{
377 uint16_t keyLength;
378 uint32_t parentID; /**< Misaligned. */
379 HFSUniStr255 nodeName;
380} HFSPlusCatalogKey;
381#pragma pack()
382AssertCompileSize(HFSPlusCatalogKey, 0x206);
383
384#pragma pack(1)
385typedef struct HFSCatalogFolder
386{
387 int16_t recordType;
388 uint16_t flags;
389 uint16_t valence;
390 uint32_t folderID; /**< Misaligned. */
391 uint32_t createDate; /**< Misaligned. */
392 uint32_t modifyDate; /**< Misaligned. */
393 uint32_t backupDate; /**< Misaligned. */
394 FndrDirInfo userInfo;
395 FndrOpaqueInfo finderInfo;
396 uint32_t reserved[4]; /**< Misaligned. */
397} HFSCatalogFolder;
398#pragma pack()
399AssertCompileSize(HFSCatalogFolder, 70);
400
401typedef struct HFSPlusCatalogFolder
402{
403 int16_t recordType;
404 uint16_t flags;
405 uint32_t valence;
406 uint32_t folderID;
407 uint32_t createDate;
408 uint32_t contentModDate;
409 uint32_t attributeModDate;
410 uint32_t accessDate;
411 uint32_t backupDate;
412 HFSPlusBSDInfo bsdInfo;
413 FndrDirInfo userInfo;
414 FndrOpaqueInfo finderInfo;
415 uint32_t textEncoding;
416 uint32_t folderCount;
417} HFSPlusCatalogFolder;
418AssertCompileSize(HFSPlusCatalogFolder, 88);
419
420#pragma pack(1)
421typedef struct HFSCatalogFile
422{
423 int16_t recordType;
424 uint8_t flags;
425 uint8_t fileType;
426 FndrFileInfo userInfo;
427 uint32_t fileID;
428 uint16_t dataStartBlock;
429 int32_t dataLogicalSize; /**< Misaligned. */
430 int32_t dataPhysicalSize; /**< Misaligned. */
431 uint16_t rsrcStartBlock;
432 int32_t rsrcLogicalSize;
433 int32_t rsrcPhysicalSize;
434 uint32_t createDate;
435 uint32_t modifyDate;
436 uint32_t backupDate;
437 FndrOpaqueInfo finderInfo;
438 uint16_t clumpSize;
439 HFSExtentRecord dataExtents; /**< Misaligned. */
440 HFSExtentRecord rsrcExtents; /**< Misaligned. */
441 uint32_t reserved; /**< Misaligned. */
442} HFSCatalogFile;
443#pragma pack()
444AssertCompileSize(HFSCatalogFile, 102);
445
446#pragma pack(1)
447typedef struct HFSPlusCatalogFile
448{
449 int16_t recordType;
450 uint16_t flags;
451 uint32_t reserved1;
452 uint32_t fileID;
453 uint32_t createDate;
454 uint32_t contentModDate;
455 uint32_t attributeModDate;
456 uint32_t accessDate;
457 uint32_t backupDate;
458 HFSPlusBSDInfo bsdInfo;
459 FndrFileInfo userInfo;
460 FndrOpaqueInfo finderInfo;
461 uint32_t textEncoding;
462 uint32_t reserved2;
463 HFSPlusForkData dataFork;
464 HFSPlusForkData resourceFork;
465} HFSPlusCatalogFile;
466#pragma pack()
467AssertCompileMemberAlignment(HFSPlusCatalogFile, dataFork, 8);
468AssertCompileSize(HFSPlusCatalogFile, 248);
469
470#pragma pack(1)
471typedef struct HFSCatalogThread
472{
473 int16_t recordType;
474 int32_t reserved[2];
475 uint32_t parentID;
476 uint8_t nodeName[kHFSMaxFileNameChars + 1];
477} HFSCatalogThread;
478#pragma pack()
479AssertCompileSize(HFSCatalogThread, 46);
480
481typedef struct HFSPlusCatalogThread
482{
483 int16_t recordType;
484 int16_t reserved;
485 uint32_t parentID;
486 HFSUniStr255 nodeName;
487} HFSPlusCatalogThread;
488AssertCompileSize(HFSPlusCatalogThread, 0x208);
489
490typedef struct HFSPlusAttrForkData
491{
492 uint32_t recordType;
493 uint32_t reserved;
494 HFSPlusForkData theFork;
495} HFSPlusAttrForkData;
496AssertCompileSize(HFSPlusAttrForkData, 88);
497
498typedef struct HFSPlusAttrExtents
499{
500 uint32_t recordType;
501 uint32_t reserved;
502 HFSPlusExtentRecord extents;
503} HFSPlusAttrExtents;
504AssertCompileSize(HFSPlusAttrExtents, 72);
505
506#pragma pack(1)
507typedef struct HFSPlusAttrData
508{
509 uint32_t recordType;
510 uint32_t reserved[2];
511 uint32_t attrSize;
512 uint8_t attrData[2]; /**< Causes misaligned struct size. */
513} HFSPlusAttrData;
514#pragma pack()
515AssertCompileSize(HFSPlusAttrData, 18);
516
517#pragma pack(1)
518typedef struct HFSPlusAttrInlineData
519{
520 uint32_t recordType;
521 uint32_t reserved;
522 uint32_t logicalSize;
523 uint8_t userData[2]; /**< Causes misaligned struct size. */
524} HFSPlusAttrInlineData;
525#pragma pack()
526AssertCompileSize(HFSPlusAttrInlineData, 14);
527
528typedef union HFSPlusAttrRecord
529{
530 uint32_t recordType;
531 HFSPlusAttrInlineData inlineData;
532 HFSPlusAttrData attrData;
533 HFSPlusAttrForkData forkData;
534 HFSPlusAttrExtents overflowExtents;
535} HFSPlusAttrRecord;
536AssertCompileSize(HFSPlusAttrRecord, 88);
537
538typedef struct HFSPlusAttrKey
539{
540 uint16_t keyLength;
541 uint16_t pad;
542 uint32_t fileID;
543 uint32_t startBlock;
544 uint16_t attrNameLen;
545 RTUTF16 attrName[kHFSMaxAttrNameLen];
546} HFSPlusAttrKey;
547AssertCompileSize(HFSPlusAttrKey, 268);
548
549#pragma pack(1)
550typedef struct HFSMasterDirectoryBlock
551{
552 uint16_t drSigWord;
553 uint32_t drCrDate; /**< Misaligned. */
554 uint32_t drLsMod; /**< Misaligned. */
555 uint16_t drAtrb;
556 uint16_t drNmFls;
557 uint16_t drVBMSt;
558 uint16_t drAllocPtr;
559 uint16_t drNmAlBlks;
560 uint32_t drAlBlkSiz;
561 uint32_t drClpSiz;
562 uint16_t drAlBlSt;
563 uint32_t drNxCNID; /**< Misaligned. */
564 uint16_t drFreeBks;
565 uint8_t drVN[kHFSMaxVolumeNameChars + 1];
566 uint32_t drVolBkUp;
567 uint16_t drVSeqNum;
568 uint32_t drWrCnt; /**< Misaligned. */
569 uint32_t drXTClpSiz; /**< Misaligned. */
570 uint32_t drCTClpSiz; /**< Misaligned. */
571 uint16_t drNmRtDirs;
572 uint32_t drFilCnt;
573 uint32_t drDirCnt;
574 uint32_t drFndrInfo[8];
575 uint16_t drEmbedSigWord;
576 HFSExtentDescriptor drEmbedExtent;
577 uint32_t drXTFlSize; /**< Misaligned. */
578 HFSExtentRecord drXTExtRec;
579 uint32_t drCTFlSize; /**< Misaligned. */
580 HFSExtentRecord drCTExtRec;
581} HFSMasterDirectoryBlock;
582#pragma pack()
583AssertCompileSize(HFSMasterDirectoryBlock, 162);
584
585typedef struct HFSPlusVolumeHeader
586{
587 uint16_t signature;
588 uint16_t version;
589 uint32_t attributes;
590 uint32_t lastMountedVersion;
591 uint32_t journalInfoBlock;
592 uint32_t createDate;
593 uint32_t modifyDate;
594 uint32_t backupDate;
595 uint32_t checkedDate;
596 uint32_t fileCount;
597 uint32_t folderCount;
598 uint32_t blockSize;
599 uint32_t totalBlocks;
600 uint32_t freeBlocks;
601 uint32_t nextAllocation;
602 uint32_t rsrcClumpSize;
603 uint32_t dataClumpSize;
604 uint32_t nextCatalogID;
605 uint32_t writeCount;
606 uint64_t encodingsBitmap;
607 uint8_t finderInfo[32];
608 HFSPlusForkData allocationFile;
609 HFSPlusForkData extentsFile;
610 HFSPlusForkData catalogFile;
611 HFSPlusForkData attributesFile;
612 HFSPlusForkData startupFile;
613} HFSPlusVolumeHeader;
614AssertCompileMemberAlignment(HFSPlusVolumeHeader, nextCatalogID, 8);
615AssertCompileSize(HFSPlusVolumeHeader, 512);
616
617typedef union BTreeKey
618{
619 uint8_t length8;
620 uint16_t length16;
621 uint8_t rawData[kMaxKeyLength + 2];
622} BTreeKey;
623AssertCompileSize(BTreeKey, 522);
624
625#pragma pack(1)
626typedef struct BTNodeDescriptor
627{
628 uint32_t fLink;
629 uint32_t bLink;
630 int8_t kind;
631 uint8_t height;
632 uint16_t numRecords;
633 uint16_t reserved; /**< Causes struct size misalignment. */
634} BTNodeDescriptor;
635#pragma pack()
636AssertCompileSize(BTNodeDescriptor, 14);
637
638#pragma pack(1)
639typedef struct BTHeaderRec
640{
641 uint16_t treeDepth;
642 uint32_t rootNode; /**< Misaligned. */
643 uint32_t leafRecords; /**< Misaligned. */
644 uint32_t firstLeafNode; /**< Misaligned. */
645 uint32_t lastLeafNode; /**< Misaligned. */
646 uint16_t nodeSize;
647 uint16_t maxKeyLength;
648 uint32_t totalNodes; /**< Misaligned. */
649 uint32_t freeNodes; /**< Misaligned. */
650 uint16_t reserved1;
651 uint32_t clumpSize;
652 uint8_t btreeType;
653 uint8_t keyCompareType;
654 uint32_t attributes; /**< Misaligned. */
655 uint32_t reserved3[16]; /**< Misaligned. */
656} BTHeaderRec;
657#pragma pack()
658AssertCompileSize(BTHeaderRec, 106);
659
660#pragma pack(1)
661typedef struct JournalInfoBlock
662{
663 uint32_t flags;
664 uint32_t devices_signature[8];
665 uint64_t offset; /**< Misaligned (morons). */
666 uint64_t size; /**< Misaligned. */
667 char ext_jnl_uuid[37];
668 char machine_serial_num[48];
669 char reserved[JIB_RESERVED_SIZE];
670} JournalInfoBlock;
671#pragma pack()
672AssertCompileSize(JournalInfoBlock, 180);
673
674/** @} */
675
676#endif
677
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette