VirtualBox

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

Last change on this file since 103224 was 98103, checked in by vboxsync, 22 months ago

Copyright year updates by scm.

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