4 typedef unsigned char u8;
5 typedef unsigned short u16;
6 typedef unsigned int u32;
8 #define CRAMFS_MAGIC 0x28cd3d45 /* some random number */
9 #define CRAMFS_SIGNATURE "Compressed ROMFS"
12 * Width of various bitfields in struct cramfs_inode.
13 * Primarily used to generate warnings in mkcramfs.
15 #define CRAMFS_MODE_WIDTH 16
16 #define CRAMFS_UID_WIDTH 16
17 #define CRAMFS_SIZE_WIDTH 24
18 #define CRAMFS_GID_WIDTH 8
19 #define CRAMFS_NAMELEN_WIDTH 6
20 #define CRAMFS_OFFSET_WIDTH 26
24 * Reasonably terse representation of the inode data.
28 /* SIZE for device files is i_rdev */
30 /* NAMELEN is the length of the file name, divided by 4 and
31 rounded up. (cramfs doesn't support hard links.) */
32 /* OFFSET: For symlinks and non-empty regular files, this
33 contains the offset (divided by 4) of the file data in
34 compressed form (starting with an array of block pointers;
35 see README). For non-empty directories it is the offset
36 (divided by 4) of the inode of the first file in that
37 directory. For anything else, offset is zero. */
38 u32 namelen:6, offset:26;
49 * Superblock information at the beginning of the FS.
52 u32 magic; /* 0x28cd3d45 - random number */
53 u32 size; /* Not used. mkcramfs currently
54 writes a constant 1<<16 here. */
57 u8 signature[16]; /* "Compressed ROMFS" */
58 struct cramfs_info fsid;/* unique filesystem info */
59 u8 name[16]; /* user-defined name */
60 struct cramfs_inode root; /* Root inode data */
63 #define CRAMFS_FLAG_FSID_VERSION_2 0x00000001 /* fsid version #2 */
64 #define CRAMFS_FLAG_SORTED_DIRS 0x00000002 /* sorted dirs */
65 #define CRAMFS_FLAG_HOLES 0x00000100 /* support for holes */
66 #define CRAMFS_FLAG_WRONG_SIGNATURE 0x00000200 /* reserved */
67 #define CRAMFS_FLAG_SHIFTED_ROOT_OFFSET 0x00000400 /* shifted root fs */
70 * Valid values in super.flags. Currently we refuse to mount
71 * if (flags & ~CRAMFS_SUPPORTED_FLAGS). Maybe that should be
72 * changed to test super.future instead.
74 #define CRAMFS_SUPPORTED_FLAGS (0xff)
76 /* Uncompression interfaces to the underlying zlib */
77 int cramfs_uncompress_block(void *dst, int dstlen, void *src, int srclen);
78 int cramfs_uncompress_init(void);
79 int cramfs_uncompress_exit(void);