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