VirtualBox

source: vbox/trunk/include/iprt/formats/ext.h@ 82954

Last change on this file since 82954 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: 39.1 KB
Line 
1/* $Id: ext.h 76585 2019-01-01 06:31:29Z vboxsync $ */
2/** @file
3 * IPRT, Ext2/3/4 format.
4 */
5
6/*
7 * Copyright (C) 2012-2019 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 *
17 * The contents of this file may alternatively be used under the terms
18 * of the Common Development and Distribution License Version 1.0
19 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
20 * VirtualBox OSE distribution, in which case the provisions of the
21 * CDDL are applicable instead of those of the GPL.
22 *
23 * You may elect to license modified versions of this file under the
24 * terms and conditions of either the GPL or the CDDL or both.
25 */
26
27#ifndef IPRT_INCLUDED_formats_ext_h
28#define IPRT_INCLUDED_formats_ext_h
29#ifndef RT_WITHOUT_PRAGMA_ONCE
30# pragma once
31#endif
32
33#include <iprt/types.h>
34#include <iprt/assertcompile.h>
35
36
37/** @defgroup grp_rt_formats_ext Extended Filesystem (EXT2/3/4) structures and definitions
38 * @ingroup grp_rt_formats
39 * @{
40 */
41
42/*
43 * The filesystem structures were retrieved from:
44 * https://www.kernel.org/doc/html/latest/filesystems/ext4/index.html
45 */
46
47/** Offset where to find the first superblock on the disk, this is constant. */
48#define EXT_SB_OFFSET 1024
49
50/** @name EXT_INODE_NR_XXX - Special inode numbers.
51 * @{ */
52#define EXT_INODE_NR_DEF_BLOCKS 1 /**< List of defective blocks. */
53#define EXT_INODE_NR_ROOT_DIR 2 /**< Root directory. */
54#define EXT_INODE_NR_USER_QUOTA 3 /**< User quota. */
55#define EXT_INODE_NR_GROUP_QUOTA 4 /**< Group quota. */
56#define EXT_INODE_NR_BOOT_LOADER 5 /**< Boot loader. */
57#define EXT_INODE_NR_UNDEL_DIR 6 /**< Undelete directory. */
58#define EXT_INODE_NR_RESV_GRP_DESC 7 /**< Reserved group descriptors inode. */
59#define EXT_INODE_NR_JOURNAL 8 /**< Journal. */
60#define EXT_INODE_NR_EXCLUDE 9 /**< Exclude inode. */
61#define EXT_INODE_NR_REPLICA 10 /**< Replica inode. */
62/** @} */
63
64/**
65 * Ext superblock.
66 *
67 * Everything is stored little endian on the disk.
68 */
69typedef struct EXTSUPERBLOCK
70{
71 /** 0x00: Total number of inodes in the filesystem. */
72 uint32_t cInodesTotal;
73 /** 0x04: Total number of blocks in the filesystem (low 32bits). */
74 uint32_t cBlocksTotalLow;
75 /** 0x08: Number of blocks reserved for the super user (low 32bits). */
76 uint32_t cBlocksRsvdForSuperUserLow;
77 /** 0x0c: Total number of free blocks (low 32bits). */
78 uint32_t cBlocksFreeLow;
79 /** 0x10: Total number of free inodes. */
80 uint32_t cInodesFree;
81 /** 0x14: First data block. */
82 uint32_t iBlockOfSuperblock;
83 /** 0x18: Block size (calculated as 2^(10 + cBitsShiftLeftBlockSize)). */
84 uint32_t cLogBlockSize;
85 /** 0x1c: Cluster size (calculated as 2^cLogClusterSize). */
86 uint32_t cLogClusterSize;
87 /** 0x20: Number of blocks in each block group. */
88 uint32_t cBlocksPerGroup;
89 /** 0x24: Number of clusters in each block group. */
90 uint32_t cClustersPerBlockGroup;
91 /** 0x28: Number of inodes for each block group. */
92 uint32_t cInodesPerBlockGroup;
93 /** 0x2c: Last mount time in seconds since epoch. */
94 uint32_t u32LastMountTime;
95 /** 0x30: Last written time in seconds since epoch. */
96 uint32_t u32LastWrittenTime;
97 /** 0x34: Number of times the volume was mounted since the last check. */
98 uint16_t cMountsSinceLastCheck;
99 /** 0x36: Number of mounts allowed before a consistency check. */
100 uint16_t cMaxMountsUntilCheck;
101 /** 0x38: Signature to identify a ext2 volume (EXT_SIGNATURE). */
102 uint16_t u16Signature;
103 /** 0x3a: State of the filesystem (EXT_SB_STATE_XXX) */
104 uint16_t u16FilesystemState;
105 /** 0x3c: What to do on an error. */
106 uint16_t u16ActionOnError;
107 /** 0x3e: Minor revision level. */
108 uint16_t u16RevLvlMinor;
109 /** 0x40: Time of last check in seconds since epoch. */
110 uint32_t u32LastCheckTime;
111 /** 0x44: Interval between consistency checks in seconds. */
112 uint32_t u32CheckInterval;
113 /** 0x48: Operating system ID of the filesystem creator (EXT_SB_OS_ID_CREATOR_XXX). */
114 uint32_t u32OsIdCreator;
115 /** 0x4c: Revision level (EXT_SB_REV_XXX). */
116 uint32_t u32RevLvl;
117 /** 0x50: User ID that is allowed to use reserved blocks. */
118 uint16_t u16UidReservedBlocks;
119 /** 0x52: Group ID that is allowed to use reserved blocks. */
120 uint16_t u16GidReservedBlocks;
121 /** 0x54: First non reserved inode number. */
122 uint32_t iFirstInodeNonRsvd;
123 /** 0x58: Size of the inode structure in bytes. */
124 uint16_t cbInode;
125 /** 0x5a: Block group number of this super block. */
126 uint16_t iBlkGrpSb;
127 /** 0x5c: Compatible feature set flags (EXT_SB_FEAT_COMPAT_XXX). */
128 uint32_t fFeaturesCompat;
129 /** 0x60: Incompatible feature set (EXT_SB_FEAT_INCOMPAT_XXX). */
130 uint32_t fFeaturesIncompat;
131 /** 0x64: Readonly-compatible feature set (EXT_SB_FEAT_COMPAT_RO_XXX). */
132 uint32_t fFeaturesCompatRo;
133 /** 0x68: 128bit UUID for the volume. */
134 uint8_t au8Uuid[16];
135 /** 0x78: Volume name. */
136 char achVolumeName[16];
137 /** 0x88: Directory were the filesystem was mounted last. */
138 char achLastMounted[64];
139 /** 0xc8: Bitmap usage algorithm (used for compression). */
140 uint32_t u32AlgoUsageBitmap;
141 /** 0xcc: Number of blocks to try to preallocate for files(?). */
142 uint8_t cBlocksPrealloc;
143 /** 0xcd: Number of blocks to try to preallocate for directories. */
144 uint8_t cBlocksPreallocDirectory;
145 /** 0xce: Number of reserved group descriptor entries for future filesystem expansion. */
146 uint16_t cGdtEntriesRsvd;
147 /** 0xd0: 128bit UUID for the journal superblock. */
148 uint8_t au8JournalUuid[16];
149 /** 0xe0: Inode number of the journal file. */
150 uint32_t iJournalInode;
151 /** 0xe4: Device number of journal file (if the appropriate feature flag is set). */
152 uint32_t u32JournalDev;
153 /** 0xe8: Start of list of orpaned inodes to delete. */
154 uint32_t u32LastOrphan;
155 /** 0xec: HTREE hash seed. */
156 uint32_t au32HashSeedHtree[4];
157 /** 0xfc: Default hash algorithm to use for hashes (EXT_SB_HASH_VERSION_DEF_XXX). */
158 uint8_t u8HashVersionDef;
159 /** 0xfd: Journal backup type. */
160 uint8_t u8JnlBackupType;
161 /** 0xfe: Group descriptor size in bytes. */
162 uint16_t cbGroupDesc;
163 /** 0x100: Default mount options (EXT_SB_MNT_OPTS_DEF_XXX). */
164 uint32_t fMntOptsDef;
165 /** 0x104: First metablock block group (if feature is enabled). */
166 uint32_t iFirstMetaBg;
167 /** 0x108: Filesystem creation time in seconds since epoch. */
168 uint32_t u32TimeFsCreation;
169 /** 0x10c: Backup copy of journals inodes block array for the first elements. */
170 uint32_t au32JnlBlocks[17];
171 /** 0x150: Total number of blocks in the filesystem (high 32bits). */
172 uint32_t cBlocksTotalHigh;
173 /** 0x154: Number of blocks reserved for the super user (high 32bits). */
174 uint32_t cBlocksRsvdForSuperUserHigh;
175 /** 0x158: Total number of free blocks (high 32bits). */
176 uint32_t cBlocksFreeHigh;
177 /** 0x15c: All inodes have at least this number of bytes. */
178 uint16_t cbInodesExtraMin;
179 /** 0x15e: New inodes should reserve this number of bytes. */
180 uint16_t cbNewInodesRsv;
181 /** 0x160: Miscellaneous flags (EXT_SB_F_XXX). */
182 uint32_t fFlags;
183 /** 0x164: RAID stride, number of logical blocks read from or written to the disk
184 * before moving to the next disk. */
185 uint16_t cRaidStride;
186 /** 0x166: Number of seconds between multi-mount prevention checking. */
187 uint16_t cSecMmpInterval;
188 /** 0x168: Block number for the multi-mount protection data. */
189 uint64_t iMmpBlock;
190 /** 0x170: Raid stride width. */
191 uint32_t cRaidStrideWidth;
192 /** 0x174: Size of a flexible block group (calculated as 2^cLogGroupsPerFlex). */
193 uint8_t cLogGroupsPerFlex;
194 /** 0x175: Metadata checksum algorithm type, only 1 is valid (for CRC32c). */
195 uint8_t u8ChksumType;
196 /** 0x176: Padding. */
197 uint16_t u16Padding;
198 /** 0x178: Number of KiB written to the filesystem so far. */
199 uint64_t cKbWritten;
200 /** 0x180: Inode number of active snapshot. */
201 uint32_t iSnapshotInode;
202 /** 0x184: Sequential ID of active snapshot. */
203 uint32_t iSnapshotId;
204 /** 0x188: Number of blocks reserved for activ snapshot's future use. */
205 uint64_t cSnapshotRsvdBlocks;
206 /** 0x190: Inode number of the head of the on-disk snapshot list. */
207 uint32_t iSnapshotListInode;
208 /** 0x194: Number of errors seen so far. */
209 uint32_t cErrorsSeen;
210 /** 0x198: First time an error happened in seconds since epoch. */
211 uint32_t u32TimeFirstError;
212 /** 0x19c: Inode involved in the first error. */
213 uint32_t iInodeFirstError;
214 /** 0x1a0: Number of block involved of first error. */
215 uint64_t iBlkFirstError;
216 /** 0x1a8: Name of the function where the first error happened. */
217 char achFuncFirstError[32];
218 /** 0x1c8: Line number where the error happened. */
219 uint32_t iLineFirstError;
220 /** 0x1cc: Time of the most receent error in seconds since epoch. */
221 uint32_t u32TimeLastError;
222 /** 0x1d0: Inode involved in the most recent error. */
223 uint32_t iInodeLastError;
224 /** 0x1d4: Line number where the most recent error happened. */
225 uint32_t iLineLastError;
226 /** 0x1d8: Number of block involved of most recent error. */
227 uint64_t iBlkLastError;
228 /** 0x1e0: Name of the function where the most recent error happened. */
229 char achFuncLastError[32];
230 /** 0x200: ASCIIz string of mount options. */
231 char aszMntOpts[64];
232 /** 0x240: Inode number of user quota file. */
233 uint32_t iInodeUsrQuota;
234 /** 0x244: Inode number of group quota file. */
235 uint32_t iInodeGrpQuota;
236 /** 0x248: Overhead blocks/clusters in filesystem. */
237 uint32_t cOverheadBlocks;
238 /** 0x24c: Block groups containing superblock backups. */
239 uint32_t aiBlkGrpSbBackups[2];
240 /** 0x254: Encryption algorithms in use (EXT_SB_ENCRYPT_ALGO_XXX). */
241 uint8_t au8EncryptAlgo[4];
242 /** 0x258: Salt for the string2key algorithm for encryption. */
243 uint8_t abEncryptPwSalt[16];
244 /** 0x268: Inode number of lost+found. */
245 uint32_t iInodeLostFound;
246 /** 0x26c: Inode that tracks project quotas. */
247 uint32_t iInodeProjQuota;
248 /** 0x270: Checksum seed used for the metadata checksum calculations.
249 * Should be crc32c(~0, au8Uuid). */
250 uint32_t u32ChksumSeed;
251 /** 0x274: Upper 8bits of the u32LastWrittenTime field. */
252 uint8_t u32LastWrittenTimeHigh8Bits;
253 /** 0x275: Upper 8bits of the u32LastMountTime field. */
254 uint8_t u32LastMountTimeHigh8Bits;
255 /** 0x276: Upper 8bits of the u32TimeFsCreation field. */
256 uint8_t u32TimeFsCreationHigh8Bits;
257 /** 0x277: Upper 8bits of the u32LastCheckTime field. */
258 uint8_t u32LastCheckTimeHigh8Bits;
259 /** 0x278: Upper 8bits of the u32TimeFirstError field. */
260 uint8_t u32TimeFirstErrorHigh8Bits;
261 /** 0x279: Upper 8bits of the u32TimeLastError field. */
262 uint8_t u32TimeLastErrorHigh8Bits;
263 /** 0x27a: Zero padding. */
264 uint8_t au8Padding[2];
265 /** 0x27c: Padding to the end of the block. */
266 uint32_t au32Rsvd[96];
267 /** 0x3fc: Superblock checksum. */
268 uint32_t u32Chksum;
269} EXTSUPERBLOCK;
270AssertCompileMemberOffset(EXTSUPERBLOCK, u16UidReservedBlocks, 0x50);
271AssertCompileMemberOffset(EXTSUPERBLOCK, u32AlgoUsageBitmap, 0xc8);
272AssertCompileMemberOffset(EXTSUPERBLOCK, iJournalInode, 0xe0);
273AssertCompileMemberOffset(EXTSUPERBLOCK, u8HashVersionDef, 0xfc);
274AssertCompileMemberOffset(EXTSUPERBLOCK, fMntOptsDef, 0x100);
275AssertCompileMemberOffset(EXTSUPERBLOCK, iBlkLastError, 0x1d8);
276AssertCompileMemberOffset(EXTSUPERBLOCK, iInodeLostFound, 0x268);
277AssertCompileSize(EXTSUPERBLOCK, 1024);
278/** Pointer to an ext super block. */
279typedef EXTSUPERBLOCK *PEXTSUPERBLOCK;
280/** Pointer to a const ext super block. */
281typedef EXTSUPERBLOCK const *PCEXTSUPERBLOCK;
282
283/** Ext signature. */
284#define EXT_SB_SIGNATURE UINT16_C(0xef53)
285
286/** @name EXT_SB_STATE_XXX - Filesystem state
287 * @{ */
288/** Clean filesystem state. */
289#define EXT_SB_STATE_CLEAN UINT16_C(0x0001)
290/** Error filesystem state. */
291#define EXT_SB_STATE_ERRORS UINT16_C(0x0002)
292/** Orphans being recovered state. */
293#define EXT_SB_STATE_ORPHANS_RECOVERING UINT16_C(0x0004)
294/** @} */
295
296/** @name EXT_SB_OS_ID_CREATOR_XXX - Filesystem creator
297 * @{ */
298/** Linux. */
299#define EXT_SB_OS_ID_CREATOR_LINUX 0
300/** Hurd. */
301#define EXT_SB_OS_ID_CREATOR_HURD 1
302/** Masix. */
303#define EXT_SB_OS_ID_CREATOR_MASIX 2
304/** FreeBSD. */
305#define EXT_SB_OS_ID_CREATOR_FREEBSD 3
306/** Lites. */
307#define EXT_SB_OS_ID_CREATOR_LITES 4
308/** @} */
309
310/** @name EXT_SB_REV_XXX - Superblock revision
311 * @{ */
312/** Original format (ext2). */
313#define EXT_SB_REV_ORIG 0
314/** Inodes have dynmic sizes. */
315#define EXT_SB_REV_V2_DYN_INODE_SZ 1
316/** @} */
317
318/** @name EXT_SB_FEAT_COMPAT_XXX - Compatible features which can be ignored when set
319 * and not being supported.
320 * @{ */
321/** Directories can be preallocated. */
322#define EXT_SB_FEAT_COMPAT_DIR_PREALLOC RT_BIT_32(0)
323/** Some sort of "imagic" inodes. */
324#define EXT_SB_FEAT_COMPAT_IMAGIC_INODES RT_BIT_32(1)
325/** Filesystem has a journal. */
326#define EXT_SB_FEAT_COMPAT_HAS_JOURNAL RT_BIT_32(2)
327/** Filesystem supports extended attributes. */
328#define EXT_SB_FEAT_COMPAT_EXT_ATTR RT_BIT_32(3)
329/** Filesystem contains reserved group descriptor blocks for filesystem expansion. */
330#define EXT_SB_FEAT_COMPAT_RESIZE_INODE RT_BIT_32(4)
331/** Filesystem contains directory indices. */
332#define EXT_SB_FEAT_COMPAT_DIR_INDEX RT_BIT_32(5)
333/** Lazy block group - not used. */
334#define EXT_SB_FEAT_COMPAT_LAZY_BG RT_BIT_32(6)
335/** Exclude inode - not used. */
336#define EXT_SB_FEAT_COMPAT_EXCLUDE_INODE RT_BIT_32(7)
337/** Exclude bitmap - not used. */
338#define EXT_SB_FEAT_COMPAT_EXCLUDE_BITMAP RT_BIT_32(8)
339/** Sparse super blocks, super block contains pointers to block groups
340 * containing backups of the superblock. */
341#define EXT_SB_FEAT_COMPAT_SPARSE_SUPER2 RT_BIT_32(9)
342/** @} */
343
344/** @name EXT_SB_FEAT_INCOMPAT_XXX - Incompatible features which cause a mounting
345 * error when set and not being supported.
346 * @{ */
347/** Filesystem contains compressed files. */
348#define EXT_SB_FEAT_INCOMPAT_COMPRESSION RT_BIT_32(0)
349/** Directory entries contain a file type. */
350#define EXT_SB_FEAT_INCOMPAT_DIR_FILETYPE RT_BIT_32(1)
351/** Filesystem needs recovery. */
352#define EXT_SB_FEAT_INCOMPAT_RECOVER RT_BIT_32(2)
353/** The journal is recorded on a separate device. */
354#define EXT_SB_FEAT_INCOMPAT_JOURNAL_DEV RT_BIT_32(3)
355/** Filesystem uses meta block groups. */
356#define EXT_SB_FEAT_INCOMPAT_META_BG RT_BIT_32(4)
357/** Files in the filesystem use extents. */
358#define EXT_SB_FEAT_INCOMPAT_EXTENTS RT_BIT_32(6)
359/** Filesystem uses 64bit offsets. */
360#define EXT_SB_FEAT_INCOMPAT_64BIT RT_BIT_32(7)
361/** Filesystem requires multiple mount preotection. */
362#define EXT_SB_FEAT_INCOMPAT_MMP RT_BIT_32(8)
363/** Filesystem uses flexible block groups. */
364#define EXT_SB_FEAT_INCOMPAT_FLEX_BG RT_BIT_32(9)
365/** Inodes can be used to store large extended attribute values. */
366#define EXT_SB_FEAT_INCOMPAT_EXT_ATTR_INODE RT_BIT_32(10)
367/** Data is contained in directory entries. */
368#define EXT_SB_FEAT_INCOMPAT_DIRDATA RT_BIT_32(12)
369/** Metadata checksum seed is stored in the super block. */
370#define EXT_SB_FEAT_INCOMPAT_CSUM_SEED RT_BIT_32(13)
371/** Directories can be larger than 2GiB or contain a 3-level HTree. */
372#define EXT_SB_FEAT_INCOMPAT_LARGE_DIR RT_BIT_32(14)
373/** Data is inlined in the inode. */
374#define EXT_SB_FEAT_INCOMPAT_INLINE_DATA RT_BIT_32(15)
375/** Encrypted inodes are present on the filesystem. */
376#define EXT_SB_FEAT_INCOMPAT_ENCRYPT RT_BIT_32(16)
377/** @} */
378
379/** @name EXT_SB_FEAT_COMPAT_RO_XXX - Backward compatible features when mounted readonly
380 * @{ */
381/** Sparse superblocks. */
382#define EXT_SB_FEAT_COMPAT_RO_SPARSE_SUPER RT_BIT_32(0)
383/** There is at least one large file (> 2GiB). */
384#define EXT_SB_FEAT_COMPAT_RO_LARGE_FILE RT_BIT_32(1)
385/** Actually not used in the Linux kernel and e2fprogs. */
386#define EXT_SB_FEAT_COMPAT_RO_BTREE_DIR RT_BIT_32(2)
387/** Filesystem contains files which sizes are not represented as a multiple of 512 byte sectors
388 * but logical blocks instead. */
389#define EXT_SB_FEAT_COMPAT_RO_HUGE_FILE RT_BIT_32(3)
390/** Group descriptors have checksums embedded */
391#define EXT_SB_FEAT_COMPAT_RO_GDT_CHSKUM RT_BIT_32(4)
392/** Subdirectory limit of 32000 doesn't apply. The link count is set to 1 if beyond 64999. */
393#define EXT_SB_FEAT_COMPAT_RO_DIR_NLINK RT_BIT_32(5)
394/** Inodes can contain extra data. */
395#define EXT_SB_FEAT_COMPAT_RO_EXTRA_INODE_SZ RT_BIT_32(6)
396/** There is at least one snapshot on the filesystem. */
397#define EXT_SB_FEAT_COMPAT_RO_HAS_SNAPSHOTS RT_BIT_32(7)
398/** Quotas are enabled for this filesystem. */
399#define EXT_SB_FEAT_COMPAT_RO_QUOTA RT_BIT_32(8)
400/** The bigalloc feature is enabled, file extents are tracked in units of clusters
401 * instead of blocks. */
402#define EXT_SB_FEAT_COMPAT_RO_BIGALLOC RT_BIT_32(9)
403/** Metadata contains checksums. */
404#define EXT_SB_FEAT_COMPAT_RO_METADATA_CHKSUM RT_BIT_32(10)
405/** Filesystem supports replicas. */
406#define EXT_SB_FEAT_COMPAT_RO_REPLICA RT_BIT_32(11)
407/** Filesystem is readonly. */
408#define EXT_SB_FEAT_COMPAT_RO_READONLY RT_BIT_32(12)
409/** Filesystem tracks project quotas. */
410#define EXT_SB_FEAT_COMPAT_RO_PROJECT RT_BIT_32(13)
411/** @} */
412
413/** @name EXT_SB_HASH_VERSION_DEF_XXX - Default hash algorithm used
414 * @{ */
415/** Legacy. */
416#define EXT_SB_HASH_VERSION_DEF_LEGACY 0
417/** Half MD4. */
418#define EXT_SB_HASH_VERSION_DEF_HALF_MD4 1
419/** Tea. */
420#define EXT_SB_HASH_VERSION_DEF_TEA 2
421/** Unsigned legacy. */
422#define EXT_SB_HASH_VERSION_DEF_LEGACY_UNSIGNED 3
423/** Unsigned half MD4. */
424#define EXT_SB_HASH_VERSION_DEF_HALF_MD4_UNSIGNED 4
425/** Unsigned tea. */
426#define EXT_SB_HASH_VERSION_DEF_TEA_UNSIGNED 5
427/** @} */
428
429/** @name EXT_SB_MNT_OPTS_DEF_XXX - Default mount options
430 * @{ */
431/** Print debugging information on (re)mount. */
432#define EXT_SB_MNT_OPTS_DEF_DEBUG RT_BIT_32(0)
433/** Created files take the group ID ofthe containing directory. */
434#define EXT_SB_MNT_OPTS_DEF_BSDGROUPS RT_BIT_32(1)
435/** Support userspace extended attributes. */
436#define EXT_SB_MNT_OPTS_DEF_XATTR_USER RT_BIT_32(2)
437/** Support POSIX access control lists. */
438#define EXT_SB_MNT_OPTS_DEF_ACL RT_BIT_32(3)
439/** Do not support 32bit UIDs. */
440#define EXT_SB_MNT_OPTS_DEF_UID16 RT_BIT_32(4)
441/** All data and metadata are committed to the journal. */
442#define EXT_SB_MNT_OPTS_DEF_JMODE_DATA RT_BIT_32(5)
443/** All data are flushed to the disk before metadata are committed to the journal. */
444#define EXT_SB_MNT_OPTS_DEF_JMODE_ORDERED RT_BIT_32(6)
445/** Data ordering not preserved, data may be written after metadata has been written. */
446#define EXT_SB_MNT_OPTS_DEF_JMODE_WBACK (EXT_SB_MNT_OPTS_DEF_JMODE_DATA | EXT_SB_MNT_OPTS_DEF_JMODE_ORDERED)
447/** No write flushes. */
448#define EXT_SB_MNT_OPTS_DEF_NOBARRIER RT_BIT_32(8)
449/** Track metadata blocks on the filesystem not being used as data blocks. */
450#define EXT_SB_MNT_OPTS_DEF_BLOCK_VALIDITY RT_BIT_32(9)
451/** Enables TRIM/DISCARD support. */
452#define EXT_SB_MNT_OPTS_DEF_DISCARD RT_BIT_32(10)
453/** Disable delayed allocation. */
454#define EXT_SB_MNT_OPTS_DEF_NODELALLOC RT_BIT_32(11)
455/** @} */
456
457/** @name EXT_SB_F_XXX - Superblock flags
458 * @{ */
459/** Signed directory hash used. */
460#define EXT_SB_F_SIGNED_DIR_HASH RT_BIT_32(0)
461/** Unsigned directory hash used. */
462#define EXT_SB_F_UNSIGNED_DIR_HASH RT_BIT_32(1)
463/** Only used to test development code. */
464#define EXT_SB_F_DEV_CODE RT_BIT_32(3)
465/** @} */
466
467/** @name EXT_SB_ENCRYPT_ALGO_XXX - Group descriptor flags
468 * @{ */
469/** Invalid encryption algorithm. */
470#define EXT_SB_ENCRYPT_ALGO_INVALID 0
471/** 256-bit AES in XTS mode. */
472#define EXT_SB_ENCRYPT_ALGO_256BIT_AES_XTS 1
473/** 256-bit AES in GCM mode. */
474#define EXT_SB_ENCRYPT_ALGO_256BIT_AES_GCM 2
475/** 256-bit AES in CBC mode. */
476#define EXT_SB_ENCRYPT_ALGO_256BIT_AES_CBC 3
477/** @} */
478
479
480/**
481 * Block group descriptor (32byte version).
482 */
483typedef struct EXTBLOCKGROUPDESC32
484{
485 /** 0x00: Block address of the block bitmap (low 32bits). */
486 uint32_t offBlockBitmapLow;
487 /** 0x04: Block address of the inode bitmap (low 32bits). */
488 uint32_t offInodeBitmapLow;
489 /** 0x08: Start block address of the inode table (low 32bits). */
490 uint32_t offInodeTableLow;
491 /** 0x0c: Number of unallocated blocks in group (low 16bits). */
492 uint16_t cBlocksFreeLow;
493 /** 0x0e: Number of unallocated inodes in group (low 16bits). */
494 uint16_t cInodesFreeLow;
495 /** 0x10: Number of directories in the group (low 16bits). */
496 uint16_t cDirectoriesLow;
497 /** 0x12: Flags (EXT_GROUP_DESC_F_XXX). */
498 uint16_t fFlags;
499 /** 0x14: Location of snapshot exclusion bitmap (lower 32bits) */
500 uint32_t offSnapshotExclBitmapLow;
501 /** 0x18: Block bitmap checksum (lower 16bits). */
502 uint16_t u16ChksumBlockBitmapLow;
503 /** 0x1a: Inode bitmap checksum (lower 16bits). */
504 uint16_t u16ChksumInodeBitmapLow;
505 /** 0x1c: Unused inode entry count in the groups inode table (lower 16bits).*/
506 uint16_t cInodeTblUnusedLow;
507 /** 0x1e: Group descriptor checksum. */
508 uint16_t u16Chksum;
509} EXTBLOCKGROUPDESC32;
510AssertCompileSize(EXTBLOCKGROUPDESC32, 32);
511/** Pointer to an ext block group descriptor. */
512typedef EXTBLOCKGROUPDESC32 *PEXTBLOCKGROUPDESC32;
513/** Pointer to a const 32 byte block group descriptor. */
514typedef const EXTBLOCKGROUPDESC32 *PCEXTBLOCKGROUPDESC32;
515
516
517/**
518 * Block group descriptor (64byte version).
519 */
520typedef struct EXTBLOCKGROUPDESC64
521{
522 /** 0x00: Embedded 32 byte descriptor. */
523 EXTBLOCKGROUPDESC32 v32;
524 /** 0x20: Location of block bitmap (upper 32bits). */
525 uint32_t offBlockBitmapHigh;
526 /** 0x24: Location of inode bitmap (upper 32bits). */
527 uint32_t offInodeBitmapHigh;
528 /** 0x28: Location of inode table (upper 32bits). */
529 uint32_t offInodeTableHigh;
530 /** 0x2c: Number of unallocated blocks (upper 16bits). */
531 uint16_t cBlocksFreeHigh;
532 /** 0x2e: Number of unallocated inodes (upper 16bits). */
533 uint16_t cInodesFreeHigh;
534 /** 0x30: Number of directories in the group (upper 16bits). */
535 uint16_t cDirectoriesHigh;
536 /** 0x32: Unused inode entry count in the groups inode table (upper 16bits).*/
537 uint16_t cInodeTblUnusedHigh;
538 /** 0x34: Location of snapshot exclusion bitmap (upper 32bits) */
539 uint32_t offSnapshotExclBitmapHigh;
540 /** 0x38: Block bitmap checksum (upper 16bits). */
541 uint16_t u16ChksumBlockBitmapHigh;
542 /** 0x3a: Inode bitmap checksum (upper 16bits). */
543 uint16_t u16ChksumInodeBitmapHigh;
544 /** 0x3c: Padding to 64 bytes. */
545 uint32_t u64Padding;
546} EXTBLOCKGROUPDESC64;
547AssertCompileSize(EXTBLOCKGROUPDESC64, 64);
548/** Pointer to an ext block group descriptor. */
549typedef EXTBLOCKGROUPDESC64 *PEXTBLOCKGROUPDESC64;
550/** Pointer to a const 64 byte block group descriptor. */
551typedef const EXTBLOCKGROUPDESC64 *PCEXTBLOCKGROUPDESC64;
552
553/** @name EXT_GROUP_DESC_F_XXX - Group descriptor flags
554 * @{ */
555/** Inode table and bitmaps are not initialized. */
556#define EXT_GROUP_DESC_F_INODE_UNINIT RT_BIT(0)
557/** Block bitmap is not initialized. */
558#define EXT_GROUP_DESC_F_BLOCK_UNINIT RT_BIT(1)
559/** Inode table is zeroed. */
560#define EXT_GROUP_DESC_F_INODE_ZEROED RT_BIT(2)
561/** @} */
562
563
564/**
565 * Combiend view of the different block gorup descriptor versions.
566 */
567typedef union EXTBLOCKGROUPDESC
568{
569 /** 32 byte version. */
570 EXTBLOCKGROUPDESC32 v32;
571 /** 64 byte version. */
572 EXTBLOCKGROUPDESC64 v64;
573 /** Byte view. */
574 uint8_t au8[64];
575} EXTBLOCKGROUPDESC;
576/** Poiner to a unified block gorup descriptor view. */
577typedef EXTBLOCKGROUPDESC *PEXTBLOCKGROUPDESC;
578/** Poiner to a const unified block gorup descriptor view. */
579typedef const EXTBLOCKGROUPDESC *PCEXTBLOCKGROUPDESC;
580
581
582/** Number of block entries in the inodes block map. */
583#define EXT_INODE_BLOCK_ENTRIES 15
584
585/**
586 * Inode table entry (standard 128 byte version).
587 */
588typedef struct EXTINODE
589{
590 /** 0x00: File mode (EXT_INODE_FILE_MODE_XXX). */
591 uint16_t fMode;
592 /** 0x02: Owner UID (lower 16bits). */
593 uint16_t uUidLow;
594 /** 0x04: Size in bytes (lower 32bits). */
595 uint32_t cbSizeLow;
596 /** 0x08: Last access time in seconds since epoch. */
597 uint32_t u32TimeLastAccess;
598 /** 0x0c: Last inode change time in seconds since epoch. */
599 uint32_t u32TimeLastChange;
600 /** 0x10: Last data modification time in seconds since epoch. */
601 uint32_t u32TimeLastModification;
602 /** 0x14: Deletion time in seconds since epoch. */
603 uint32_t u32TimeDeletion;
604 /** 0x18: Group ID (lower 16bits). */
605 uint16_t uGidLow;
606 /** 0x1a: Hard link count. */
607 uint16_t cHardLinks;
608 /** 0x1c: Block count (lower 32bits). */
609 uint32_t cBlocksLow;
610 /** 0x20: Inode flags. */
611 uint32_t fFlags;
612 /** 0x24: Operating system dependent data. */
613 union
614 {
615 /** Linux: Inode version. */
616 uint32_t u32LnxVersion;
617 } Osd1;
618 /** 0x28: Block map or extent tree. */
619 uint32_t au32Block[EXT_INODE_BLOCK_ENTRIES];
620 /** 0x64: File version. */
621 uint32_t u32Version;
622 /** 0x68: Extended attribute control block (lower 32bits). */
623 uint32_t offExtAttrLow;
624 /** 0x6c: File/directory size (upper 32bits). */
625 uint32_t cbSizeHigh;
626 /** 0x70: Fragment address (obsolete). */
627 uint32_t u32FragmentAddrObs;
628 /** 0x74: Operating system dependent data 2. */
629 union
630 {
631 /** Linux related data. */
632 struct
633 {
634 /** 0x00: Block count (upper 16bits). */
635 uint16_t cBlocksHigh;
636 /** 0x02: Extended attribute block location (upper 16bits). */
637 uint16_t offExtAttrHigh;
638 /** 0x04: Owner UID (upper 16bits). */
639 uint16_t uUidHigh;
640 /** 0x06: Group ID (upper 16bits). */
641 uint16_t uGidHigh;
642 /** 0x08: Inode checksum (lower 16bits). */
643 uint16_t u16ChksumLow;
644 /** 0x0a: Reserved */
645 uint16_t u16Rsvd;
646 } Lnx;
647 } Osd2;
648} EXTINODE;
649AssertCompileSize(EXTINODE, 128);
650/** Pointer to an inode. */
651typedef EXTINODE *PEXTINODE;
652/** Pointer to a const inode. */
653typedef const EXTINODE *PCEXTINODE;
654
655
656/**
657 * Extra inode data (coming right behind the fixed inode data).
658 */
659typedef struct EXTINODEEXTRA
660{
661 /** 0x80: Size of the extra inode data in bytes. */
662 uint16_t cbInodeExtra;
663 /** 0x82: Inode checksum (upper 16bits.) */
664 uint16_t u16ChksumHigh;
665 /** 0x84: Last inode change time, extra time bits for sub-second precision. */
666 uint32_t u32ExtraTimeLastChange;
667 /** 0x88: Last data modification time, extra time bits for sub-second precision. */
668 uint32_t u32ExtraTimeLastModification;
669 /** 0x8c: Last access time, extra time bits for sub-second precision. */
670 uint32_t u32ExtraTimeLastAccess;
671 /** 0x90: File creation time in seconds since epoch. */
672 uint32_t u32TimeCreation;
673 /** 0x94: File creation time, extra time bits for sub-second precision. */
674 uint32_t u32ExtraTimeCreation;
675 /** 0x98: Version number (upper 32bits). */
676 uint32_t u32VersionHigh;
677 /** 0x9c: Project ID. */
678 uint32_t u32ProjectId;
679} EXTINODEEXTRA;
680/** Pointer to extra inode data. */
681typedef EXTINODEEXTRA *PEXTINODEEXTRA;
682/** Pointer to a const extra inode data. */
683typedef const EXTINODEEXTRA *PCEXTINODEEXTRA;
684
685
686/**
687 * Combined inode data.
688 */
689typedef struct EXTINODECOMB
690{
691 /** Core inode structure. */
692 EXTINODE Core;
693 /** Any extra inode data which might be present. */
694 EXTINODEEXTRA Extra;
695} EXTINODECOMB;
696/** Pointer to combined inode data. */
697typedef EXTINODECOMB *PEXTINODECOMB;
698/** Pointer to a const combined inode data. */
699typedef const EXTINODECOMB *PCEXTINODECOMB;
700
701
702
703/** @name EXT_INODE_MODE_XXX - File mode
704 * @{ */
705/** Others can execute the file. */
706#define EXT_INODE_MODE_EXEC_OTHER RT_BIT(0)
707/** Others can write to the file. */
708#define EXT_INODE_MODE_WRITE_OTHER RT_BIT(1)
709/** Others can read the file. */
710#define EXT_INODE_MODE_READ_OTHER RT_BIT(2)
711/** Members of the same group can execute the file. */
712#define EXT_INODE_MODE_EXEC_GROUP RT_BIT(3)
713/** Members of the same group can write to the file. */
714#define EXT_INODE_MODE_WRITE_GROUP RT_BIT(4)
715/** Members of the same group can read the file. */
716#define EXT_INODE_MODE_READ_GROUP RT_BIT(5)
717/** Owner can execute the file. */
718#define EXT_INODE_MODE_EXEC_OWNER RT_BIT(6)
719/** Owner can write to the file. */
720#define EXT_INODE_MODE_WRITE_OWNER RT_BIT(7)
721/** Owner can read the file. */
722#define EXT_INODE_MODE_READ_OWNER RT_BIT(8)
723/** Sticky file mode. */
724#define EXT_INODE_MODE_STICKY RT_BIT(9)
725/** File is set GID. */
726#define EXT_INODE_MODE_SET_GROUP_ID RT_BIT(10)
727/** File is set UID. */
728#define EXT_INODE_MODE_SET_USER_ID RT_BIT(11)
729/** @} */
730
731/** @name EXT_INODE_MODE_TYPE_XXX - File type
732 * @{ */
733/** Inode represents a FIFO. */
734#define EXT_INODE_MODE_TYPE_FIFO UINT16_C(0x1000)
735/** Inode represents a character device. */
736#define EXT_INODE_MODE_TYPE_CHAR UINT16_C(0x2000)
737/** Inode represents a directory. */
738#define EXT_INODE_MODE_TYPE_DIR UINT16_C(0x4000)
739/** Inode represents a block device. */
740#define EXT_INODE_MODE_TYPE_BLOCK UINT16_C(0x6000)
741/** Inode represents a regular file. */
742#define EXT_INODE_MODE_TYPE_REGULAR UINT16_C(0x8000)
743/** Inode represents a symlink. */
744#define EXT_INODE_MODE_TYPE_SYMLINK UINT16_C(0xa000)
745/** Inode represents a socket. */
746#define EXT_INODE_MODE_TYPE_SOCKET UINT16_C(0xc000)
747/** Returns the inode type from the combined mode field. */
748#define EXT_INODE_MODE_TYPE_GET_TYPE(a_Mode) ((a_Mode) & 0xf000)
749/** @} */
750
751/** @name EXT_INODE_F_XXX - Inode flags
752 * @{ */
753/** Inode requires secure erase on deletion. */
754#define EXT_INODE_F_SECURE_ERASE RT_BIT_32(0)
755/** Inode should be preserved for undeletion during deletion. */
756#define EXT_INODE_F_UNDELETE RT_BIT_32(1)
757/** Inode contains compressed data. */
758#define EXT_INODE_F_COMPRESSED RT_BIT_32(2)
759/** All writes to this inode must be synchronous. */
760#define EXT_INODE_F_SYNCHRONOUS RT_BIT_32(3)
761/** Inode is immutable. */
762#define EXT_INODE_F_IMMUTABLE RT_BIT_32(4)
763/** Inode is append only. */
764#define EXT_INODE_F_APPEND_ONLY RT_BIT_32(5)
765/** Inode should not be dumped via dump(1). */
766#define EXT_INODE_F_NO_DUMP RT_BIT_32(6)
767/** Access time is not updated. */
768#define EXT_INODE_F_NO_ACCESS_TIME RT_BIT_32(7)
769/** Dirty compressed file. */
770#define EXT_INODE_F_DIRTY_COMPRESSED RT_BIT_32(8)
771/** Inode has one or more compressed clusters. */
772#define EXT_INODE_F_COMPRESSED_BLOCK RT_BIT_32(9)
773/** Inode should not be compressed. */
774#define EXT_INODE_F_NO_COMPRESSION RT_BIT_32(10)
775/** Inode is encrypted. */
776#define EXT_INODE_F_ENCRYPTED RT_BIT_32(11)
777/** Directory has hashed indexes. */
778#define EXT_INODE_F_DIR_HASHED_INDEX RT_BIT_32(12)
779/** AFS magic directory. */
780#define EXT_INODE_F_IMAGIC RT_BIT_32(13)
781/** Data must always be written through the journal. */
782#define EXT_INODE_F_JOURNAL_DATA RT_BIT_32(14)
783/** File tail should not be merged. */
784#define EXT_INODE_F_NOTAIL RT_BIT_32(15)
785/** All directory entry data should be written synchronously. */
786#define EXT_INODE_F_DIR_SYNCHRONOUS RT_BIT_32(16)
787/** Top of directory hierarchy. */
788#define EXT_INODE_F_TOP_DIRECTORY RT_BIT_32(17)
789/** Inode is a huge file. */
790#define EXT_INODE_F_HUGE_FILE RT_BIT_32(18)
791/** Inode uses extents. */
792#define EXT_INODE_F_EXTENTS RT_BIT_32(19)
793/** Inode stores a large extended attribute value in its data blocks. */
794#define EXT_INODE_F_EXT_ATTR_INODE RT_BIT_32(20)
795/** File has blocks allocated past end of file. */
796#define EXT_INODE_F_ALLOC_BLOCKS_EOF RT_BIT_32(21)
797/** Inode is a snapshot. */
798#define EXT_INODE_F_SNAPSHOT RT_BIT_32(22)
799/** Snapshot is being deleted. */
800#define EXT_INODE_F_SNAPSHOT_DELETED RT_BIT_32(23)
801/** Snapshot shrink has completed. */
802#define EXT_INODE_F_SNAPSHOT_SHRUNK RT_BIT_32(24)
803/** Inode contains inline data. */
804#define EXT_INODE_F_INLINE_DATA RT_BIT_32(25)
805/** Children are created with the same project ID. */
806#define EXT_INODE_F_PROJECT_ID_INHERIT RT_BIT_32(26)
807/** Reserved for ext4 library. */
808#define EXT_INODE_F_RESERVED_LIBRARY RT_BIT_32(27)
809/** @} */
810
811
812/**
813 * Extent tree header.
814 */
815typedef struct EXTEXTENTHDR
816{
817 /** 0x00: Magic number for identification. */
818 uint16_t u16Magic;
819 /** 0x02: Number of valid entries following. */
820 uint16_t cEntries;
821 /** 0x04: Maxmimum number of entries that could follow. */
822 uint16_t cMax;
823 /** 0x06: Depth of this extent node in the tree. */
824 uint16_t uDepth;
825 /** 0x08: Generation of the tree (not used by standard ext4). */
826 uint32_t cGeneration;
827} EXTEXTENTHDR;
828AssertCompileSize(EXTEXTENTHDR, 12);
829/** Pointer to a extent tree header. */
830typedef EXTEXTENTHDR *PEXTEXTENTHDR;
831/** Pointer to a const extent tree header. */
832typedef const EXTEXTENTHDR *PCEXTEXTENTHDR;
833
834/** Magic number identifying an extent header. */
835#define EXT_EXTENT_HDR_MAGIC UINT16_C(0xf30a)
836/** Maximum depth an extent header can have. */
837#define EXT_EXTENT_HDR_DEPTH_MAX UINT16_C(5)
838
839
840/**
841 * Extent tree index node.
842 */
843typedef struct EXTEXTENTIDX
844{
845 /** 0x00: Start file block this node covers. */
846 uint32_t iBlock;
847 /** 0x04: Block number of child extent node (lower 32bits). */
848 uint32_t offChildLow;
849 /** 0x08: Block number of child extent node (upper 16bits). */
850 uint16_t offChildHigh;
851 /** 0x0a: Reserved. */
852 uint16_t u16Rsvd;
853} EXTEXTENTIDX;
854AssertCompileSize(EXTEXTENTIDX, 12);
855/** Pointer to an extent tree index node. */
856typedef EXTEXTENTIDX *PEXTEXTENTIDX;
857/** Pointer to a const extent tree index node. */
858typedef const EXTEXTENTIDX *PCEXTEXTENTIDX;
859
860
861/**
862 * Extent tree leaf node.
863 */
864typedef struct EXTEXTENT
865{
866 /** 0x00: First file block number this extent covers. */
867 uint32_t iBlock;
868 /** 0x04: Number of blocks covered by this extent. */
869 uint16_t cBlocks;
870 /** 0x06: Block number this extent points to (upper 32bits). */
871 uint16_t offStartHigh;
872 /** 0x08: Block number this extent points to (lower 32bits). */
873 uint32_t offStartLow;
874} EXTEXTENT;
875AssertCompileSize(EXTEXTENT, 12);
876/** Pointer to a leaf node. */
877typedef EXTEXTENT *PEXTEXTENT;
878/** Pointer to a const leaf node. */
879typedef const EXTEXTENT *PCEXTEXTENT;
880
881/** Length field limit for a populated extent, fields greater than that limit indicate a sparse extent. */
882#define EXT_EXTENT_LENGTH_LIMIT UINT16_C(32768)
883
884
885/**
886 * Directory entry.
887 */
888typedef struct EXTDIRENTRY
889{
890 /** 0x00: Inode number being referenced by this entry. */
891 uint32_t iInodeRef;
892 /** 0x04: Record length of this directory entry in bytes (multiple of 4). */
893 uint16_t cbRecord;
894 /** 0x06: Version dependent data. */
895 union
896 {
897 /** Original. */
898 struct
899 {
900 /** Name length in bytes (maximum 255). */
901 uint16_t cbName;
902 } v1;
903 /** Version 2. */
904 struct
905 {
906 /** Name length in bytes (maximum 255). */
907 uint8_t cbName;
908 /** File type (EXT_DIRENTRY_TYPE_XXX). */
909 uint8_t uType;
910 } v2;
911 } u;
912 /** 0x08: File name - variable in size. */
913 char achName[1];
914} EXTDIRENTRY;
915/** Pointer to a directory entry. */
916typedef EXTDIRENTRY *PEXTDIRENTRY;
917/** Poiner to a const directory entry. */
918typedef const EXTDIRENTRY *PCEXTDIRENTRY;
919
920
921/**
922 * Extended directory entry with the maximum size (263 bytes).
923 */
924#pragma pack(1)
925typedef union EXTDIRENTRYEX
926{
927 /** The directory entry. */
928 EXTDIRENTRY Core;
929 /** The byte view. */
930 uint8_t au8[263];
931} EXTDIRENTRYEX;
932#pragma pack()
933AssertCompileSize(EXTDIRENTRYEX, 263);
934/** Pointer to an extended directory entry. */
935typedef EXTDIRENTRYEX *PEXTDIRENTRYEX;
936/** Pointer to a const extended directory entry. */
937typedef const EXTDIRENTRYEX *PCEXTDIRENTRYEX;
938
939
940/** @name EXT_DIRENTRY_TYPE_XXX - file type
941 * @{ */
942/** Entry is of unknown file type. */
943#define EXT_DIRENTRY_TYPE_UNKNOWN 0
944/** Entry is regular file. */
945#define EXT_DIRENTRY_TYPE_REGULAR 1
946/** Entry is another directory. */
947#define EXT_DIRENTRY_TYPE_DIRECTORY 2
948/** Entry is a character device. */
949#define EXT_DIRENTRY_TYPE_CHAR 3
950/** Entry is a block device. */
951#define EXT_DIRENTRY_TYPE_BLOCK 4
952/** Entry is a FIFO. */
953#define EXT_DIRENTRY_TYPE_FIFO 5
954/** Entry is a socket. */
955#define EXT_DIRENTRY_TYPE_SOCKET 6
956/** Entry is a symlink. */
957#define EXT_DIRENTRY_TYPE_SYMLINK 7
958/** Entry is a checksum and uses EXTDIRENTRYCHKSUM. */
959#define EXT_DIRENTRY_TYPE_CHKSUM 0xde
960/** @} */
961
962
963/**
964 * Tail directory entry (for checksumming).
965 */
966typedef struct EXTDIRENTRYCHKSUM
967{
968 /** 0x00: Reserved, must be 0 (overlays with EXTDIRENTRY::iNodeRef). */
969 uint32_t u32Rsvd;
970 /** 0x04: Record length (must be 12). */
971 uint16_t cbRecord;
972 /** 0x06: Reserved (overlays with EXTDIRENTRY::u::v1::cbName). */
973 uint8_t u8Rsvd;
974 /** 0x07: File type (must be 0xde). */
975 uint8_t uType;
976 /** 0x08: Checksum. */
977 uint32_t u32Chksum;
978} EXTDIRENTRYCHKSUM;
979/** Pointer to a tail directory entry. */
980typedef EXTDIRENTRYCHKSUM *PEXTDIRENTRYCHKSUM;
981/** Pointer to const tail directory entry. */
982typedef const EXTDIRENTRYCHKSUM *PCEXTDIRENTRYCHKSUM;
983
984
985/** @} */
986
987#endif /* !IPRT_INCLUDED_formats_ext_h */
988
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