erofs_fs.h (1758047057dbe329be712a31b79db7151b5871f8) erofs_fs.h (ab92184ff8f12979f3d3dd5ed601ed85770d81ba)
1/* SPDX-License-Identifier: GPL-2.0-only OR Apache-2.0 */
2/*
3 * EROFS (Enhanced ROM File System) on-disk format definition
4 *
5 * Copyright (C) 2017-2018 HUAWEI, Inc.
6 * https://www.huawei.com/
7 * Copyright (C) 2021, Alibaba Cloud
8 */
9#ifndef __EROFS_FS_H
10#define __EROFS_FS_H
11
12#define EROFS_SUPER_OFFSET 1024
13
14#define EROFS_FEATURE_COMPAT_SB_CHKSUM 0x00000001
15
16/*
17 * Any bits that aren't in EROFS_ALL_FEATURE_INCOMPAT should
18 * be incompatible with this kernel version.
19 */
1/* SPDX-License-Identifier: GPL-2.0-only OR Apache-2.0 */
2/*
3 * EROFS (Enhanced ROM File System) on-disk format definition
4 *
5 * Copyright (C) 2017-2018 HUAWEI, Inc.
6 * https://www.huawei.com/
7 * Copyright (C) 2021, Alibaba Cloud
8 */
9#ifndef __EROFS_FS_H
10#define __EROFS_FS_H
11
12#define EROFS_SUPER_OFFSET 1024
13
14#define EROFS_FEATURE_COMPAT_SB_CHKSUM 0x00000001
15
16/*
17 * Any bits that aren't in EROFS_ALL_FEATURE_INCOMPAT should
18 * be incompatible with this kernel version.
19 */
20#define EROFS_FEATURE_INCOMPAT_LZ4_0PADDING 0x00000001
20#define EROFS_FEATURE_INCOMPAT_ZERO_PADDING 0x00000001
21#define EROFS_FEATURE_INCOMPAT_COMPR_CFGS 0x00000002
22#define EROFS_FEATURE_INCOMPAT_BIG_PCLUSTER 0x00000002
23#define EROFS_FEATURE_INCOMPAT_CHUNKED_FILE 0x00000004
24#define EROFS_FEATURE_INCOMPAT_DEVICE_TABLE 0x00000008
25#define EROFS_FEATURE_INCOMPAT_COMPR_HEAD2 0x00000008
21#define EROFS_FEATURE_INCOMPAT_COMPR_CFGS 0x00000002
22#define EROFS_FEATURE_INCOMPAT_BIG_PCLUSTER 0x00000002
23#define EROFS_FEATURE_INCOMPAT_CHUNKED_FILE 0x00000004
24#define EROFS_FEATURE_INCOMPAT_DEVICE_TABLE 0x00000008
25#define EROFS_FEATURE_INCOMPAT_COMPR_HEAD2 0x00000008
26#define EROFS_FEATURE_INCOMPAT_ZTAILPACKING 0x00000010
26#define EROFS_ALL_FEATURE_INCOMPAT \
27#define EROFS_ALL_FEATURE_INCOMPAT \
27 (EROFS_FEATURE_INCOMPAT_LZ4_0PADDING | \
28 (EROFS_FEATURE_INCOMPAT_ZERO_PADDING | \
28 EROFS_FEATURE_INCOMPAT_COMPR_CFGS | \
29 EROFS_FEATURE_INCOMPAT_BIG_PCLUSTER | \
30 EROFS_FEATURE_INCOMPAT_CHUNKED_FILE | \
31 EROFS_FEATURE_INCOMPAT_DEVICE_TABLE | \
29 EROFS_FEATURE_INCOMPAT_COMPR_CFGS | \
30 EROFS_FEATURE_INCOMPAT_BIG_PCLUSTER | \
31 EROFS_FEATURE_INCOMPAT_CHUNKED_FILE | \
32 EROFS_FEATURE_INCOMPAT_DEVICE_TABLE | \
32 EROFS_FEATURE_INCOMPAT_COMPR_HEAD2)
33 EROFS_FEATURE_INCOMPAT_COMPR_HEAD2 | \
34 EROFS_FEATURE_INCOMPAT_ZTAILPACKING)
33
34#define EROFS_SB_EXTSLOT_SIZE 16
35
36struct erofs_deviceslot {
37 union {
38 u8 uuid[16]; /* used for device manager later */
39 u8 userdata[64]; /* digest(sha256), etc. */
40 } u;

--- 163 unchanged lines hidden (view full) ---

204 * +-----------------------+
205 * inline xattrs must starts in erofs_xattr_ibody_header,
206 * for read-only fs, no need to introduce h_refcount
207 */
208struct erofs_xattr_ibody_header {
209 __le32 h_reserved;
210 __u8 h_shared_count;
211 __u8 h_reserved2[7];
35
36#define EROFS_SB_EXTSLOT_SIZE 16
37
38struct erofs_deviceslot {
39 union {
40 u8 uuid[16]; /* used for device manager later */
41 u8 userdata[64]; /* digest(sha256), etc. */
42 } u;

--- 163 unchanged lines hidden (view full) ---

206 * +-----------------------+
207 * inline xattrs must starts in erofs_xattr_ibody_header,
208 * for read-only fs, no need to introduce h_refcount
209 */
210struct erofs_xattr_ibody_header {
211 __le32 h_reserved;
212 __u8 h_shared_count;
213 __u8 h_reserved2[7];
212 __le32 h_shared_xattrs[0]; /* shared xattr id array */
214 __le32 h_shared_xattrs[]; /* shared xattr id array */
213};
214
215/* Name indexes */
216#define EROFS_XATTR_INDEX_USER 1
217#define EROFS_XATTR_INDEX_POSIX_ACL_ACCESS 2
218#define EROFS_XATTR_INDEX_POSIX_ACL_DEFAULT 3
219#define EROFS_XATTR_INDEX_TRUSTED 4
220#define EROFS_XATTR_INDEX_LUSTRE 5
221#define EROFS_XATTR_INDEX_SECURITY 6
222
223/* xattr entry (for both inline & shared xattrs) */
224struct erofs_xattr_entry {
225 __u8 e_name_len; /* length of name */
226 __u8 e_name_index; /* attribute name index */
227 __le16 e_value_size; /* size of attribute value */
228 /* followed by e_name and e_value */
215};
216
217/* Name indexes */
218#define EROFS_XATTR_INDEX_USER 1
219#define EROFS_XATTR_INDEX_POSIX_ACL_ACCESS 2
220#define EROFS_XATTR_INDEX_POSIX_ACL_DEFAULT 3
221#define EROFS_XATTR_INDEX_TRUSTED 4
222#define EROFS_XATTR_INDEX_LUSTRE 5
223#define EROFS_XATTR_INDEX_SECURITY 6
224
225/* xattr entry (for both inline & shared xattrs) */
226struct erofs_xattr_entry {
227 __u8 e_name_len; /* length of name */
228 __u8 e_name_index; /* attribute name index */
229 __le16 e_value_size; /* size of attribute value */
230 /* followed by e_name and e_value */
229 char e_name[0]; /* attribute name */
231 char e_name[]; /* attribute name */
230};
231
232static inline unsigned int erofs_xattr_ibody_size(__le16 i_xattr_icount)
233{
234 if (!i_xattr_icount)
235 return 0;
236
237 return sizeof(struct erofs_xattr_ibody_header) +

--- 49 unchanged lines hidden (view full) ---

287#define Z_EROFS_LZMA_MAX_DICT_SIZE (8 * Z_EROFS_PCLUSTER_MAX_SIZE)
288
289/*
290 * bit 0 : COMPACTED_2B indexes (0 - off; 1 - on)
291 * e.g. for 4k logical cluster size, 4B if compacted 2B is off;
292 * (4B) + 2B + (4B) if compacted 2B is on.
293 * bit 1 : HEAD1 big pcluster (0 - off; 1 - on)
294 * bit 2 : HEAD2 big pcluster (0 - off; 1 - on)
232};
233
234static inline unsigned int erofs_xattr_ibody_size(__le16 i_xattr_icount)
235{
236 if (!i_xattr_icount)
237 return 0;
238
239 return sizeof(struct erofs_xattr_ibody_header) +

--- 49 unchanged lines hidden (view full) ---

289#define Z_EROFS_LZMA_MAX_DICT_SIZE (8 * Z_EROFS_PCLUSTER_MAX_SIZE)
290
291/*
292 * bit 0 : COMPACTED_2B indexes (0 - off; 1 - on)
293 * e.g. for 4k logical cluster size, 4B if compacted 2B is off;
294 * (4B) + 2B + (4B) if compacted 2B is on.
295 * bit 1 : HEAD1 big pcluster (0 - off; 1 - on)
296 * bit 2 : HEAD2 big pcluster (0 - off; 1 - on)
297 * bit 3 : tailpacking inline pcluster (0 - off; 1 - on)
295 */
296#define Z_EROFS_ADVISE_COMPACTED_2B 0x0001
297#define Z_EROFS_ADVISE_BIG_PCLUSTER_1 0x0002
298#define Z_EROFS_ADVISE_BIG_PCLUSTER_2 0x0004
298 */
299#define Z_EROFS_ADVISE_COMPACTED_2B 0x0001
300#define Z_EROFS_ADVISE_BIG_PCLUSTER_1 0x0002
301#define Z_EROFS_ADVISE_BIG_PCLUSTER_2 0x0004
302#define Z_EROFS_ADVISE_INLINE_PCLUSTER 0x0008
299
300struct z_erofs_map_header {
303
304struct z_erofs_map_header {
301 __le32 h_reserved1;
305 __le16 h_reserved1;
306 /* indicates the encoded size of tailpacking data */
307 __le16 h_idata_size;
302 __le16 h_advise;
303 /*
304 * bit 0-3 : algorithm type of head 1 (logical cluster type 01);
305 * bit 4-7 : algorithm type of head 2 (logical cluster type 11).
306 */
307 __u8 h_algorithmtype;
308 /*
309 * bit 0-2 : logical cluster bits - 12, e.g. 0 for 4096;

--- 110 unchanged lines hidden ---
308 __le16 h_advise;
309 /*
310 * bit 0-3 : algorithm type of head 1 (logical cluster type 01);
311 * bit 4-7 : algorithm type of head 2 (logical cluster type 11).
312 */
313 __u8 h_algorithmtype;
314 /*
315 * bit 0-2 : logical cluster bits - 12, e.g. 0 for 4096;

--- 110 unchanged lines hidden ---