VirtualBox

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

Last change on this file since 77807 was 76585, checked in by vboxsync, 6 years ago

*: scm --fix-header-guard-endif

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