blob: b0b23f41abc38cbfc6b55b8eb94594dc3bbabe88 [file] [log] [blame]
Gao Xiang29b24f62019-07-31 23:57:31 +08001/* SPDX-License-Identifier: GPL-2.0-only OR Apache-2.0 */
2/*
Gao Xiangea559e72019-09-04 10:08:57 +08003 * EROFS (Enhanced ROM File System) on-disk format definition
4 *
Gao Xiangaea12862018-07-26 20:21:44 +08005 * Copyright (C) 2017-2018 HUAWEI, Inc.
Alexander A. Klimov592e7cd2020-07-13 15:09:44 +02006 * https://www.huawei.com/
Gao Xiang2a9dc7a2021-08-20 18:00:18 +08007 * Copyright (C) 2021, Alibaba Cloud
Gao Xiangaea12862018-07-26 20:21:44 +08008 */
9#ifndef __EROFS_FS_H
10#define __EROFS_FS_H
11
Gao Xiangaea12862018-07-26 20:21:44 +080012#define EROFS_SUPER_OFFSET 1024
13
Pratik Shindeb858a482019-11-04 10:49:37 +080014#define EROFS_FEATURE_COMPAT_SB_CHKSUM 0x00000001
15
Gao Xiang5efe5132019-06-13 16:35:41 +080016/*
Gao Xiang426a9302019-09-04 10:08:53 +080017 * Any bits that aren't in EROFS_ALL_FEATURE_INCOMPAT should
18 * be incompatible with this kernel version.
Gao Xiang5efe5132019-06-13 16:35:41 +080019 */
Gao Xiang426a9302019-09-04 10:08:53 +080020#define EROFS_FEATURE_INCOMPAT_LZ4_0PADDING 0x00000001
Gao Xiang14373712021-03-29 18:00:12 +080021#define EROFS_FEATURE_INCOMPAT_COMPR_CFGS 0x00000002
Gao Xiang5404c33012021-04-07 12:39:22 +080022#define EROFS_FEATURE_INCOMPAT_BIG_PCLUSTER 0x00000002
Gao Xiang2a9dc7a2021-08-20 18:00:18 +080023#define EROFS_FEATURE_INCOMPAT_CHUNKED_FILE 0x00000004
Gao Xiang8e6c8fa2021-04-07 12:39:27 +080024#define EROFS_ALL_FEATURE_INCOMPAT \
25 (EROFS_FEATURE_INCOMPAT_LZ4_0PADDING | \
26 EROFS_FEATURE_INCOMPAT_COMPR_CFGS | \
Gao Xiang2a9dc7a2021-08-20 18:00:18 +080027 EROFS_FEATURE_INCOMPAT_BIG_PCLUSTER | \
28 EROFS_FEATURE_INCOMPAT_CHUNKED_FILE)
Gao Xiang5efe5132019-06-13 16:35:41 +080029
Gao Xiang14373712021-03-29 18:00:12 +080030#define EROFS_SB_EXTSLOT_SIZE 16
31
32/* erofs on-disk super block (currently 128 bytes) */
Gao Xiangaea12862018-07-26 20:21:44 +080033struct erofs_super_block {
Gao Xiang4b66eb52019-09-04 10:08:48 +080034 __le32 magic; /* file system magic number */
35 __le32 checksum; /* crc32c(super_block) */
Gao Xiang426a9302019-09-04 10:08:53 +080036 __le32 feature_compat;
Gao Xiang4b66eb52019-09-04 10:08:48 +080037 __u8 blkszbits; /* support block_size == PAGE_SIZE only */
Gao Xiang14373712021-03-29 18:00:12 +080038 __u8 sb_extslots; /* superblock size = 128 + sb_extslots * 16 */
Gao Xiangaea12862018-07-26 20:21:44 +080039
Gao Xiang4b66eb52019-09-04 10:08:48 +080040 __le16 root_nid; /* nid of root directory */
41 __le64 inos; /* total valid ino # (== f_files - f_favail) */
Gao Xiangaea12862018-07-26 20:21:44 +080042
Gao Xiang4b66eb52019-09-04 10:08:48 +080043 __le64 build_time; /* inode v1 time derivation */
44 __le32 build_time_nsec; /* inode v1 time derivation in nano scale */
45 __le32 blocks; /* used for statfs */
46 __le32 meta_blkaddr; /* start block address of metadata area */
47 __le32 xattr_blkaddr; /* start block address of shared xattr area */
48 __u8 uuid[16]; /* 128-bit uuid for volume */
49 __u8 volume_name[16]; /* volume name */
Gao Xiang426a9302019-09-04 10:08:53 +080050 __le32 feature_incompat;
Gao Xiang14373712021-03-29 18:00:12 +080051 union {
52 /* bitmap for available compression algorithms */
53 __le16 available_compr_algs;
54 /* customized sliding window size instead of 64k by default */
55 __le16 lz4_max_distance;
56 } __packed u1;
Huang Jianan5d505382021-03-29 09:23:06 +080057 __u8 reserved2[42];
Gao Xianged34aa42019-09-04 10:08:51 +080058};
Gao Xiangaea12862018-07-26 20:21:44 +080059
Gao Xiangaea12862018-07-26 20:21:44 +080060/*
Gao Xiangea559e72019-09-04 10:08:57 +080061 * erofs inode datalayout (i_format in on-disk inode):
Gao Xiangaea12862018-07-26 20:21:44 +080062 * 0 - inode plain without inline data A:
63 * inode, [xattrs], ... | ... | no-holed data
Gao Xiangec8c2442019-06-24 15:22:51 +080064 * 1 - inode VLE compression B (legacy):
Gao Xiangaea12862018-07-26 20:21:44 +080065 * inode, [xattrs], extents ... | ...
66 * 2 - inode plain with inline data C:
67 * inode, [xattrs], last_inline_data, ... | ... | no-holed data
Gao Xiangec8c2442019-06-24 15:22:51 +080068 * 3 - inode compression D:
69 * inode, [xattrs], map_header, extents ... | ...
Gao Xiang2a9dc7a2021-08-20 18:00:18 +080070 * 4 - inode chunk-based E:
71 * inode, [xattrs], chunk indexes ... | ...
72 * 5~7 - reserved
Gao Xiangaea12862018-07-26 20:21:44 +080073 */
74enum {
Gao Xiang60a49ba2019-09-04 10:08:49 +080075 EROFS_INODE_FLAT_PLAIN = 0,
76 EROFS_INODE_FLAT_COMPRESSION_LEGACY = 1,
77 EROFS_INODE_FLAT_INLINE = 2,
78 EROFS_INODE_FLAT_COMPRESSION = 3,
Gao Xiang2a9dc7a2021-08-20 18:00:18 +080079 EROFS_INODE_CHUNK_BASED = 4,
Gao Xiang8a765682019-09-04 10:08:54 +080080 EROFS_INODE_DATALAYOUT_MAX
Gao Xiangaea12862018-07-26 20:21:44 +080081};
Gao Xiangccd9c192018-12-12 01:57:30 +080082
Gao Xiang3d2969f2019-08-13 10:30:52 +080083static inline bool erofs_inode_is_data_compressed(unsigned int datamode)
Gao Xiangec8c2442019-06-24 15:22:51 +080084{
Gao Xiangc39747f2019-09-04 10:08:52 +080085 return datamode == EROFS_INODE_FLAT_COMPRESSION ||
86 datamode == EROFS_INODE_FLAT_COMPRESSION_LEGACY;
Gao Xiangec8c2442019-06-24 15:22:51 +080087}
88
Gao Xiangccd9c192018-12-12 01:57:30 +080089/* bit definitions of inode i_advise */
Gao Xiangaea12862018-07-26 20:21:44 +080090#define EROFS_I_VERSION_BITS 1
Gao Xiang8a765682019-09-04 10:08:54 +080091#define EROFS_I_DATALAYOUT_BITS 3
Gao Xiangaea12862018-07-26 20:21:44 +080092
93#define EROFS_I_VERSION_BIT 0
Gao Xiang8a765682019-09-04 10:08:54 +080094#define EROFS_I_DATALAYOUT_BIT 1
Gao Xiangaea12862018-07-26 20:21:44 +080095
Gao Xiang24a806d2021-03-29 08:36:14 +080096#define EROFS_I_ALL \
97 ((1 << (EROFS_I_DATALAYOUT_BIT + EROFS_I_DATALAYOUT_BITS)) - 1)
98
Gao Xiang2a9dc7a2021-08-20 18:00:18 +080099/* indicate chunk blkbits, thus 'chunksize = blocksize << chunk blkbits' */
100#define EROFS_CHUNK_FORMAT_BLKBITS_MASK 0x001F
101/* with chunk indexes or just a 4-byte blkaddr array */
102#define EROFS_CHUNK_FORMAT_INDEXES 0x0020
103
104#define EROFS_CHUNK_FORMAT_ALL \
105 (EROFS_CHUNK_FORMAT_BLKBITS_MASK | EROFS_CHUNK_FORMAT_INDEXES)
106
107struct erofs_inode_chunk_info {
108 __le16 format; /* chunk blkbits, etc. */
109 __le16 reserved;
110};
111
Gao Xiang4b66eb52019-09-04 10:08:48 +0800112/* 32-byte reduced form of an ondisk inode */
Gao Xiang8a765682019-09-04 10:08:54 +0800113struct erofs_inode_compact {
114 __le16 i_format; /* inode format hints */
Gao Xiangaea12862018-07-26 20:21:44 +0800115
116/* 1 header + n-1 * 4 bytes inline xattr to keep continuity */
Gao Xiang4b66eb52019-09-04 10:08:48 +0800117 __le16 i_xattr_icount;
118 __le16 i_mode;
119 __le16 i_nlink;
120 __le32 i_size;
121 __le32 i_reserved;
122 union {
Gao Xiangaea12862018-07-26 20:21:44 +0800123 /* file total compressed blocks for data mapping 1 */
124 __le32 compressed_blocks;
125 __le32 raw_blkaddr;
126
127 /* for device files, used to indicate old/new device # */
128 __le32 rdev;
Gao Xiang2a9dc7a2021-08-20 18:00:18 +0800129
130 /* for chunk-based files, it contains the summary info */
131 struct erofs_inode_chunk_info c;
Gao Xianged34aa42019-09-04 10:08:51 +0800132 } i_u;
Gao Xiang4b66eb52019-09-04 10:08:48 +0800133 __le32 i_ino; /* only used for 32-bit stat compatibility */
134 __le16 i_uid;
135 __le16 i_gid;
136 __le32 i_reserved2;
Gao Xianged34aa42019-09-04 10:08:51 +0800137};
Gao Xiangaea12862018-07-26 20:21:44 +0800138
139/* 32 bytes on-disk inode */
Gao Xiang8a765682019-09-04 10:08:54 +0800140#define EROFS_INODE_LAYOUT_COMPACT 0
Gao Xiangaea12862018-07-26 20:21:44 +0800141/* 64 bytes on-disk inode */
Gao Xiang8a765682019-09-04 10:08:54 +0800142#define EROFS_INODE_LAYOUT_EXTENDED 1
Gao Xiangaea12862018-07-26 20:21:44 +0800143
Gao Xiang4b66eb52019-09-04 10:08:48 +0800144/* 64-byte complete form of an ondisk inode */
Gao Xiang8a765682019-09-04 10:08:54 +0800145struct erofs_inode_extended {
146 __le16 i_format; /* inode format hints */
Gao Xiangaea12862018-07-26 20:21:44 +0800147
Gao Xiangcead56f2019-07-31 23:57:34 +0800148/* 1 header + n-1 * 4 bytes inline xattr to keep continuity */
Gao Xiang4b66eb52019-09-04 10:08:48 +0800149 __le16 i_xattr_icount;
150 __le16 i_mode;
151 __le16 i_reserved;
152 __le64 i_size;
153 union {
Gao Xiangaea12862018-07-26 20:21:44 +0800154 /* file total compressed blocks for data mapping 1 */
155 __le32 compressed_blocks;
156 __le32 raw_blkaddr;
157
158 /* for device files, used to indicate old/new device # */
159 __le32 rdev;
Gao Xiang2a9dc7a2021-08-20 18:00:18 +0800160
161 /* for chunk-based files, it contains the summary info */
162 struct erofs_inode_chunk_info c;
Gao Xianged34aa42019-09-04 10:08:51 +0800163 } i_u;
Gao Xiangaea12862018-07-26 20:21:44 +0800164
165 /* only used for 32-bit stat compatibility */
Gao Xiang4b66eb52019-09-04 10:08:48 +0800166 __le32 i_ino;
Gao Xiangaea12862018-07-26 20:21:44 +0800167
Gao Xiang4b66eb52019-09-04 10:08:48 +0800168 __le32 i_uid;
169 __le32 i_gid;
170 __le64 i_ctime;
171 __le32 i_ctime_nsec;
172 __le32 i_nlink;
173 __u8 i_reserved2[16];
Gao Xianged34aa42019-09-04 10:08:51 +0800174};
Gao Xiangaea12862018-07-26 20:21:44 +0800175
176#define EROFS_MAX_SHARED_XATTRS (128)
177/* h_shared_count between 129 ... 255 are special # */
178#define EROFS_SHARED_XATTR_EXTENT (255)
179
180/*
181 * inline xattrs (n == i_xattr_icount):
182 * erofs_xattr_ibody_header(1) + (n - 1) * 4 bytes
183 * 12 bytes / \
184 * / \
185 * /-----------------------\
186 * | erofs_xattr_entries+ |
187 * +-----------------------+
188 * inline xattrs must starts in erofs_xattr_ibody_header,
189 * for read-only fs, no need to introduce h_refcount
190 */
191struct erofs_xattr_ibody_header {
Gao Xiangcead56f2019-07-31 23:57:34 +0800192 __le32 h_reserved;
Gao Xiangaea12862018-07-26 20:21:44 +0800193 __u8 h_shared_count;
Gao Xiangcead56f2019-07-31 23:57:34 +0800194 __u8 h_reserved2[7];
Gao Xiangaea12862018-07-26 20:21:44 +0800195 __le32 h_shared_xattrs[0]; /* shared xattr id array */
Gao Xianged34aa42019-09-04 10:08:51 +0800196};
Gao Xiangaea12862018-07-26 20:21:44 +0800197
198/* Name indexes */
199#define EROFS_XATTR_INDEX_USER 1
200#define EROFS_XATTR_INDEX_POSIX_ACL_ACCESS 2
201#define EROFS_XATTR_INDEX_POSIX_ACL_DEFAULT 3
202#define EROFS_XATTR_INDEX_TRUSTED 4
203#define EROFS_XATTR_INDEX_LUSTRE 5
204#define EROFS_XATTR_INDEX_SECURITY 6
205
206/* xattr entry (for both inline & shared xattrs) */
207struct erofs_xattr_entry {
208 __u8 e_name_len; /* length of name */
209 __u8 e_name_index; /* attribute name index */
210 __le16 e_value_size; /* size of attribute value */
211 /* followed by e_name and e_value */
212 char e_name[0]; /* attribute name */
Gao Xianged34aa42019-09-04 10:08:51 +0800213};
Gao Xiangaea12862018-07-26 20:21:44 +0800214
Gao Xiangb6796ab2019-09-04 10:08:50 +0800215static inline unsigned int erofs_xattr_ibody_size(__le16 i_xattr_icount)
216{
217 if (!i_xattr_icount)
218 return 0;
219
220 return sizeof(struct erofs_xattr_ibody_header) +
221 sizeof(__u32) * (le16_to_cpu(i_xattr_icount) - 1);
222}
Gao Xiangaea12862018-07-26 20:21:44 +0800223
224#define EROFS_XATTR_ALIGN(size) round_up(size, sizeof(struct erofs_xattr_entry))
Gao Xiangb6796ab2019-09-04 10:08:50 +0800225
226static inline unsigned int erofs_xattr_entry_size(struct erofs_xattr_entry *e)
227{
228 return EROFS_XATTR_ALIGN(sizeof(struct erofs_xattr_entry) +
229 e->e_name_len + le16_to_cpu(e->e_value_size));
230}
Gao Xiangaea12862018-07-26 20:21:44 +0800231
Gao Xiang2a9dc7a2021-08-20 18:00:18 +0800232/* represent a zeroed chunk (hole) */
233#define EROFS_NULL_ADDR -1
234
235/* 4-byte block address array */
236#define EROFS_BLOCK_MAP_ENTRY_SIZE sizeof(__le32)
237
238/* 8-byte inode chunk indexes */
239struct erofs_inode_chunk_index {
240 __le16 advise; /* always 0, don't care for now */
241 __le16 device_id; /* back-end storage id, always 0 for now */
242 __le32 blkaddr; /* start block address of this inode chunk */
243};
244
Gao Xiang9f6cc762021-04-07 12:39:20 +0800245/* maximum supported size of a physical compression cluster */
246#define Z_EROFS_PCLUSTER_MAX_SIZE (1024 * 1024)
247
Gao Xiangea559e72019-09-04 10:08:57 +0800248/* available compression algorithm types (for h_algorithmtype) */
Gao Xiangec8c2442019-06-24 15:22:51 +0800249enum {
Gao Xiang60a49ba2019-09-04 10:08:49 +0800250 Z_EROFS_COMPRESSION_LZ4 = 0,
Gao Xiangec8c2442019-06-24 15:22:51 +0800251 Z_EROFS_COMPRESSION_MAX
252};
Gao Xiang14373712021-03-29 18:00:12 +0800253#define Z_EROFS_ALL_COMPR_ALGS (1 << (Z_EROFS_COMPRESSION_MAX - 1))
Gao Xiangec8c2442019-06-24 15:22:51 +0800254
Gao Xiang46249cd2021-03-29 09:23:07 +0800255/* 14 bytes (+ length field = 16 bytes) */
256struct z_erofs_lz4_cfgs {
257 __le16 max_distance;
Gao Xiang5404c33012021-04-07 12:39:22 +0800258 __le16 max_pclusterblks;
259 u8 reserved[10];
Gao Xiang46249cd2021-03-29 09:23:07 +0800260} __packed;
261
Gao Xiangec8c2442019-06-24 15:22:51 +0800262/*
263 * bit 0 : COMPACTED_2B indexes (0 - off; 1 - on)
264 * e.g. for 4k logical cluster size, 4B if compacted 2B is off;
265 * (4B) + 2B + (4B) if compacted 2B is on.
Gao Xiang5404c33012021-04-07 12:39:22 +0800266 * bit 1 : HEAD1 big pcluster (0 - off; 1 - on)
267 * bit 2 : HEAD2 big pcluster (0 - off; 1 - on)
Gao Xiangec8c2442019-06-24 15:22:51 +0800268 */
Gao Xiang5404c33012021-04-07 12:39:22 +0800269#define Z_EROFS_ADVISE_COMPACTED_2B 0x0001
270#define Z_EROFS_ADVISE_BIG_PCLUSTER_1 0x0002
271#define Z_EROFS_ADVISE_BIG_PCLUSTER_2 0x0004
Gao Xiangec8c2442019-06-24 15:22:51 +0800272
273struct z_erofs_map_header {
274 __le32 h_reserved1;
275 __le16 h_advise;
276 /*
277 * bit 0-3 : algorithm type of head 1 (logical cluster type 01);
278 * bit 4-7 : algorithm type of head 2 (logical cluster type 11).
279 */
280 __u8 h_algorithmtype;
281 /*
282 * bit 0-2 : logical cluster bits - 12, e.g. 0 for 4096;
Gao Xiang54e0b6c2021-04-07 12:39:18 +0800283 * bit 3-7 : reserved.
Gao Xiangec8c2442019-06-24 15:22:51 +0800284 */
285 __u8 h_clusterbits;
286};
287
288#define Z_EROFS_VLE_LEGACY_HEADER_PADDING 8
Gao Xiangaea12862018-07-26 20:21:44 +0800289
290/*
Gao Xiangea559e72019-09-04 10:08:57 +0800291 * Fixed-sized output compression ondisk Logical Extent cluster type:
Gao Xiangaea12862018-07-26 20:21:44 +0800292 * 0 - literal (uncompressed) cluster
293 * 1 - compressed cluster (for the head logical cluster)
294 * 2 - compressed cluster (for the other logical clusters)
295 *
296 * In detail,
297 * 0 - literal (uncompressed) cluster,
298 * di_advise = 0
299 * di_clusterofs = the literal data offset of the cluster
300 * di_blkaddr = the blkaddr of the literal cluster
301 *
302 * 1 - compressed cluster (for the head logical cluster)
303 * di_advise = 1
304 * di_clusterofs = the decompressed data offset of the cluster
305 * di_blkaddr = the blkaddr of the compressed cluster
306 *
307 * 2 - compressed cluster (for the other logical clusters)
308 * di_advise = 2
309 * di_clusterofs =
310 * the decompressed data offset in its own head cluster
311 * di_u.delta[0] = distance to its corresponding head cluster
312 * di_u.delta[1] = distance to its corresponding tail cluster
313 * (di_advise could be 0, 1 or 2)
314 */
Gao Xiang99691b42018-08-21 22:49:33 +0800315enum {
Gao Xiang60a49ba2019-09-04 10:08:49 +0800316 Z_EROFS_VLE_CLUSTER_TYPE_PLAIN = 0,
317 Z_EROFS_VLE_CLUSTER_TYPE_HEAD = 1,
318 Z_EROFS_VLE_CLUSTER_TYPE_NONHEAD = 2,
319 Z_EROFS_VLE_CLUSTER_TYPE_RESERVED = 3,
Gao Xiang99691b42018-08-21 22:49:33 +0800320 Z_EROFS_VLE_CLUSTER_TYPE_MAX
321};
322
Gao Xiangaea12862018-07-26 20:21:44 +0800323#define Z_EROFS_VLE_DI_CLUSTER_TYPE_BITS 2
324#define Z_EROFS_VLE_DI_CLUSTER_TYPE_BIT 0
325
Gao Xiang5404c33012021-04-07 12:39:22 +0800326/*
327 * D0_CBLKCNT will be marked _only_ at the 1st non-head lcluster to store the
328 * compressed block count of a compressed extent (in logical clusters, aka.
329 * block count of a pcluster).
330 */
331#define Z_EROFS_VLE_DI_D0_CBLKCNT (1 << 11)
332
Gao Xiangaea12862018-07-26 20:21:44 +0800333struct z_erofs_vle_decompressed_index {
334 __le16 di_advise;
335 /* where to decompress in the head cluster */
336 __le16 di_clusterofs;
337
338 union {
339 /* for the head cluster */
340 __le32 blkaddr;
341 /*
342 * for the rest clusters
343 * eg. for 4k page-sized cluster, maximum 4K*64k = 256M)
344 * [0] - pointing to the head cluster
345 * [1] - pointing to the tail cluster
346 */
347 __le16 delta[2];
Gao Xianged34aa42019-09-04 10:08:51 +0800348 } di_u;
349};
Gao Xiangaea12862018-07-26 20:21:44 +0800350
Gao Xiangec8c2442019-06-24 15:22:51 +0800351#define Z_EROFS_VLE_LEGACY_INDEX_ALIGN(size) \
352 (round_up(size, sizeof(struct z_erofs_vle_decompressed_index)) + \
353 sizeof(struct z_erofs_map_header) + Z_EROFS_VLE_LEGACY_HEADER_PADDING)
Gao Xiangaea12862018-07-26 20:21:44 +0800354
355/* dirent sorts in alphabet order, thus we can do binary search */
356struct erofs_dirent {
Gao Xiang4b66eb52019-09-04 10:08:48 +0800357 __le64 nid; /* node number */
358 __le16 nameoff; /* start offset of file name */
359 __u8 file_type; /* file type */
360 __u8 reserved; /* reserved */
Gao Xiangaea12862018-07-26 20:21:44 +0800361} __packed;
362
Gao Xiang1d819c52019-08-16 15:11:42 +0800363/*
364 * EROFS file types should match generic FT_* types and
365 * it seems no need to add BUILD_BUG_ONs since potential
366 * unmatchness will break other fses as well...
367 */
Gao Xiangaea12862018-07-26 20:21:44 +0800368
369#define EROFS_NAME_LEN 255
370
371/* check the EROFS on-disk layout strictly at compile time */
372static inline void erofs_check_ondisk_layout_definitions(void)
373{
374 BUILD_BUG_ON(sizeof(struct erofs_super_block) != 128);
Gao Xiang8a765682019-09-04 10:08:54 +0800375 BUILD_BUG_ON(sizeof(struct erofs_inode_compact) != 32);
376 BUILD_BUG_ON(sizeof(struct erofs_inode_extended) != 64);
Gao Xiangaea12862018-07-26 20:21:44 +0800377 BUILD_BUG_ON(sizeof(struct erofs_xattr_ibody_header) != 12);
378 BUILD_BUG_ON(sizeof(struct erofs_xattr_entry) != 4);
Gao Xiang2a9dc7a2021-08-20 18:00:18 +0800379 BUILD_BUG_ON(sizeof(struct erofs_inode_chunk_info) != 4);
380 BUILD_BUG_ON(sizeof(struct erofs_inode_chunk_index) != 8);
Gao Xiangec8c2442019-06-24 15:22:51 +0800381 BUILD_BUG_ON(sizeof(struct z_erofs_map_header) != 8);
Gao Xiangaea12862018-07-26 20:21:44 +0800382 BUILD_BUG_ON(sizeof(struct z_erofs_vle_decompressed_index) != 8);
383 BUILD_BUG_ON(sizeof(struct erofs_dirent) != 12);
Gao Xiang2a9dc7a2021-08-20 18:00:18 +0800384 /* keep in sync between 2 index structures for better extendibility */
385 BUILD_BUG_ON(sizeof(struct erofs_inode_chunk_index) !=
386 sizeof(struct z_erofs_vle_decompressed_index));
Gao Xiang99691b42018-08-21 22:49:33 +0800387
388 BUILD_BUG_ON(BIT(Z_EROFS_VLE_DI_CLUSTER_TYPE_BITS) <
389 Z_EROFS_VLE_CLUSTER_TYPE_MAX - 1);
Gao Xiangaea12862018-07-26 20:21:44 +0800390}
391
392#endif