Subversion Repositories shark

Rev

Rev 422 | Details | Compare with Previous | Last modification | View Log | RSS feed

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