18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
28c2ecf20Sopenharmony_ci#ifndef SQUASHFS_FS
38c2ecf20Sopenharmony_ci#define SQUASHFS_FS
48c2ecf20Sopenharmony_ci/*
58c2ecf20Sopenharmony_ci * Squashfs
68c2ecf20Sopenharmony_ci *
78c2ecf20Sopenharmony_ci * Copyright (c) 2002, 2003, 2004, 2005, 2006, 2007, 2008
88c2ecf20Sopenharmony_ci * Phillip Lougher <phillip@squashfs.org.uk>
98c2ecf20Sopenharmony_ci *
108c2ecf20Sopenharmony_ci * squashfs_fs.h
118c2ecf20Sopenharmony_ci */
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ci#define SQUASHFS_CACHED_FRAGMENTS	CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE
148c2ecf20Sopenharmony_ci#define SQUASHFS_MAJOR			4
158c2ecf20Sopenharmony_ci#define SQUASHFS_MINOR			0
168c2ecf20Sopenharmony_ci#define SQUASHFS_START			0
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci/* size of metadata (inode and directory) blocks */
198c2ecf20Sopenharmony_ci#define SQUASHFS_METADATA_SIZE		8192
208c2ecf20Sopenharmony_ci#define SQUASHFS_BLOCK_OFFSET		2
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ci/* default size of block device I/O */
238c2ecf20Sopenharmony_ci#ifdef CONFIG_SQUASHFS_4K_DEVBLK_SIZE
248c2ecf20Sopenharmony_ci#define SQUASHFS_DEVBLK_SIZE 4096
258c2ecf20Sopenharmony_ci#else
268c2ecf20Sopenharmony_ci#define SQUASHFS_DEVBLK_SIZE 1024
278c2ecf20Sopenharmony_ci#endif
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ci#define SQUASHFS_FILE_MAX_SIZE		1048576
308c2ecf20Sopenharmony_ci#define SQUASHFS_FILE_MAX_LOG		20
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ci/* Max length of filename (not 255) */
338c2ecf20Sopenharmony_ci#define SQUASHFS_NAME_LEN		256
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ci/* Max value for directory header count*/
368c2ecf20Sopenharmony_ci#define SQUASHFS_DIR_COUNT		256
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_ci#define SQUASHFS_INVALID_FRAG		(0xffffffffU)
398c2ecf20Sopenharmony_ci#define SQUASHFS_INVALID_XATTR		(0xffffffffU)
408c2ecf20Sopenharmony_ci#define SQUASHFS_INVALID_BLK		(-1LL)
418c2ecf20Sopenharmony_ci
428c2ecf20Sopenharmony_ci/* Filesystem flags */
438c2ecf20Sopenharmony_ci#define SQUASHFS_NOI			0
448c2ecf20Sopenharmony_ci#define SQUASHFS_NOD			1
458c2ecf20Sopenharmony_ci#define SQUASHFS_NOF			3
468c2ecf20Sopenharmony_ci#define SQUASHFS_NO_FRAG		4
478c2ecf20Sopenharmony_ci#define SQUASHFS_ALWAYS_FRAG		5
488c2ecf20Sopenharmony_ci#define SQUASHFS_DUPLICATE		6
498c2ecf20Sopenharmony_ci#define SQUASHFS_EXPORT			7
508c2ecf20Sopenharmony_ci#define SQUASHFS_COMP_OPT		10
518c2ecf20Sopenharmony_ci
528c2ecf20Sopenharmony_ci#define SQUASHFS_BIT(flag, bit)		((flag >> bit) & 1)
538c2ecf20Sopenharmony_ci
548c2ecf20Sopenharmony_ci#define SQUASHFS_UNCOMPRESSED_INODES(flags)	SQUASHFS_BIT(flags, \
558c2ecf20Sopenharmony_ci						SQUASHFS_NOI)
568c2ecf20Sopenharmony_ci
578c2ecf20Sopenharmony_ci#define SQUASHFS_UNCOMPRESSED_DATA(flags)	SQUASHFS_BIT(flags, \
588c2ecf20Sopenharmony_ci						SQUASHFS_NOD)
598c2ecf20Sopenharmony_ci
608c2ecf20Sopenharmony_ci#define SQUASHFS_UNCOMPRESSED_FRAGMENTS(flags)	SQUASHFS_BIT(flags, \
618c2ecf20Sopenharmony_ci						SQUASHFS_NOF)
628c2ecf20Sopenharmony_ci
638c2ecf20Sopenharmony_ci#define SQUASHFS_NO_FRAGMENTS(flags)		SQUASHFS_BIT(flags, \
648c2ecf20Sopenharmony_ci						SQUASHFS_NO_FRAG)
658c2ecf20Sopenharmony_ci
668c2ecf20Sopenharmony_ci#define SQUASHFS_ALWAYS_FRAGMENTS(flags)	SQUASHFS_BIT(flags, \
678c2ecf20Sopenharmony_ci						SQUASHFS_ALWAYS_FRAG)
688c2ecf20Sopenharmony_ci
698c2ecf20Sopenharmony_ci#define SQUASHFS_DUPLICATES(flags)		SQUASHFS_BIT(flags, \
708c2ecf20Sopenharmony_ci						SQUASHFS_DUPLICATE)
718c2ecf20Sopenharmony_ci
728c2ecf20Sopenharmony_ci#define SQUASHFS_EXPORTABLE(flags)		SQUASHFS_BIT(flags, \
738c2ecf20Sopenharmony_ci						SQUASHFS_EXPORT)
748c2ecf20Sopenharmony_ci
758c2ecf20Sopenharmony_ci#define SQUASHFS_COMP_OPTS(flags)		SQUASHFS_BIT(flags, \
768c2ecf20Sopenharmony_ci						SQUASHFS_COMP_OPT)
778c2ecf20Sopenharmony_ci
788c2ecf20Sopenharmony_ci/* Inode types including extended types */
798c2ecf20Sopenharmony_ci#define SQUASHFS_DIR_TYPE		1
808c2ecf20Sopenharmony_ci#define SQUASHFS_REG_TYPE		2
818c2ecf20Sopenharmony_ci#define SQUASHFS_SYMLINK_TYPE		3
828c2ecf20Sopenharmony_ci#define SQUASHFS_BLKDEV_TYPE		4
838c2ecf20Sopenharmony_ci#define SQUASHFS_CHRDEV_TYPE		5
848c2ecf20Sopenharmony_ci#define SQUASHFS_FIFO_TYPE		6
858c2ecf20Sopenharmony_ci#define SQUASHFS_SOCKET_TYPE		7
868c2ecf20Sopenharmony_ci#define SQUASHFS_LDIR_TYPE		8
878c2ecf20Sopenharmony_ci#define SQUASHFS_LREG_TYPE		9
888c2ecf20Sopenharmony_ci#define SQUASHFS_LSYMLINK_TYPE		10
898c2ecf20Sopenharmony_ci#define SQUASHFS_LBLKDEV_TYPE		11
908c2ecf20Sopenharmony_ci#define SQUASHFS_LCHRDEV_TYPE		12
918c2ecf20Sopenharmony_ci#define SQUASHFS_LFIFO_TYPE		13
928c2ecf20Sopenharmony_ci#define SQUASHFS_LSOCKET_TYPE		14
938c2ecf20Sopenharmony_ci
948c2ecf20Sopenharmony_ci/* Max type value stored in directory entry */
958c2ecf20Sopenharmony_ci#define SQUASHFS_MAX_DIR_TYPE		7
968c2ecf20Sopenharmony_ci
978c2ecf20Sopenharmony_ci/* Xattr types */
988c2ecf20Sopenharmony_ci#define SQUASHFS_XATTR_USER             0
998c2ecf20Sopenharmony_ci#define SQUASHFS_XATTR_TRUSTED          1
1008c2ecf20Sopenharmony_ci#define SQUASHFS_XATTR_SECURITY         2
1018c2ecf20Sopenharmony_ci#define SQUASHFS_XATTR_VALUE_OOL        256
1028c2ecf20Sopenharmony_ci#define SQUASHFS_XATTR_PREFIX_MASK      0xff
1038c2ecf20Sopenharmony_ci
1048c2ecf20Sopenharmony_ci/* Flag whether block is compressed or uncompressed, bit is set if block is
1058c2ecf20Sopenharmony_ci * uncompressed */
1068c2ecf20Sopenharmony_ci#define SQUASHFS_COMPRESSED_BIT		(1 << 15)
1078c2ecf20Sopenharmony_ci
1088c2ecf20Sopenharmony_ci#define SQUASHFS_COMPRESSED_SIZE(B)	(((B) & ~SQUASHFS_COMPRESSED_BIT) ? \
1098c2ecf20Sopenharmony_ci		(B) & ~SQUASHFS_COMPRESSED_BIT :  SQUASHFS_COMPRESSED_BIT)
1108c2ecf20Sopenharmony_ci
1118c2ecf20Sopenharmony_ci#define SQUASHFS_COMPRESSED(B)		(!((B) & SQUASHFS_COMPRESSED_BIT))
1128c2ecf20Sopenharmony_ci
1138c2ecf20Sopenharmony_ci#define SQUASHFS_COMPRESSED_BIT_BLOCK	(1 << 24)
1148c2ecf20Sopenharmony_ci
1158c2ecf20Sopenharmony_ci#define SQUASHFS_COMPRESSED_SIZE_BLOCK(B)	((B) & \
1168c2ecf20Sopenharmony_ci						~SQUASHFS_COMPRESSED_BIT_BLOCK)
1178c2ecf20Sopenharmony_ci
1188c2ecf20Sopenharmony_ci#define SQUASHFS_COMPRESSED_BLOCK(B)	(!((B) & SQUASHFS_COMPRESSED_BIT_BLOCK))
1198c2ecf20Sopenharmony_ci
1208c2ecf20Sopenharmony_cistatic inline int squashfs_block_size(__le32 raw)
1218c2ecf20Sopenharmony_ci{
1228c2ecf20Sopenharmony_ci	u32 size = le32_to_cpu(raw);
1238c2ecf20Sopenharmony_ci	return (size >> 25) ? -EIO : size;
1248c2ecf20Sopenharmony_ci}
1258c2ecf20Sopenharmony_ci
1268c2ecf20Sopenharmony_ci/*
1278c2ecf20Sopenharmony_ci * Inode number ops.  Inodes consist of a compressed block number, and an
1288c2ecf20Sopenharmony_ci * uncompressed offset within that block
1298c2ecf20Sopenharmony_ci */
1308c2ecf20Sopenharmony_ci#define SQUASHFS_INODE_BLK(A)		((unsigned int) ((A) >> 16))
1318c2ecf20Sopenharmony_ci
1328c2ecf20Sopenharmony_ci#define SQUASHFS_INODE_OFFSET(A)	((unsigned int) ((A) & 0xffff))
1338c2ecf20Sopenharmony_ci
1348c2ecf20Sopenharmony_ci#define SQUASHFS_MKINODE(A, B)		((long long)(((long long) (A)\
1358c2ecf20Sopenharmony_ci					<< 16) + (B)))
1368c2ecf20Sopenharmony_ci
1378c2ecf20Sopenharmony_ci/* fragment and fragment table defines */
1388c2ecf20Sopenharmony_ci#define SQUASHFS_FRAGMENT_BYTES(A)	\
1398c2ecf20Sopenharmony_ci				((A) * sizeof(struct squashfs_fragment_entry))
1408c2ecf20Sopenharmony_ci
1418c2ecf20Sopenharmony_ci#define SQUASHFS_FRAGMENT_INDEX(A)	(SQUASHFS_FRAGMENT_BYTES(A) / \
1428c2ecf20Sopenharmony_ci					SQUASHFS_METADATA_SIZE)
1438c2ecf20Sopenharmony_ci
1448c2ecf20Sopenharmony_ci#define SQUASHFS_FRAGMENT_INDEX_OFFSET(A)	(SQUASHFS_FRAGMENT_BYTES(A) % \
1458c2ecf20Sopenharmony_ci						SQUASHFS_METADATA_SIZE)
1468c2ecf20Sopenharmony_ci
1478c2ecf20Sopenharmony_ci#define SQUASHFS_FRAGMENT_INDEXES(A)	((SQUASHFS_FRAGMENT_BYTES(A) + \
1488c2ecf20Sopenharmony_ci					SQUASHFS_METADATA_SIZE - 1) / \
1498c2ecf20Sopenharmony_ci					SQUASHFS_METADATA_SIZE)
1508c2ecf20Sopenharmony_ci
1518c2ecf20Sopenharmony_ci#define SQUASHFS_FRAGMENT_INDEX_BYTES(A)	(SQUASHFS_FRAGMENT_INDEXES(A) *\
1528c2ecf20Sopenharmony_ci						sizeof(u64))
1538c2ecf20Sopenharmony_ci
1548c2ecf20Sopenharmony_ci/* inode lookup table defines */
1558c2ecf20Sopenharmony_ci#define SQUASHFS_LOOKUP_BYTES(A)	((A) * sizeof(u64))
1568c2ecf20Sopenharmony_ci
1578c2ecf20Sopenharmony_ci#define SQUASHFS_LOOKUP_BLOCK(A)	(SQUASHFS_LOOKUP_BYTES(A) / \
1588c2ecf20Sopenharmony_ci					SQUASHFS_METADATA_SIZE)
1598c2ecf20Sopenharmony_ci
1608c2ecf20Sopenharmony_ci#define SQUASHFS_LOOKUP_BLOCK_OFFSET(A)	(SQUASHFS_LOOKUP_BYTES(A) % \
1618c2ecf20Sopenharmony_ci					SQUASHFS_METADATA_SIZE)
1628c2ecf20Sopenharmony_ci
1638c2ecf20Sopenharmony_ci#define SQUASHFS_LOOKUP_BLOCKS(A)	((SQUASHFS_LOOKUP_BYTES(A) + \
1648c2ecf20Sopenharmony_ci					SQUASHFS_METADATA_SIZE - 1) / \
1658c2ecf20Sopenharmony_ci					SQUASHFS_METADATA_SIZE)
1668c2ecf20Sopenharmony_ci
1678c2ecf20Sopenharmony_ci#define SQUASHFS_LOOKUP_BLOCK_BYTES(A)	(SQUASHFS_LOOKUP_BLOCKS(A) *\
1688c2ecf20Sopenharmony_ci					sizeof(u64))
1698c2ecf20Sopenharmony_ci
1708c2ecf20Sopenharmony_ci/* uid/gid lookup table defines */
1718c2ecf20Sopenharmony_ci#define SQUASHFS_ID_BYTES(A)		((A) * sizeof(unsigned int))
1728c2ecf20Sopenharmony_ci
1738c2ecf20Sopenharmony_ci#define SQUASHFS_ID_BLOCK(A)		(SQUASHFS_ID_BYTES(A) / \
1748c2ecf20Sopenharmony_ci					SQUASHFS_METADATA_SIZE)
1758c2ecf20Sopenharmony_ci
1768c2ecf20Sopenharmony_ci#define SQUASHFS_ID_BLOCK_OFFSET(A)	(SQUASHFS_ID_BYTES(A) % \
1778c2ecf20Sopenharmony_ci					SQUASHFS_METADATA_SIZE)
1788c2ecf20Sopenharmony_ci
1798c2ecf20Sopenharmony_ci#define SQUASHFS_ID_BLOCKS(A)		((SQUASHFS_ID_BYTES(A) + \
1808c2ecf20Sopenharmony_ci					SQUASHFS_METADATA_SIZE - 1) / \
1818c2ecf20Sopenharmony_ci					SQUASHFS_METADATA_SIZE)
1828c2ecf20Sopenharmony_ci
1838c2ecf20Sopenharmony_ci#define SQUASHFS_ID_BLOCK_BYTES(A)	(SQUASHFS_ID_BLOCKS(A) *\
1848c2ecf20Sopenharmony_ci					sizeof(u64))
1858c2ecf20Sopenharmony_ci/* xattr id lookup table defines */
1868c2ecf20Sopenharmony_ci#define SQUASHFS_XATTR_BYTES(A)		(((u64) (A)) * sizeof(struct squashfs_xattr_id))
1878c2ecf20Sopenharmony_ci
1888c2ecf20Sopenharmony_ci#define SQUASHFS_XATTR_BLOCK(A)		(SQUASHFS_XATTR_BYTES(A) / \
1898c2ecf20Sopenharmony_ci					SQUASHFS_METADATA_SIZE)
1908c2ecf20Sopenharmony_ci
1918c2ecf20Sopenharmony_ci#define SQUASHFS_XATTR_BLOCK_OFFSET(A)	(SQUASHFS_XATTR_BYTES(A) % \
1928c2ecf20Sopenharmony_ci					SQUASHFS_METADATA_SIZE)
1938c2ecf20Sopenharmony_ci
1948c2ecf20Sopenharmony_ci#define SQUASHFS_XATTR_BLOCKS(A)	((SQUASHFS_XATTR_BYTES(A) + \
1958c2ecf20Sopenharmony_ci					SQUASHFS_METADATA_SIZE - 1) / \
1968c2ecf20Sopenharmony_ci					SQUASHFS_METADATA_SIZE)
1978c2ecf20Sopenharmony_ci
1988c2ecf20Sopenharmony_ci#define SQUASHFS_XATTR_BLOCK_BYTES(A)	(SQUASHFS_XATTR_BLOCKS(A) *\
1998c2ecf20Sopenharmony_ci					sizeof(u64))
2008c2ecf20Sopenharmony_ci#define SQUASHFS_XATTR_BLK(A)		((unsigned int) ((A) >> 16))
2018c2ecf20Sopenharmony_ci
2028c2ecf20Sopenharmony_ci#define SQUASHFS_XATTR_OFFSET(A)	((unsigned int) ((A) & 0xffff))
2038c2ecf20Sopenharmony_ci
2048c2ecf20Sopenharmony_ci/* cached data constants for filesystem */
2058c2ecf20Sopenharmony_ci#define SQUASHFS_CACHED_BLKS		8
2068c2ecf20Sopenharmony_ci
2078c2ecf20Sopenharmony_ci/* meta index cache */
2088c2ecf20Sopenharmony_ci#define SQUASHFS_META_INDEXES	(SQUASHFS_METADATA_SIZE / sizeof(unsigned int))
2098c2ecf20Sopenharmony_ci#define SQUASHFS_META_ENTRIES	127
2108c2ecf20Sopenharmony_ci#define SQUASHFS_META_SLOTS	8
2118c2ecf20Sopenharmony_ci
2128c2ecf20Sopenharmony_cistruct meta_entry {
2138c2ecf20Sopenharmony_ci	u64			data_block;
2148c2ecf20Sopenharmony_ci	unsigned int		index_block;
2158c2ecf20Sopenharmony_ci	unsigned short		offset;
2168c2ecf20Sopenharmony_ci	unsigned short		pad;
2178c2ecf20Sopenharmony_ci};
2188c2ecf20Sopenharmony_ci
2198c2ecf20Sopenharmony_cistruct meta_index {
2208c2ecf20Sopenharmony_ci	unsigned int		inode_number;
2218c2ecf20Sopenharmony_ci	unsigned int		offset;
2228c2ecf20Sopenharmony_ci	unsigned short		entries;
2238c2ecf20Sopenharmony_ci	unsigned short		skip;
2248c2ecf20Sopenharmony_ci	unsigned short		locked;
2258c2ecf20Sopenharmony_ci	unsigned short		pad;
2268c2ecf20Sopenharmony_ci	struct meta_entry	meta_entry[SQUASHFS_META_ENTRIES];
2278c2ecf20Sopenharmony_ci};
2288c2ecf20Sopenharmony_ci
2298c2ecf20Sopenharmony_ci
2308c2ecf20Sopenharmony_ci/*
2318c2ecf20Sopenharmony_ci * definitions for structures on disk
2328c2ecf20Sopenharmony_ci */
2338c2ecf20Sopenharmony_ci#define ZLIB_COMPRESSION	1
2348c2ecf20Sopenharmony_ci#define LZMA_COMPRESSION	2
2358c2ecf20Sopenharmony_ci#define LZO_COMPRESSION		3
2368c2ecf20Sopenharmony_ci#define XZ_COMPRESSION		4
2378c2ecf20Sopenharmony_ci#define LZ4_COMPRESSION		5
2388c2ecf20Sopenharmony_ci#define ZSTD_COMPRESSION	6
2398c2ecf20Sopenharmony_ci
2408c2ecf20Sopenharmony_cistruct squashfs_super_block {
2418c2ecf20Sopenharmony_ci	__le32			s_magic;
2428c2ecf20Sopenharmony_ci	__le32			inodes;
2438c2ecf20Sopenharmony_ci	__le32			mkfs_time;
2448c2ecf20Sopenharmony_ci	__le32			block_size;
2458c2ecf20Sopenharmony_ci	__le32			fragments;
2468c2ecf20Sopenharmony_ci	__le16			compression;
2478c2ecf20Sopenharmony_ci	__le16			block_log;
2488c2ecf20Sopenharmony_ci	__le16			flags;
2498c2ecf20Sopenharmony_ci	__le16			no_ids;
2508c2ecf20Sopenharmony_ci	__le16			s_major;
2518c2ecf20Sopenharmony_ci	__le16			s_minor;
2528c2ecf20Sopenharmony_ci	__le64			root_inode;
2538c2ecf20Sopenharmony_ci	__le64			bytes_used;
2548c2ecf20Sopenharmony_ci	__le64			id_table_start;
2558c2ecf20Sopenharmony_ci	__le64			xattr_id_table_start;
2568c2ecf20Sopenharmony_ci	__le64			inode_table_start;
2578c2ecf20Sopenharmony_ci	__le64			directory_table_start;
2588c2ecf20Sopenharmony_ci	__le64			fragment_table_start;
2598c2ecf20Sopenharmony_ci	__le64			lookup_table_start;
2608c2ecf20Sopenharmony_ci};
2618c2ecf20Sopenharmony_ci
2628c2ecf20Sopenharmony_cistruct squashfs_dir_index {
2638c2ecf20Sopenharmony_ci	__le32			index;
2648c2ecf20Sopenharmony_ci	__le32			start_block;
2658c2ecf20Sopenharmony_ci	__le32			size;
2668c2ecf20Sopenharmony_ci	unsigned char		name[];
2678c2ecf20Sopenharmony_ci};
2688c2ecf20Sopenharmony_ci
2698c2ecf20Sopenharmony_cistruct squashfs_base_inode {
2708c2ecf20Sopenharmony_ci	__le16			inode_type;
2718c2ecf20Sopenharmony_ci	__le16			mode;
2728c2ecf20Sopenharmony_ci	__le16			uid;
2738c2ecf20Sopenharmony_ci	__le16			guid;
2748c2ecf20Sopenharmony_ci	__le32			mtime;
2758c2ecf20Sopenharmony_ci	__le32			inode_number;
2768c2ecf20Sopenharmony_ci};
2778c2ecf20Sopenharmony_ci
2788c2ecf20Sopenharmony_cistruct squashfs_ipc_inode {
2798c2ecf20Sopenharmony_ci	__le16			inode_type;
2808c2ecf20Sopenharmony_ci	__le16			mode;
2818c2ecf20Sopenharmony_ci	__le16			uid;
2828c2ecf20Sopenharmony_ci	__le16			guid;
2838c2ecf20Sopenharmony_ci	__le32			mtime;
2848c2ecf20Sopenharmony_ci	__le32			inode_number;
2858c2ecf20Sopenharmony_ci	__le32			nlink;
2868c2ecf20Sopenharmony_ci};
2878c2ecf20Sopenharmony_ci
2888c2ecf20Sopenharmony_cistruct squashfs_lipc_inode {
2898c2ecf20Sopenharmony_ci	__le16			inode_type;
2908c2ecf20Sopenharmony_ci	__le16			mode;
2918c2ecf20Sopenharmony_ci	__le16			uid;
2928c2ecf20Sopenharmony_ci	__le16			guid;
2938c2ecf20Sopenharmony_ci	__le32			mtime;
2948c2ecf20Sopenharmony_ci	__le32			inode_number;
2958c2ecf20Sopenharmony_ci	__le32			nlink;
2968c2ecf20Sopenharmony_ci	__le32			xattr;
2978c2ecf20Sopenharmony_ci};
2988c2ecf20Sopenharmony_ci
2998c2ecf20Sopenharmony_cistruct squashfs_dev_inode {
3008c2ecf20Sopenharmony_ci	__le16			inode_type;
3018c2ecf20Sopenharmony_ci	__le16			mode;
3028c2ecf20Sopenharmony_ci	__le16			uid;
3038c2ecf20Sopenharmony_ci	__le16			guid;
3048c2ecf20Sopenharmony_ci	__le32			mtime;
3058c2ecf20Sopenharmony_ci	__le32			inode_number;
3068c2ecf20Sopenharmony_ci	__le32			nlink;
3078c2ecf20Sopenharmony_ci	__le32			rdev;
3088c2ecf20Sopenharmony_ci};
3098c2ecf20Sopenharmony_ci
3108c2ecf20Sopenharmony_cistruct squashfs_ldev_inode {
3118c2ecf20Sopenharmony_ci	__le16			inode_type;
3128c2ecf20Sopenharmony_ci	__le16			mode;
3138c2ecf20Sopenharmony_ci	__le16			uid;
3148c2ecf20Sopenharmony_ci	__le16			guid;
3158c2ecf20Sopenharmony_ci	__le32			mtime;
3168c2ecf20Sopenharmony_ci	__le32			inode_number;
3178c2ecf20Sopenharmony_ci	__le32			nlink;
3188c2ecf20Sopenharmony_ci	__le32			rdev;
3198c2ecf20Sopenharmony_ci	__le32			xattr;
3208c2ecf20Sopenharmony_ci};
3218c2ecf20Sopenharmony_ci
3228c2ecf20Sopenharmony_cistruct squashfs_symlink_inode {
3238c2ecf20Sopenharmony_ci	__le16			inode_type;
3248c2ecf20Sopenharmony_ci	__le16			mode;
3258c2ecf20Sopenharmony_ci	__le16			uid;
3268c2ecf20Sopenharmony_ci	__le16			guid;
3278c2ecf20Sopenharmony_ci	__le32			mtime;
3288c2ecf20Sopenharmony_ci	__le32			inode_number;
3298c2ecf20Sopenharmony_ci	__le32			nlink;
3308c2ecf20Sopenharmony_ci	__le32			symlink_size;
3318c2ecf20Sopenharmony_ci	char			symlink[];
3328c2ecf20Sopenharmony_ci};
3338c2ecf20Sopenharmony_ci
3348c2ecf20Sopenharmony_cistruct squashfs_reg_inode {
3358c2ecf20Sopenharmony_ci	__le16			inode_type;
3368c2ecf20Sopenharmony_ci	__le16			mode;
3378c2ecf20Sopenharmony_ci	__le16			uid;
3388c2ecf20Sopenharmony_ci	__le16			guid;
3398c2ecf20Sopenharmony_ci	__le32			mtime;
3408c2ecf20Sopenharmony_ci	__le32			inode_number;
3418c2ecf20Sopenharmony_ci	__le32			start_block;
3428c2ecf20Sopenharmony_ci	__le32			fragment;
3438c2ecf20Sopenharmony_ci	__le32			offset;
3448c2ecf20Sopenharmony_ci	__le32			file_size;
3458c2ecf20Sopenharmony_ci	__le16			block_list[];
3468c2ecf20Sopenharmony_ci};
3478c2ecf20Sopenharmony_ci
3488c2ecf20Sopenharmony_cistruct squashfs_lreg_inode {
3498c2ecf20Sopenharmony_ci	__le16			inode_type;
3508c2ecf20Sopenharmony_ci	__le16			mode;
3518c2ecf20Sopenharmony_ci	__le16			uid;
3528c2ecf20Sopenharmony_ci	__le16			guid;
3538c2ecf20Sopenharmony_ci	__le32			mtime;
3548c2ecf20Sopenharmony_ci	__le32			inode_number;
3558c2ecf20Sopenharmony_ci	__le64			start_block;
3568c2ecf20Sopenharmony_ci	__le64			file_size;
3578c2ecf20Sopenharmony_ci	__le64			sparse;
3588c2ecf20Sopenharmony_ci	__le32			nlink;
3598c2ecf20Sopenharmony_ci	__le32			fragment;
3608c2ecf20Sopenharmony_ci	__le32			offset;
3618c2ecf20Sopenharmony_ci	__le32			xattr;
3628c2ecf20Sopenharmony_ci	__le16			block_list[];
3638c2ecf20Sopenharmony_ci};
3648c2ecf20Sopenharmony_ci
3658c2ecf20Sopenharmony_cistruct squashfs_dir_inode {
3668c2ecf20Sopenharmony_ci	__le16			inode_type;
3678c2ecf20Sopenharmony_ci	__le16			mode;
3688c2ecf20Sopenharmony_ci	__le16			uid;
3698c2ecf20Sopenharmony_ci	__le16			guid;
3708c2ecf20Sopenharmony_ci	__le32			mtime;
3718c2ecf20Sopenharmony_ci	__le32			inode_number;
3728c2ecf20Sopenharmony_ci	__le32			start_block;
3738c2ecf20Sopenharmony_ci	__le32			nlink;
3748c2ecf20Sopenharmony_ci	__le16			file_size;
3758c2ecf20Sopenharmony_ci	__le16			offset;
3768c2ecf20Sopenharmony_ci	__le32			parent_inode;
3778c2ecf20Sopenharmony_ci};
3788c2ecf20Sopenharmony_ci
3798c2ecf20Sopenharmony_cistruct squashfs_ldir_inode {
3808c2ecf20Sopenharmony_ci	__le16			inode_type;
3818c2ecf20Sopenharmony_ci	__le16			mode;
3828c2ecf20Sopenharmony_ci	__le16			uid;
3838c2ecf20Sopenharmony_ci	__le16			guid;
3848c2ecf20Sopenharmony_ci	__le32			mtime;
3858c2ecf20Sopenharmony_ci	__le32			inode_number;
3868c2ecf20Sopenharmony_ci	__le32			nlink;
3878c2ecf20Sopenharmony_ci	__le32			file_size;
3888c2ecf20Sopenharmony_ci	__le32			start_block;
3898c2ecf20Sopenharmony_ci	__le32			parent_inode;
3908c2ecf20Sopenharmony_ci	__le16			i_count;
3918c2ecf20Sopenharmony_ci	__le16			offset;
3928c2ecf20Sopenharmony_ci	__le32			xattr;
3938c2ecf20Sopenharmony_ci	struct squashfs_dir_index	index[];
3948c2ecf20Sopenharmony_ci};
3958c2ecf20Sopenharmony_ci
3968c2ecf20Sopenharmony_ciunion squashfs_inode {
3978c2ecf20Sopenharmony_ci	struct squashfs_base_inode		base;
3988c2ecf20Sopenharmony_ci	struct squashfs_dev_inode		dev;
3998c2ecf20Sopenharmony_ci	struct squashfs_ldev_inode		ldev;
4008c2ecf20Sopenharmony_ci	struct squashfs_symlink_inode		symlink;
4018c2ecf20Sopenharmony_ci	struct squashfs_reg_inode		reg;
4028c2ecf20Sopenharmony_ci	struct squashfs_lreg_inode		lreg;
4038c2ecf20Sopenharmony_ci	struct squashfs_dir_inode		dir;
4048c2ecf20Sopenharmony_ci	struct squashfs_ldir_inode		ldir;
4058c2ecf20Sopenharmony_ci	struct squashfs_ipc_inode		ipc;
4068c2ecf20Sopenharmony_ci	struct squashfs_lipc_inode		lipc;
4078c2ecf20Sopenharmony_ci};
4088c2ecf20Sopenharmony_ci
4098c2ecf20Sopenharmony_cistruct squashfs_dir_entry {
4108c2ecf20Sopenharmony_ci	__le16			offset;
4118c2ecf20Sopenharmony_ci	__le16			inode_number;
4128c2ecf20Sopenharmony_ci	__le16			type;
4138c2ecf20Sopenharmony_ci	__le16			size;
4148c2ecf20Sopenharmony_ci	char			name[];
4158c2ecf20Sopenharmony_ci};
4168c2ecf20Sopenharmony_ci
4178c2ecf20Sopenharmony_cistruct squashfs_dir_header {
4188c2ecf20Sopenharmony_ci	__le32			count;
4198c2ecf20Sopenharmony_ci	__le32			start_block;
4208c2ecf20Sopenharmony_ci	__le32			inode_number;
4218c2ecf20Sopenharmony_ci};
4228c2ecf20Sopenharmony_ci
4238c2ecf20Sopenharmony_cistruct squashfs_fragment_entry {
4248c2ecf20Sopenharmony_ci	__le64			start_block;
4258c2ecf20Sopenharmony_ci	__le32			size;
4268c2ecf20Sopenharmony_ci	unsigned int		unused;
4278c2ecf20Sopenharmony_ci};
4288c2ecf20Sopenharmony_ci
4298c2ecf20Sopenharmony_cistruct squashfs_xattr_entry {
4308c2ecf20Sopenharmony_ci	__le16			type;
4318c2ecf20Sopenharmony_ci	__le16			size;
4328c2ecf20Sopenharmony_ci	char			data[];
4338c2ecf20Sopenharmony_ci};
4348c2ecf20Sopenharmony_ci
4358c2ecf20Sopenharmony_cistruct squashfs_xattr_val {
4368c2ecf20Sopenharmony_ci	__le32			vsize;
4378c2ecf20Sopenharmony_ci	char			value[];
4388c2ecf20Sopenharmony_ci};
4398c2ecf20Sopenharmony_ci
4408c2ecf20Sopenharmony_cistruct squashfs_xattr_id {
4418c2ecf20Sopenharmony_ci	__le64			xattr;
4428c2ecf20Sopenharmony_ci	__le32			count;
4438c2ecf20Sopenharmony_ci	__le32			size;
4448c2ecf20Sopenharmony_ci};
4458c2ecf20Sopenharmony_ci
4468c2ecf20Sopenharmony_cistruct squashfs_xattr_id_table {
4478c2ecf20Sopenharmony_ci	__le64			xattr_table_start;
4488c2ecf20Sopenharmony_ci	__le32			xattr_ids;
4498c2ecf20Sopenharmony_ci	__le32			unused;
4508c2ecf20Sopenharmony_ci};
4518c2ecf20Sopenharmony_ci
4528c2ecf20Sopenharmony_ci#endif
453