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

TOMOYO Linux Cross Reference
Linux/include/linux/sysv_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 */
  2 #ifndef _LINUX_SYSV_FS_H
  3 #define _LINUX_SYSV_FS_H
  4 
  5 #define __packed2__     __attribute__((packed, aligned(2)))
  6 
  7 
  8 #ifndef __KERNEL__
  9 typedef u16 __fs16;
 10 typedef u32 __fs16;
 11 #endif
 12 
 13 /* inode numbers are 16 bit */
 14 typedef __fs16 sysv_ino_t;
 15 
 16 /* Block numbers are 24 bit, sometimes stored in 32 bit.
 17    On Coherent FS, they are always stored in PDP-11 manner: the least
 18    significant 16 bits come last. */
 19 typedef __fs32 sysv_zone_t;
 20 
 21 /* 0 is non-existent */
 22 #define SYSV_BADBL_INO  1       /* inode of bad blocks file */
 23 #define SYSV_ROOT_INO   2       /* inode of root directory */
 24 
 25 
 26 /* Xenix super-block data on disk */
 27 #define XENIX_NICINOD   100     /* number of inode cache entries */
 28 #define XENIX_NICFREE   100     /* number of free block list chunk entries */
 29 struct xenix_super_block {
 30         __fs16          s_isize; /* index of first data zone */
 31         __fs32          s_fsize __packed2__; /* total number of zones of this fs */
 32         /* the start of the free block list: */
 33         __fs16          s_nfree;        /* number of free blocks in s_free, <= XENIX_NICFREE */
 34         sysv_zone_t     s_free[XENIX_NICFREE]; /* first free block list chunk */
 35         /* the cache of free inodes: */
 36         __fs16          s_ninode; /* number of free inodes in s_inode, <= XENIX_NICINOD */
 37         sysv_ino_t      s_inode[XENIX_NICINOD]; /* some free inodes */
 38         /* locks, not used by Linux: */
 39         char            s_flock;        /* lock during free block list manipulation */
 40         char            s_ilock;        /* lock during inode cache manipulation */
 41         char            s_fmod;         /* super-block modified flag */
 42         char            s_ronly;        /* flag whether fs is mounted read-only */
 43         __fs32          s_time __packed2__; /* time of last super block update */
 44         __fs32          s_tfree __packed2__; /* total number of free zones */
 45         __fs16          s_tinode;       /* total number of free inodes */
 46         __fs16          s_dinfo[4];     /* device information ?? */
 47         char            s_fname[6];     /* file system volume name */
 48         char            s_fpack[6];     /* file system pack name */
 49         char            s_clean;        /* set to 0x46 when filesystem is properly unmounted */
 50         char            s_fill[371];
 51         s32             s_magic;        /* version of file system */
 52         __fs32          s_type;         /* type of file system: 1 for 512 byte blocks
 53                                                                 2 for 1024 byte blocks
 54                                                                 3 for 2048 byte blocks */
 55                                                                 
 56 };
 57 
 58 /*
 59  * SystemV FS comes in two variants:
 60  * sysv2: System V Release 2 (e.g. Microport), structure elements aligned(2).
 61  * sysv4: System V Release 4 (e.g. Consensys), structure elements aligned(4).
 62  */
 63 #define SYSV_NICINOD    100     /* number of inode cache entries */
 64 #define SYSV_NICFREE    50      /* number of free block list chunk entries */
 65 
 66 /* SystemV4 super-block data on disk */
 67 struct sysv4_super_block {
 68         __fs16  s_isize;        /* index of first data zone */
 69         u16     s_pad0;
 70         __fs32  s_fsize;        /* total number of zones of this fs */
 71         /* the start of the free block list: */
 72         __fs16  s_nfree;        /* number of free blocks in s_free, <= SYSV_NICFREE */
 73         u16     s_pad1;
 74         sysv_zone_t     s_free[SYSV_NICFREE]; /* first free block list chunk */
 75         /* the cache of free inodes: */
 76         __fs16  s_ninode;       /* number of free inodes in s_inode, <= SYSV_NICINOD */
 77         u16     s_pad2;
 78         sysv_ino_t     s_inode[SYSV_NICINOD]; /* some free inodes */
 79         /* locks, not used by Linux: */
 80         char    s_flock;        /* lock during free block list manipulation */
 81         char    s_ilock;        /* lock during inode cache manipulation */
 82         char    s_fmod;         /* super-block modified flag */
 83         char    s_ronly;        /* flag whether fs is mounted read-only */
 84         __fs32  s_time;         /* time of last super block update */
 85         __fs16  s_dinfo[4];     /* device information ?? */
 86         __fs32  s_tfree;        /* total number of free zones */
 87         __fs16  s_tinode;       /* total number of free inodes */
 88         u16     s_pad3;
 89         char    s_fname[6];     /* file system volume name */
 90         char    s_fpack[6];     /* file system pack name */
 91         s32     s_fill[12];
 92         __fs32  s_state;        /* file system state: 0x7c269d38-s_time means clean */
 93         s32     s_magic;        /* version of file system */
 94         __fs32  s_type;         /* type of file system: 1 for 512 byte blocks
 95                                                                 2 for 1024 byte blocks */
 96 };
 97 
 98 /* SystemV2 super-block data on disk */
 99 struct sysv2_super_block {
100         __fs16  s_isize;                /* index of first data zone */
101         __fs32  s_fsize __packed2__;    /* total number of zones of this fs */
102         /* the start of the free block list: */
103         __fs16  s_nfree;                /* number of free blocks in s_free, <= SYSV_NICFREE */
104         sysv_zone_t s_free[SYSV_NICFREE];       /* first free block list chunk */
105         /* the cache of free inodes: */
106         __fs16  s_ninode;               /* number of free inodes in s_inode, <= SYSV_NICINOD */
107         sysv_ino_t     s_inode[SYSV_NICINOD]; /* some free inodes */
108         /* locks, not used by Linux: */
109         char    s_flock;                /* lock during free block list manipulation */
110         char    s_ilock;                /* lock during inode cache manipulation */
111         char    s_fmod;                 /* super-block modified flag */
112         char    s_ronly;                /* flag whether fs is mounted read-only */
113         __fs32  s_time __packed2__;     /* time of last super block update */
114         __fs16  s_dinfo[4];             /* device information ?? */
115         __fs32  s_tfree __packed2__;    /* total number of free zones */
116         __fs16  s_tinode;               /* total number of free inodes */
117         char    s_fname[6];             /* file system volume name */
118         char    s_fpack[6];             /* file system pack name */
119         s32     s_fill[14];
120         __fs32  s_state;                /* file system state: 0xcb096f43 means clean */
121         s32     s_magic;                /* version of file system */
122         __fs32  s_type;                 /* type of file system: 1 for 512 byte blocks
123                                                                 2 for 1024 byte blocks */
124 };
125 
126 /* V7 super-block data on disk */
127 #define V7_NICINOD     100     /* number of inode cache entries */
128 #define V7_NICFREE     50      /* number of free block list chunk entries */
129 struct v7_super_block {
130         __fs16 s_isize;        /* index of first data zone */
131         __fs32 s_fsize __packed2__; /* total number of zones of this fs */
132         /* the start of the free block list: */
133         __fs16 s_nfree;        /* number of free blocks in s_free, <= V7_NICFREE */
134         sysv_zone_t s_free[V7_NICFREE]; /* first free block list chunk */
135         /* the cache of free inodes: */
136         __fs16 s_ninode;       /* number of free inodes in s_inode, <= V7_NICINOD */
137         sysv_ino_t      s_inode[V7_NICINOD]; /* some free inodes */
138         /* locks, not used by Linux or V7: */
139         char    s_flock;        /* lock during free block list manipulation */
140         char    s_ilock;        /* lock during inode cache manipulation */
141         char    s_fmod;         /* super-block modified flag */
142         char    s_ronly;        /* flag whether fs is mounted read-only */
143         __fs32  s_time __packed2__; /* time of last super block update */
144         /* the following fields are not maintained by V7: */
145         __fs32  s_tfree __packed2__; /* total number of free zones */
146         __fs16  s_tinode;       /* total number of free inodes */
147         __fs16  s_m;            /* interleave factor */
148         __fs16  s_n;            /* interleave factor */
149         char    s_fname[6];     /* file system name */
150         char    s_fpack[6];     /* file system pack name */
151 };
152 /* Constants to aid sanity checking */
153 /* This is not a hard limit, nor enforced by v7 kernel. It's actually just
154  * the limit used by Seventh Edition's ls, though is high enough to assume
155  * that no reasonable file system would have that much entries in root
156  * directory. Thus, if we see anything higher, we just probably got the
157  * endiannes wrong. */
158 #define V7_NFILES       1024
159 /* The disk addresses are three-byte (despite direct block addresses being
160  * aligned word-wise in inode). If the most significant byte is non-zero,
161  * something is most likely wrong (not a filesystem, bad bytesex). */
162 #define V7_MAXSIZE      0x00ffffff
163 
164 /* Coherent super-block data on disk */
165 #define COH_NICINOD     100     /* number of inode cache entries */
166 #define COH_NICFREE     64      /* number of free block list chunk entries */
167 struct coh_super_block {
168         __fs16          s_isize;        /* index of first data zone */
169         __fs32          s_fsize __packed2__; /* total number of zones of this fs */
170         /* the start of the free block list: */
171         __fs16 s_nfree; /* number of free blocks in s_free, <= COH_NICFREE */
172         sysv_zone_t     s_free[COH_NICFREE] __packed2__; /* first free block list chunk */
173         /* the cache of free inodes: */
174         __fs16          s_ninode;       /* number of free inodes in s_inode, <= COH_NICINOD */
175         sysv_ino_t      s_inode[COH_NICINOD]; /* some free inodes */
176         /* locks, not used by Linux: */
177         char            s_flock;        /* lock during free block list manipulation */
178         char            s_ilock;        /* lock during inode cache manipulation */
179         char            s_fmod;         /* super-block modified flag */
180         char            s_ronly;        /* flag whether fs is mounted read-only */
181         __fs32          s_time __packed2__; /* time of last super block update */
182         __fs32          s_tfree __packed2__; /* total number of free zones */
183         __fs16          s_tinode;       /* total number of free inodes */
184         __fs16          s_interleave_m; /* interleave factor */
185         __fs16          s_interleave_n;
186         char            s_fname[6];     /* file system volume name */
187         char            s_fpack[6];     /* file system pack name */
188         __fs32          s_unique;       /* zero, not used */
189 };
190 
191 /* SystemV/Coherent inode data on disk */
192 struct sysv_inode {
193         __fs16 i_mode;
194         __fs16 i_nlink;
195         __fs16 i_uid;
196         __fs16 i_gid;
197         __fs32 i_size;
198         u8  i_data[3*(10+1+1+1)];
199         u8  i_gen;
200         __fs32 i_atime; /* time of last access */
201         __fs32 i_mtime; /* time of last modification */
202         __fs32 i_ctime; /* time of creation */
203 };
204 
205 /* SystemV/Coherent directory entry on disk */
206 #define SYSV_NAMELEN    14      /* max size of name in struct sysv_dir_entry */
207 struct sysv_dir_entry {
208         sysv_ino_t inode;
209         char name[SYSV_NAMELEN]; /* up to 14 characters, the rest are zeroes */
210 };
211 
212 #define SYSV_DIRSIZE    sizeof(struct sysv_dir_entry)   /* size of every directory entry */
213 
214 #endif /* _LINUX_SYSV_FS_H */
215 

~ [ 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