File: /usr/src/linux/include/linux/cramfs_fs.h

1     #ifndef __CRAMFS_H
2     #define __CRAMFS_H
3     
4     #ifndef __KERNEL__
5     
6     typedef unsigned char u8;
7     typedef unsigned short u16;
8     typedef unsigned int u32;
9     
10     #endif
11     
12     #define CRAMFS_MAGIC		0x28cd3d45	/* some random number */
13     #define CRAMFS_SIGNATURE	"Compressed ROMFS"
14     
15     /*
16      * Width of various bitfields in struct cramfs_inode.
17      * Primarily used to generate warnings in mkcramfs.
18      */
19     #define CRAMFS_MODE_WIDTH 16
20     #define CRAMFS_UID_WIDTH 16
21     #define CRAMFS_SIZE_WIDTH 24
22     #define CRAMFS_GID_WIDTH 8
23     #define CRAMFS_NAMELEN_WIDTH 6
24     #define CRAMFS_OFFSET_WIDTH 26
25     
26     /*
27      * Reasonably terse representation of the inode data.
28      */
29     struct cramfs_inode {
30     	u32 mode:CRAMFS_MODE_WIDTH, uid:CRAMFS_UID_WIDTH;
31     	/* SIZE for device files is i_rdev */
32     	u32 size:CRAMFS_SIZE_WIDTH, gid:CRAMFS_GID_WIDTH;
33     	/* NAMELEN is the length of the file name, divided by 4 and
34                rounded up.  (cramfs doesn't support hard links.) */
35     	/* OFFSET: For symlinks and non-empty regular files, this
36     	   contains the offset (divided by 4) of the file data in
37     	   compressed form (starting with an array of block pointers;
38     	   see README).  For non-empty directories it is the offset
39     	   (divided by 4) of the inode of the first file in that
40     	   directory.  For anything else, offset is zero. */
41     	u32 namelen:CRAMFS_NAMELEN_WIDTH, offset:CRAMFS_OFFSET_WIDTH;
42     };
43     
44     struct cramfs_info {
45     	u32 crc;
46     	u32 edition;
47     	u32 blocks;
48     	u32 files;
49     };
50     
51     /*
52      * Superblock information at the beginning of the FS.
53      */
54     struct cramfs_super {
55     	u32 magic;		/* 0x28cd3d45 - random number */
56     	u32 size;		/* length in bytes */
57     	u32 flags;		/* 0 */
58     	u32 future;		/* 0 */
59     	u8 signature[16];	/* "Compressed ROMFS" */
60     	struct cramfs_info fsid;	/* unique filesystem info */
61     	u8 name[16];		/* user-defined name */
62     	struct cramfs_inode root;	/* Root inode data */
63     };
64     
65     /*
66      * Feature flags
67      *
68      * 0x00000000 - 0x000000ff: features that work for all past kernels
69      * 0x00000100 - 0xffffffff: features that don't work for past kernels
70      */
71     #define CRAMFS_FLAG_FSID_VERSION_2	0x00000001	/* fsid version #2 */
72     #define CRAMFS_FLAG_SORTED_DIRS		0x00000002	/* sorted dirs */
73     #define CRAMFS_FLAG_HOLES		0x00000100	/* support for holes */
74     #define CRAMFS_FLAG_WRONG_SIGNATURE	0x00000200	/* reserved */
75     #define CRAMFS_FLAG_SHIFTED_ROOT_OFFSET	0x00000400	/* shifted root fs */
76     
77     /*
78      * Valid values in super.flags.  Currently we refuse to mount
79      * if (flags & ~CRAMFS_SUPPORTED_FLAGS).  Maybe that should be
80      * changed to test super.future instead.
81      */
82     #define CRAMFS_SUPPORTED_FLAGS (0x7ff)
83     
84     /* Uncompression interfaces to the underlying zlib */
85     int cramfs_uncompress_block(void *dst, int dstlen, void *src, int srclen);
86     int cramfs_uncompress_init(void);
87     int cramfs_uncompress_exit(void);
88     
89     #endif
90