![]() |
|
|||
0001 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 0002 #ifndef _UAPI__CRAMFS_H 0003 #define _UAPI__CRAMFS_H 0004 0005 #include <linux/types.h> 0006 #include <linux/magic.h> 0007 0008 #define CRAMFS_SIGNATURE "Compressed ROMFS" 0009 0010 /* 0011 * Width of various bitfields in struct cramfs_inode. 0012 * Primarily used to generate warnings in mkcramfs. 0013 */ 0014 #define CRAMFS_MODE_WIDTH 16 0015 #define CRAMFS_UID_WIDTH 16 0016 #define CRAMFS_SIZE_WIDTH 24 0017 #define CRAMFS_GID_WIDTH 8 0018 #define CRAMFS_NAMELEN_WIDTH 6 0019 #define CRAMFS_OFFSET_WIDTH 26 0020 0021 /* 0022 * Since inode.namelen is a unsigned 6-bit number, the maximum cramfs 0023 * path length is 63 << 2 = 252. 0024 */ 0025 #define CRAMFS_MAXPATHLEN (((1 << CRAMFS_NAMELEN_WIDTH) - 1) << 2) 0026 0027 /* 0028 * Reasonably terse representation of the inode data. 0029 */ 0030 struct cramfs_inode { 0031 __u32 mode:CRAMFS_MODE_WIDTH, uid:CRAMFS_UID_WIDTH; 0032 /* SIZE for device files is i_rdev */ 0033 __u32 size:CRAMFS_SIZE_WIDTH, gid:CRAMFS_GID_WIDTH; 0034 /* NAMELEN is the length of the file name, divided by 4 and 0035 rounded up. (cramfs doesn't support hard links.) */ 0036 /* OFFSET: For symlinks and non-empty regular files, this 0037 contains the offset (divided by 4) of the file data in 0038 compressed form (starting with an array of block pointers; 0039 see README). For non-empty directories it is the offset 0040 (divided by 4) of the inode of the first file in that 0041 directory. For anything else, offset is zero. */ 0042 __u32 namelen:CRAMFS_NAMELEN_WIDTH, offset:CRAMFS_OFFSET_WIDTH; 0043 }; 0044 0045 struct cramfs_info { 0046 __u32 crc; 0047 __u32 edition; 0048 __u32 blocks; 0049 __u32 files; 0050 }; 0051 0052 /* 0053 * Superblock information at the beginning of the FS. 0054 */ 0055 struct cramfs_super { 0056 __u32 magic; /* 0x28cd3d45 - random number */ 0057 __u32 size; /* length in bytes */ 0058 __u32 flags; /* feature flags */ 0059 __u32 future; /* reserved for future use */ 0060 __u8 signature[16]; /* "Compressed ROMFS" */ 0061 struct cramfs_info fsid; /* unique filesystem info */ 0062 __u8 name[16]; /* user-defined name */ 0063 struct cramfs_inode root; /* root inode data */ 0064 }; 0065 0066 /* 0067 * Feature flags 0068 * 0069 * 0x00000000 - 0x000000ff: features that work for all past kernels 0070 * 0x00000100 - 0xffffffff: features that don't work for past kernels 0071 */ 0072 #define CRAMFS_FLAG_FSID_VERSION_2 0x00000001 /* fsid version #2 */ 0073 #define CRAMFS_FLAG_SORTED_DIRS 0x00000002 /* sorted dirs */ 0074 #define CRAMFS_FLAG_HOLES 0x00000100 /* support for holes */ 0075 #define CRAMFS_FLAG_WRONG_SIGNATURE 0x00000200 /* reserved */ 0076 #define CRAMFS_FLAG_SHIFTED_ROOT_OFFSET 0x00000400 /* shifted root fs */ 0077 #define CRAMFS_FLAG_EXT_BLOCK_POINTERS 0x00000800 /* block pointer extensions */ 0078 0079 /* 0080 * Valid values in super.flags. Currently we refuse to mount 0081 * if (flags & ~CRAMFS_SUPPORTED_FLAGS). Maybe that should be 0082 * changed to test super.future instead. 0083 */ 0084 #define CRAMFS_SUPPORTED_FLAGS ( 0x000000ff \ 0085 | CRAMFS_FLAG_HOLES \ 0086 | CRAMFS_FLAG_WRONG_SIGNATURE \ 0087 | CRAMFS_FLAG_SHIFTED_ROOT_OFFSET \ 0088 | CRAMFS_FLAG_EXT_BLOCK_POINTERS ) 0089 0090 /* 0091 * Block pointer flags 0092 * 0093 * The maximum block offset that needs to be represented is roughly: 0094 * 0095 * (1 << CRAMFS_OFFSET_WIDTH) * 4 + 0096 * (1 << CRAMFS_SIZE_WIDTH) / PAGE_SIZE * (4 + PAGE_SIZE) 0097 * = 0x11004000 0098 * 0099 * That leaves room for 3 flag bits in the block pointer table. 0100 */ 0101 #define CRAMFS_BLK_FLAG_UNCOMPRESSED (1 << 31) 0102 #define CRAMFS_BLK_FLAG_DIRECT_PTR (1 << 30) 0103 0104 #define CRAMFS_BLK_FLAGS ( CRAMFS_BLK_FLAG_UNCOMPRESSED \ 0105 | CRAMFS_BLK_FLAG_DIRECT_PTR ) 0106 0107 /* 0108 * Direct blocks are at least 4-byte aligned. 0109 * Pointers to direct blocks are shifted down by 2 bits. 0110 */ 0111 #define CRAMFS_BLK_DIRECT_PTR_SHIFT 2 0112 0113 #endif /* _UAPI__CRAMFS_H */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |
![]() ![]() |