~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/uapi/linux/cramfs_fs.h

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
  2 #ifndef _UAPI__CRAMFS_H
  3 #define _UAPI__CRAMFS_H
  4 
  5 #include <linux/types.h>
  6 #include <linux/magic.h>
  7 
  8 #define CRAMFS_SIGNATURE        "Compressed ROMFS"
  9 
 10 /*
 11  * Width of various bitfields in struct cramfs_inode.
 12  * Primarily used to generate warnings in mkcramfs.
 13  */
 14 #define CRAMFS_MODE_WIDTH 16
 15 #define CRAMFS_UID_WIDTH 16
 16 #define CRAMFS_SIZE_WIDTH 24
 17 #define CRAMFS_GID_WIDTH 8
 18 #define CRAMFS_NAMELEN_WIDTH 6
 19 #define CRAMFS_OFFSET_WIDTH 26
 20 
 21 /*
 22  * Since inode.namelen is a unsigned 6-bit number, the maximum cramfs
 23  * path length is 63 << 2 = 252.
 24  */
 25 #define CRAMFS_MAXPATHLEN (((1 << CRAMFS_NAMELEN_WIDTH) - 1) << 2)
 26 
 27 /*
 28  * Reasonably terse representation of the inode data.
 29  */
 30 struct cramfs_inode {
 31         __u32 mode:CRAMFS_MODE_WIDTH, uid:CRAMFS_UID_WIDTH;
 32         /* SIZE for device files is i_rdev */
 33         __u32 size:CRAMFS_SIZE_WIDTH, gid:CRAMFS_GID_WIDTH;
 34         /* NAMELEN is the length of the file name, divided by 4 and
 35            rounded up.  (cramfs doesn't support hard links.) */
 36         /* OFFSET: For symlinks and non-empty regular files, this
 37            contains the offset (divided by 4) of the file data in
 38            compressed form (starting with an array of block pointers;
 39            see README).  For non-empty directories it is the offset
 40            (divided by 4) of the inode of the first file in that
 41            directory.  For anything else, offset is zero. */
 42         __u32 namelen:CRAMFS_NAMELEN_WIDTH, offset:CRAMFS_OFFSET_WIDTH;
 43 };
 44 
 45 struct cramfs_info {
 46         __u32 crc;
 47         __u32 edition;
 48         __u32 blocks;
 49         __u32 files;
 50 };
 51 
 52 /*
 53  * Superblock information at the beginning of the FS.
 54  */
 55 struct cramfs_super {
 56         __u32 magic;                    /* 0x28cd3d45 - random number */
 57         __u32 size;                     /* length in bytes */
 58         __u32 flags;                    /* feature flags */
 59         __u32 future;                   /* reserved for future use */
 60         __u8 signature[16];             /* "Compressed ROMFS" */
 61         struct cramfs_info fsid;        /* unique filesystem info */
 62         __u8 name[16];                  /* user-defined name */
 63         struct cramfs_inode root;       /* root inode data */
 64 };
 65 
 66 /*
 67  * Feature flags
 68  *
 69  * 0x00000000 - 0x000000ff: features that work for all past kernels
 70  * 0x00000100 - 0xffffffff: features that don't work for past kernels
 71  */
 72 #define CRAMFS_FLAG_FSID_VERSION_2      0x00000001      /* fsid version #2 */
 73 #define CRAMFS_FLAG_SORTED_DIRS         0x00000002      /* sorted dirs */
 74 #define CRAMFS_FLAG_HOLES               0x00000100      /* support for holes */
 75 #define CRAMFS_FLAG_WRONG_SIGNATURE     0x00000200      /* reserved */
 76 #define CRAMFS_FLAG_SHIFTED_ROOT_OFFSET 0x00000400      /* shifted root fs */
 77 #define CRAMFS_FLAG_EXT_BLOCK_POINTERS  0x00000800      /* block pointer extensions */
 78 
 79 /*
 80  * Valid values in super.flags.  Currently we refuse to mount
 81  * if (flags & ~CRAMFS_SUPPORTED_FLAGS).  Maybe that should be
 82  * changed to test super.future instead.
 83  */
 84 #define CRAMFS_SUPPORTED_FLAGS  ( 0x000000ff \
 85                                 | CRAMFS_FLAG_HOLES \
 86                                 | CRAMFS_FLAG_WRONG_SIGNATURE \
 87                                 | CRAMFS_FLAG_SHIFTED_ROOT_OFFSET \
 88                                 | CRAMFS_FLAG_EXT_BLOCK_POINTERS )
 89 
 90 /*
 91  * Block pointer flags
 92  *
 93  * The maximum block offset that needs to be represented is roughly:
 94  *
 95  *   (1 << CRAMFS_OFFSET_WIDTH) * 4 +
 96  *   (1 << CRAMFS_SIZE_WIDTH) / PAGE_SIZE * (4 + PAGE_SIZE)
 97  *   = 0x11004000
 98  *
 99  * That leaves room for 3 flag bits in the block pointer table.
100  */
101 #define CRAMFS_BLK_FLAG_UNCOMPRESSED    (1 << 31)
102 #define CRAMFS_BLK_FLAG_DIRECT_PTR      (1 << 30)
103 
104 #define CRAMFS_BLK_FLAGS        ( CRAMFS_BLK_FLAG_UNCOMPRESSED \
105                                 | CRAMFS_BLK_FLAG_DIRECT_PTR )
106 
107 /*
108  * Direct blocks are at least 4-byte aligned.
109  * Pointers to direct blocks are shifted down by 2 bits.
110  */
111 #define CRAMFS_BLK_DIRECT_PTR_SHIFT     2
112 
113 #endif /* _UAPI__CRAMFS_H */
114 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php