fs: new cont helpers
[wrt350n-kernel.git] / include / linux / sysv_fs.h
blobe0248631e461a960f0285d0a07ff138e80cb25d6
1 #ifndef _LINUX_SYSV_FS_H
2 #define _LINUX_SYSV_FS_H
4 #if defined(__GNUC__)
5 # define __packed2__ __attribute__((packed, aligned(2)))
6 #else
7 >> I want to scream! <<
8 #endif
11 #ifndef __KERNEL__
12 typedef u16 __fs16;
13 typedef u32 __fs16;
14 #endif
16 /* inode numbers are 16 bit */
17 typedef __fs16 sysv_ino_t;
19 /* Block numbers are 24 bit, sometimes stored in 32 bit.
20 On Coherent FS, they are always stored in PDP-11 manner: the least
21 significant 16 bits come last. */
22 typedef __fs32 sysv_zone_t;
24 /* 0 is non-existent */
25 #define SYSV_BADBL_INO 1 /* inode of bad blocks file */
26 #define SYSV_ROOT_INO 2 /* inode of root directory */
29 /* Xenix super-block data on disk */
30 #define XENIX_NICINOD 100 /* number of inode cache entries */
31 #define XENIX_NICFREE 100 /* number of free block list chunk entries */
32 struct xenix_super_block {
33 __fs16 s_isize; /* index of first data zone */
34 __fs32 s_fsize __packed2__; /* total number of zones of this fs */
35 /* the start of the free block list: */
36 __fs16 s_nfree; /* number of free blocks in s_free, <= XENIX_NICFREE */
37 sysv_zone_t s_free[XENIX_NICFREE]; /* first free block list chunk */
38 /* the cache of free inodes: */
39 __fs16 s_ninode; /* number of free inodes in s_inode, <= XENIX_NICINOD */
40 sysv_ino_t s_inode[XENIX_NICINOD]; /* some free inodes */
41 /* locks, not used by Linux: */
42 char s_flock; /* lock during free block list manipulation */
43 char s_ilock; /* lock during inode cache manipulation */
44 char s_fmod; /* super-block modified flag */
45 char s_ronly; /* flag whether fs is mounted read-only */
46 __fs32 s_time __packed2__; /* time of last super block update */
47 __fs32 s_tfree __packed2__; /* total number of free zones */
48 __fs16 s_tinode; /* total number of free inodes */
49 __fs16 s_dinfo[4]; /* device information ?? */
50 char s_fname[6]; /* file system volume name */
51 char s_fpack[6]; /* file system pack name */
52 char s_clean; /* set to 0x46 when filesystem is properly unmounted */
53 char s_fill[371];
54 s32 s_magic; /* version of file system */
55 __fs32 s_type; /* type of file system: 1 for 512 byte blocks
56 2 for 1024 byte blocks
57 3 for 2048 byte blocks */
62 * SystemV FS comes in two variants:
63 * sysv2: System V Release 2 (e.g. Microport), structure elements aligned(2).
64 * sysv4: System V Release 4 (e.g. Consensys), structure elements aligned(4).
66 #define SYSV_NICINOD 100 /* number of inode cache entries */
67 #define SYSV_NICFREE 50 /* number of free block list chunk entries */
69 /* SystemV4 super-block data on disk */
70 struct sysv4_super_block {
71 __fs16 s_isize; /* index of first data zone */
72 u16 s_pad0;
73 __fs32 s_fsize; /* total number of zones of this fs */
74 /* the start of the free block list: */
75 __fs16 s_nfree; /* number of free blocks in s_free, <= SYSV_NICFREE */
76 u16 s_pad1;
77 sysv_zone_t s_free[SYSV_NICFREE]; /* first free block list chunk */
78 /* the cache of free inodes: */
79 __fs16 s_ninode; /* number of free inodes in s_inode, <= SYSV_NICINOD */
80 u16 s_pad2;
81 sysv_ino_t s_inode[SYSV_NICINOD]; /* some free inodes */
82 /* locks, not used by Linux: */
83 char s_flock; /* lock during free block list manipulation */
84 char s_ilock; /* lock during inode cache manipulation */
85 char s_fmod; /* super-block modified flag */
86 char s_ronly; /* flag whether fs is mounted read-only */
87 __fs32 s_time; /* time of last super block update */
88 __fs16 s_dinfo[4]; /* device information ?? */
89 __fs32 s_tfree; /* total number of free zones */
90 __fs16 s_tinode; /* total number of free inodes */
91 u16 s_pad3;
92 char s_fname[6]; /* file system volume name */
93 char s_fpack[6]; /* file system pack name */
94 s32 s_fill[12];
95 __fs32 s_state; /* file system state: 0x7c269d38-s_time means clean */
96 s32 s_magic; /* version of file system */
97 __fs32 s_type; /* type of file system: 1 for 512 byte blocks
98 2 for 1024 byte blocks */
101 /* SystemV2 super-block data on disk */
102 struct sysv2_super_block {
103 __fs16 s_isize; /* index of first data zone */
104 __fs32 s_fsize __packed2__; /* total number of zones of this fs */
105 /* the start of the free block list: */
106 __fs16 s_nfree; /* number of free blocks in s_free, <= SYSV_NICFREE */
107 sysv_zone_t s_free[SYSV_NICFREE]; /* first free block list chunk */
108 /* the cache of free inodes: */
109 __fs16 s_ninode; /* number of free inodes in s_inode, <= SYSV_NICINOD */
110 sysv_ino_t s_inode[SYSV_NICINOD]; /* some free inodes */
111 /* locks, not used by Linux: */
112 char s_flock; /* lock during free block list manipulation */
113 char s_ilock; /* lock during inode cache manipulation */
114 char s_fmod; /* super-block modified flag */
115 char s_ronly; /* flag whether fs is mounted read-only */
116 __fs32 s_time __packed2__; /* time of last super block update */
117 __fs16 s_dinfo[4]; /* device information ?? */
118 __fs32 s_tfree __packed2__; /* total number of free zones */
119 __fs16 s_tinode; /* total number of free inodes */
120 char s_fname[6]; /* file system volume name */
121 char s_fpack[6]; /* file system pack name */
122 s32 s_fill[14];
123 __fs32 s_state; /* file system state: 0xcb096f43 means clean */
124 s32 s_magic; /* version of file system */
125 __fs32 s_type; /* type of file system: 1 for 512 byte blocks
126 2 for 1024 byte blocks */
129 /* V7 super-block data on disk */
130 #define V7_NICINOD 100 /* number of inode cache entries */
131 #define V7_NICFREE 50 /* number of free block list chunk entries */
132 struct v7_super_block {
133 __fs16 s_isize; /* index of first data zone */
134 __fs32 s_fsize __packed2__; /* total number of zones of this fs */
135 /* the start of the free block list: */
136 __fs16 s_nfree; /* number of free blocks in s_free, <= V7_NICFREE */
137 sysv_zone_t s_free[V7_NICFREE]; /* first free block list chunk */
138 /* the cache of free inodes: */
139 __fs16 s_ninode; /* number of free inodes in s_inode, <= V7_NICINOD */
140 sysv_ino_t s_inode[V7_NICINOD]; /* some free inodes */
141 /* locks, not used by Linux or V7: */
142 char s_flock; /* lock during free block list manipulation */
143 char s_ilock; /* lock during inode cache manipulation */
144 char s_fmod; /* super-block modified flag */
145 char s_ronly; /* flag whether fs is mounted read-only */
146 __fs32 s_time __packed2__; /* time of last super block update */
147 /* the following fields are not maintained by V7: */
148 __fs32 s_tfree __packed2__; /* total number of free zones */
149 __fs16 s_tinode; /* total number of free inodes */
150 __fs16 s_m; /* interleave factor */
151 __fs16 s_n; /* interleave factor */
152 char s_fname[6]; /* file system name */
153 char s_fpack[6]; /* file system pack name */
156 /* Coherent super-block data on disk */
157 #define COH_NICINOD 100 /* number of inode cache entries */
158 #define COH_NICFREE 64 /* number of free block list chunk entries */
159 struct coh_super_block {
160 __fs16 s_isize; /* index of first data zone */
161 __fs32 s_fsize __packed2__; /* total number of zones of this fs */
162 /* the start of the free block list: */
163 __fs16 s_nfree; /* number of free blocks in s_free, <= COH_NICFREE */
164 sysv_zone_t s_free[COH_NICFREE] __packed2__; /* first free block list chunk */
165 /* the cache of free inodes: */
166 __fs16 s_ninode; /* number of free inodes in s_inode, <= COH_NICINOD */
167 sysv_ino_t s_inode[COH_NICINOD]; /* some free inodes */
168 /* locks, not used by Linux: */
169 char s_flock; /* lock during free block list manipulation */
170 char s_ilock; /* lock during inode cache manipulation */
171 char s_fmod; /* super-block modified flag */
172 char s_ronly; /* flag whether fs is mounted read-only */
173 __fs32 s_time __packed2__; /* time of last super block update */
174 __fs32 s_tfree __packed2__; /* total number of free zones */
175 __fs16 s_tinode; /* total number of free inodes */
176 __fs16 s_interleave_m; /* interleave factor */
177 __fs16 s_interleave_n;
178 char s_fname[6]; /* file system volume name */
179 char s_fpack[6]; /* file system pack name */
180 __fs32 s_unique; /* zero, not used */
183 /* SystemV/Coherent inode data on disk */
184 struct sysv_inode {
185 __fs16 i_mode;
186 __fs16 i_nlink;
187 __fs16 i_uid;
188 __fs16 i_gid;
189 __fs32 i_size;
190 u8 i_data[3*(10+1+1+1)];
191 u8 i_gen;
192 __fs32 i_atime; /* time of last access */
193 __fs32 i_mtime; /* time of last modification */
194 __fs32 i_ctime; /* time of creation */
197 /* SystemV/Coherent directory entry on disk */
198 #define SYSV_NAMELEN 14 /* max size of name in struct sysv_dir_entry */
199 struct sysv_dir_entry {
200 sysv_ino_t inode;
201 char name[SYSV_NAMELEN]; /* up to 14 characters, the rest are zeroes */
204 #define SYSV_DIRSIZE sizeof(struct sysv_dir_entry) /* size of every directory entry */
206 #endif /* _LINUX_SYSV_FS_H */