[PATCH] knfsd: SUNRPC: Cache remote peer's address in svc_sock
[pandora-kernel.git] / include / linux / ufs_fs.h
1 /*
2  *  linux/include/linux/ufs_fs.h
3  *
4  * Copyright (C) 1996
5  * Adrian Rodriguez (adrian@franklins-tower.rutgers.edu)
6  * Laboratory for Computer Science Research Computing Facility
7  * Rutgers, The State University of New Jersey
8  *
9  * Clean swab support by Fare <fare@tunes.org>
10  * just hope no one is using NNUUXXI on __?64 structure elements
11  * 64-bit clean thanks to Maciej W. Rozycki <macro@ds2.pg.gda.pl>
12  *
13  * 4.4BSD (FreeBSD) support added on February 1st 1998 by
14  * Niels Kristian Bech Jensen <nkbj@image.dk> partially based
15  * on code by Martin von Loewis <martin@mira.isdn.cs.tu-berlin.de>.
16  *
17  * NeXTstep support added on February 5th 1998 by
18  * Niels Kristian Bech Jensen <nkbj@image.dk>.
19  *
20  * Write support by Daniel Pirkl <daniel.pirkl@email.cz>
21  *
22  * HP/UX hfs filesystem support added by
23  * Martin K. Petersen <mkp@mkp.net>, August 1999
24  *
25  * UFS2 (of FreeBSD 5.x) support added by
26  * Niraj Kumar <niraj17@iitbombay.org>  , Jan 2004
27  *
28  */
29
30 #ifndef __LINUX_UFS_FS_H
31 #define __LINUX_UFS_FS_H
32
33 #include <linux/types.h>
34 #include <linux/kernel.h>
35 #include <linux/stat.h>
36 #include <linux/fs.h>
37
38 #ifndef __KERNEL__
39 typedef __u64 __fs64;
40 typedef __u32 __fs32;
41 typedef __u16 __fs16;
42 #else
43 typedef __u64 __bitwise __fs64;
44 typedef __u32 __bitwise __fs32;
45 typedef __u16 __bitwise __fs16;
46 #endif
47
48 #ifdef __KERNEL__
49 #include <linux/ufs_fs_i.h>
50 #include <linux/ufs_fs_sb.h>
51 #endif
52
53 #define UFS_BBLOCK 0
54 #define UFS_BBSIZE 8192
55 #define UFS_SBLOCK 8192
56 #define UFS_SBSIZE 8192
57
58 #define UFS_SECTOR_SIZE 512
59 #define UFS_SECTOR_BITS 9
60 #define UFS_MAGIC  0x00011954
61 #define UFS2_MAGIC 0x19540119
62 #define UFS_CIGAM  0x54190100 /* byteswapped MAGIC */
63
64 /* Copied from FreeBSD */
65 /*
66  * Each disk drive contains some number of filesystems.
67  * A filesystem consists of a number of cylinder groups.
68  * Each cylinder group has inodes and data.
69  *
70  * A filesystem is described by its super-block, which in turn
71  * describes the cylinder groups.  The super-block is critical
72  * data and is replicated in each cylinder group to protect against
73  * catastrophic loss.  This is done at `newfs' time and the critical
74  * super-block data does not change, so the copies need not be
75  * referenced further unless disaster strikes.
76  *
77  * For filesystem fs, the offsets of the various blocks of interest
78  * are given in the super block as:
79  *      [fs->fs_sblkno]         Super-block
80  *      [fs->fs_cblkno]         Cylinder group block
81  *      [fs->fs_iblkno]         Inode blocks
82  *      [fs->fs_dblkno]         Data blocks
83  * The beginning of cylinder group cg in fs, is given by
84  * the ``cgbase(fs, cg)'' macro.
85  *
86  * Depending on the architecture and the media, the superblock may
87  * reside in any one of four places. For tiny media where every block
88  * counts, it is placed at the very front of the partition. Historically,
89  * UFS1 placed it 8K from the front to leave room for the disk label and
90  * a small bootstrap. For UFS2 it got moved to 64K from the front to leave
91  * room for the disk label and a bigger bootstrap, and for really piggy
92  * systems we check at 256K from the front if the first three fail. In
93  * all cases the size of the superblock will be SBLOCKSIZE. All values are
94  * given in byte-offset form, so they do not imply a sector size. The
95  * SBLOCKSEARCH specifies the order in which the locations should be searched.
96  */
97 #define SBLOCK_FLOPPY        0
98 #define SBLOCK_UFS1       8192
99 #define SBLOCK_UFS2      65536
100 #define SBLOCK_PIGGY    262144
101 #define SBLOCKSIZE        8192
102 #define SBLOCKSEARCH \
103         { SBLOCK_UFS2, SBLOCK_UFS1, SBLOCK_FLOPPY, SBLOCK_PIGGY, -1 }
104
105
106 /* HP specific MAGIC values */
107
108 #define UFS_MAGIC_LFN   0x00095014 /* fs supports filenames > 14 chars */
109 #define UFS_CIGAM_LFN   0x14500900 /* srahc 41 < semanelif stroppus sf */
110
111 #define UFS_MAGIC_SEC   0x00612195 /* B1 security fs */
112 #define UFS_CIGAM_SEC   0x95216100
113
114 #define UFS_MAGIC_FEA   0x00195612 /* fs_featurebits supported */
115 #define UFS_CIGAM_FEA   0x12561900
116
117 #define UFS_MAGIC_4GB   0x05231994 /* fs > 4 GB && fs_featurebits */
118 #define UFS_CIGAM_4GB   0x94192305
119
120 /* Seems somebody at HP goofed here. B1 and lfs are both 0x2 !?! */
121 #define UFS_FSF_LFN     0x00000001 /* long file names */
122 #define UFS_FSF_B1      0x00000002 /* B1 security */
123 #define UFS_FSF_LFS     0x00000002 /* large files */
124 #define UFS_FSF_LUID    0x00000004 /* large UIDs */
125
126 /* End of HP stuff */
127
128
129 #define UFS_BSIZE       8192
130 #define UFS_MINBSIZE    4096
131 #define UFS_FSIZE       1024
132 #define UFS_MAXFRAG     (UFS_BSIZE / UFS_FSIZE)
133
134 #define UFS_NDADDR 12
135 #define UFS_NINDIR 3
136
137 #define UFS_IND_BLOCK   (UFS_NDADDR + 0)
138 #define UFS_DIND_BLOCK  (UFS_NDADDR + 1)
139 #define UFS_TIND_BLOCK  (UFS_NDADDR + 2)
140
141 #define UFS_NDIR_FRAGMENT (UFS_NDADDR << uspi->s_fpbshift)
142 #define UFS_IND_FRAGMENT (UFS_IND_BLOCK << uspi->s_fpbshift)
143 #define UFS_DIND_FRAGMENT (UFS_DIND_BLOCK << uspi->s_fpbshift)
144 #define UFS_TIND_FRAGMENT (UFS_TIND_BLOCK << uspi->s_fpbshift)
145
146 #define UFS_ROOTINO 2
147 #define UFS_FIRST_INO (UFS_ROOTINO + 1)
148
149 #define UFS_USEEFT  ((__u16)65535)
150
151 #define UFS_FSOK      0x7c269d38
152 #define UFS_FSACTIVE  ((__s8)0x00)
153 #define UFS_FSCLEAN   ((__s8)0x01)
154 #define UFS_FSSTABLE  ((__s8)0x02)
155 #define UFS_FSOSF1    ((__s8)0x03)      /* is this correct for DEC OSF/1? */
156 #define UFS_FSBAD     ((__s8)0xff)
157
158 /* From here to next blank line, s_flags for ufs_sb_info */
159 /* directory entry encoding */
160 #define UFS_DE_MASK             0x00000010      /* mask for the following */
161 #define UFS_DE_OLD              0x00000000
162 #define UFS_DE_44BSD            0x00000010
163 /* uid encoding */
164 #define UFS_UID_MASK            0x00000060      /* mask for the following */
165 #define UFS_UID_OLD             0x00000000
166 #define UFS_UID_44BSD           0x00000020
167 #define UFS_UID_EFT             0x00000040
168 /* superblock state encoding */
169 #define UFS_ST_MASK             0x00000700      /* mask for the following */
170 #define UFS_ST_OLD              0x00000000
171 #define UFS_ST_44BSD            0x00000100
172 #define UFS_ST_SUN              0x00000200
173 #define UFS_ST_SUNx86           0x00000400
174 /*cylinder group encoding */
175 #define UFS_CG_MASK             0x00003000      /* mask for the following */
176 #define UFS_CG_OLD              0x00000000
177 #define UFS_CG_44BSD            0x00002000
178 #define UFS_CG_SUN              0x00001000
179 /* filesystem type encoding */
180 #define UFS_TYPE_MASK           0x00010000      /* mask for the following */
181 #define UFS_TYPE_UFS1           0x00000000
182 #define UFS_TYPE_UFS2           0x00010000
183
184
185 /* fs_inodefmt options */
186 #define UFS_42INODEFMT  -1
187 #define UFS_44INODEFMT  2
188
189 /* mount options */
190 #define UFS_MOUNT_ONERROR               0x0000000F
191 #define UFS_MOUNT_ONERROR_PANIC         0x00000001
192 #define UFS_MOUNT_ONERROR_LOCK          0x00000002
193 #define UFS_MOUNT_ONERROR_UMOUNT        0x00000004
194 #define UFS_MOUNT_ONERROR_REPAIR        0x00000008
195
196 #define UFS_MOUNT_UFSTYPE               0x0000FFF0
197 #define UFS_MOUNT_UFSTYPE_OLD           0x00000010
198 #define UFS_MOUNT_UFSTYPE_44BSD         0x00000020
199 #define UFS_MOUNT_UFSTYPE_SUN           0x00000040
200 #define UFS_MOUNT_UFSTYPE_NEXTSTEP      0x00000080
201 #define UFS_MOUNT_UFSTYPE_NEXTSTEP_CD   0x00000100
202 #define UFS_MOUNT_UFSTYPE_OPENSTEP      0x00000200
203 #define UFS_MOUNT_UFSTYPE_SUNx86        0x00000400
204 #define UFS_MOUNT_UFSTYPE_HP            0x00000800
205 #define UFS_MOUNT_UFSTYPE_UFS2          0x00001000
206
207 #define ufs_clear_opt(o,opt)    o &= ~UFS_MOUNT_##opt
208 #define ufs_set_opt(o,opt)      o |= UFS_MOUNT_##opt
209 #define ufs_test_opt(o,opt)     ((o) & UFS_MOUNT_##opt)
210
211 /*
212  * MINFREE gives the minimum acceptable percentage of file system
213  * blocks which may be free. If the freelist drops below this level
214  * only the superuser may continue to allocate blocks. This may
215  * be set to 0 if no reserve of free blocks is deemed necessary,
216  * however throughput drops by fifty percent if the file system
217  * is run at between 95% and 100% full; thus the minimum default
218  * value of fs_minfree is 5%. However, to get good clustering
219  * performance, 10% is a better choice. hence we use 10% as our
220  * default value. With 10% free space, fragmentation is not a
221  * problem, so we choose to optimize for time.
222  */
223 #define UFS_MINFREE         5
224 #define UFS_DEFAULTOPT      UFS_OPTTIME
225
226 /*
227  * Debug code
228  */
229 #ifdef CONFIG_UFS_DEBUG
230 #       define UFSD(f, a...)    {                                       \
231                 printk ("UFSD (%s, %d): %s:",                           \
232                         __FILE__, __LINE__, __FUNCTION__);              \
233                 printk (f, ## a);                                       \
234         }
235 #else
236 #       define UFSD(f, a...)    /**/
237 #endif
238             
239 /*
240  * Turn file system block numbers into disk block addresses.
241  * This maps file system blocks to device size blocks.
242  */
243 #define ufs_fsbtodb(uspi, b)    ((b) << (uspi)->s_fsbtodb)
244 #define ufs_dbtofsb(uspi, b)    ((b) >> (uspi)->s_fsbtodb)
245
246 /*
247  * Cylinder group macros to locate things in cylinder groups.
248  * They calc file system addresses of cylinder group data structures.
249  */
250 #define ufs_cgbase(c)   (uspi->s_fpg * (c))
251 #define ufs_cgstart(c)  ((uspi)->fs_magic == UFS2_MAGIC ?  ufs_cgbase(c) : \
252         (ufs_cgbase(c)  + uspi->s_cgoffset * ((c) & ~uspi->s_cgmask)))
253 #define ufs_cgsblock(c) (ufs_cgstart(c) + uspi->s_sblkno)       /* super blk */
254 #define ufs_cgcmin(c)   (ufs_cgstart(c) + uspi->s_cblkno)       /* cg block */
255 #define ufs_cgimin(c)   (ufs_cgstart(c) + uspi->s_iblkno)       /* inode blk */
256 #define ufs_cgdmin(c)   (ufs_cgstart(c) + uspi->s_dblkno)       /* 1st data */
257
258 /*
259  * Macros for handling inode numbers:
260  *     inode number to file system block offset.
261  *     inode number to cylinder group number.
262  *     inode number to file system block address.
263  */
264 #define ufs_inotocg(x)          ((x) / uspi->s_ipg)
265 #define ufs_inotocgoff(x)       ((x) % uspi->s_ipg)
266 #define ufs_inotofsba(x)        (ufs_cgimin(ufs_inotocg(x)) + ufs_inotocgoff(x) / uspi->s_inopf)
267 #define ufs_inotofsbo(x)        ((x) % uspi->s_inopf)
268
269 /*
270  * Give cylinder group number for a file system block.
271  * Give cylinder group block number for a file system block.
272  */
273 #define ufs_dtog(d)     ((d) / uspi->s_fpg)
274 #define ufs_dtogd(d)    ((d) % uspi->s_fpg)
275
276 /*
277  * Compute the cylinder and rotational position of a cyl block addr.
278  */
279 #define ufs_cbtocylno(bno) \
280         ((bno) * uspi->s_nspf / uspi->s_spc)
281 #define ufs_cbtorpos(bno) \
282         ((((bno) * uspi->s_nspf % uspi->s_spc / uspi->s_nsect \
283         * uspi->s_trackskew + (bno) * uspi->s_nspf % uspi->s_spc \
284         % uspi->s_nsect * uspi->s_interleave) % uspi->s_nsect \
285         * uspi->s_nrpos) / uspi->s_npsect)
286
287 /*
288  * The following macros optimize certain frequently calculated
289  * quantities by using shifts and masks in place of divisions
290  * modulos and multiplications.
291  */
292 #define ufs_blkoff(loc)         ((loc) & uspi->s_qbmask)
293 #define ufs_fragoff(loc)        ((loc) & uspi->s_qfmask)
294 #define ufs_lblktosize(blk)     ((blk) << uspi->s_bshift)
295 #define ufs_lblkno(loc)         ((loc) >> uspi->s_bshift)
296 #define ufs_numfrags(loc)       ((loc) >> uspi->s_fshift)
297 #define ufs_blkroundup(size)    (((size) + uspi->s_qbmask) & uspi->s_bmask)
298 #define ufs_fragroundup(size)   (((size) + uspi->s_qfmask) & uspi->s_fmask)
299 #define ufs_fragstoblks(frags)  ((frags) >> uspi->s_fpbshift)
300 #define ufs_blkstofrags(blks)   ((blks) << uspi->s_fpbshift)
301 #define ufs_fragnum(fsb)        ((fsb) & uspi->s_fpbmask)
302 #define ufs_blknum(fsb)         ((fsb) & ~uspi->s_fpbmask)
303
304 #define UFS_MAXNAMLEN 255
305 #define UFS_MAXMNTLEN 512
306 #define UFS2_MAXMNTLEN 468
307 #define UFS2_MAXVOLLEN 32
308 #define UFS_MAXCSBUFS 31
309 #define UFS_LINK_MAX 32000
310 /*
311 #define UFS2_NOCSPTRS   ((128 / sizeof(void *)) - 4)
312 */
313 #define UFS2_NOCSPTRS   28
314
315 /*
316  * UFS_DIR_PAD defines the directory entries boundaries
317  * (must be a multiple of 4)
318  */
319 #define UFS_DIR_PAD                     4
320 #define UFS_DIR_ROUND                   (UFS_DIR_PAD - 1)
321 #define UFS_DIR_REC_LEN(name_len)       (((name_len) + 1 + 8 + UFS_DIR_ROUND) & ~UFS_DIR_ROUND)
322
323 struct ufs_timeval {
324         __fs32  tv_sec;
325         __fs32  tv_usec;
326 };
327
328 struct ufs_dir_entry {
329         __fs32  d_ino;                  /* inode number of this entry */
330         __fs16  d_reclen;               /* length of this entry */
331         union {
332                 __fs16  d_namlen;               /* actual length of d_name */
333                 struct {
334                         __u8    d_type;         /* file type */
335                         __u8    d_namlen;       /* length of string in d_name */
336                 } d_44;
337         } d_u;
338         __u8    d_name[UFS_MAXNAMLEN + 1];      /* file name */
339 };
340
341 struct ufs_csum {
342         __fs32  cs_ndir;        /* number of directories */
343         __fs32  cs_nbfree;      /* number of free blocks */
344         __fs32  cs_nifree;      /* number of free inodes */
345         __fs32  cs_nffree;      /* number of free frags */
346 };
347 struct ufs2_csum_total {
348         __fs64  cs_ndir;        /* number of directories */
349         __fs64  cs_nbfree;      /* number of free blocks */
350         __fs64  cs_nifree;      /* number of free inodes */
351         __fs64  cs_nffree;      /* number of free frags */
352         __fs64   cs_numclusters;        /* number of free clusters */
353         __fs64   cs_spare[3];   /* future expansion */
354 };
355
356 struct ufs_csum_core {
357         __u64   cs_ndir;        /* number of directories */
358         __u64   cs_nbfree;      /* number of free blocks */
359         __u64   cs_nifree;      /* number of free inodes */
360         __u64   cs_nffree;      /* number of free frags */
361         __u64   cs_numclusters; /* number of free clusters */
362 };
363
364 /*
365  * File system flags
366  */
367 #define UFS_UNCLEAN      0x01    /* file system not clean at mount (unused) */
368 #define UFS_DOSOFTDEP    0x02    /* file system using soft dependencies */
369 #define UFS_NEEDSFSCK    0x04    /* needs sync fsck (FreeBSD compat, unused) */
370 #define UFS_INDEXDIRS    0x08    /* kernel supports indexed directories */
371 #define UFS_ACLS         0x10    /* file system has ACLs enabled */
372 #define UFS_MULTILABEL   0x20    /* file system is MAC multi-label */
373 #define UFS_FLAGS_UPDATED 0x80   /* flags have been moved to new location */
374
375 #if 0
376 /*
377  * This is the actual superblock, as it is laid out on the disk.
378  * Do NOT use this structure, because of sizeof(ufs_super_block) > 512 and
379  * it may occupy several blocks, use
380  * struct ufs_super_block_(first,second,third) instead.
381  */
382 struct ufs_super_block {
383         __fs32  fs_link;        /* UNUSED */
384         __fs32  fs_rlink;       /* UNUSED */
385         __fs32  fs_sblkno;      /* addr of super-block in filesys */
386         __fs32  fs_cblkno;      /* offset of cyl-block in filesys */
387         __fs32  fs_iblkno;      /* offset of inode-blocks in filesys */
388         __fs32  fs_dblkno;      /* offset of first data after cg */
389         __fs32  fs_cgoffset;    /* cylinder group offset in cylinder */
390         __fs32  fs_cgmask;      /* used to calc mod fs_ntrak */
391         __fs32  fs_time;        /* last time written -- time_t */
392         __fs32  fs_size;        /* number of blocks in fs */
393         __fs32  fs_dsize;       /* number of data blocks in fs */
394         __fs32  fs_ncg;         /* number of cylinder groups */
395         __fs32  fs_bsize;       /* size of basic blocks in fs */
396         __fs32  fs_fsize;       /* size of frag blocks in fs */
397         __fs32  fs_frag;        /* number of frags in a block in fs */
398 /* these are configuration parameters */
399         __fs32  fs_minfree;     /* minimum percentage of free blocks */
400         __fs32  fs_rotdelay;    /* num of ms for optimal next block */
401         __fs32  fs_rps;         /* disk revolutions per second */
402 /* these fields can be computed from the others */
403         __fs32  fs_bmask;       /* ``blkoff'' calc of blk offsets */
404         __fs32  fs_fmask;       /* ``fragoff'' calc of frag offsets */
405         __fs32  fs_bshift;      /* ``lblkno'' calc of logical blkno */
406         __fs32  fs_fshift;      /* ``numfrags'' calc number of frags */
407 /* these are configuration parameters */
408         __fs32  fs_maxcontig;   /* max number of contiguous blks */
409         __fs32  fs_maxbpg;      /* max number of blks per cyl group */
410 /* these fields can be computed from the others */
411         __fs32  fs_fragshift;   /* block to frag shift */
412         __fs32  fs_fsbtodb;     /* fsbtodb and dbtofsb shift constant */
413         __fs32  fs_sbsize;      /* actual size of super block */
414         __fs32  fs_csmask;      /* csum block offset */
415         __fs32  fs_csshift;     /* csum block number */
416         __fs32  fs_nindir;      /* value of NINDIR */
417         __fs32  fs_inopb;       /* value of INOPB */
418         __fs32  fs_nspf;        /* value of NSPF */
419 /* yet another configuration parameter */
420         __fs32  fs_optim;       /* optimization preference, see below */
421 /* these fields are derived from the hardware */
422         union {
423                 struct {
424                         __fs32  fs_npsect;      /* # sectors/track including spares */
425                 } fs_sun;
426                 struct {
427                         __fs32  fs_state;       /* file system state time stamp */
428                 } fs_sunx86;
429         } fs_u1;
430         __fs32  fs_interleave;  /* hardware sector interleave */
431         __fs32  fs_trackskew;   /* sector 0 skew, per track */
432 /* a unique id for this filesystem (currently unused and unmaintained) */
433 /* In 4.3 Tahoe this space is used by fs_headswitch and fs_trkseek */
434 /* Neither of those fields is used in the Tahoe code right now but */
435 /* there could be problems if they are.                            */
436         __fs32  fs_id[2];       /* file system id */
437 /* sizes determined by number of cylinder groups and their sizes */
438         __fs32  fs_csaddr;      /* blk addr of cyl grp summary area */
439         __fs32  fs_cssize;      /* size of cyl grp summary area */
440         __fs32  fs_cgsize;      /* cylinder group size */
441 /* these fields are derived from the hardware */
442         __fs32  fs_ntrak;       /* tracks per cylinder */
443         __fs32  fs_nsect;       /* sectors per track */
444         __fs32  fs_spc;         /* sectors per cylinder */
445 /* this comes from the disk driver partitioning */
446         __fs32  fs_ncyl;        /* cylinders in file system */
447 /* these fields can be computed from the others */
448         __fs32  fs_cpg;         /* cylinders per group */
449         __fs32  fs_ipg;         /* inodes per cylinder group */
450         __fs32  fs_fpg;         /* blocks per group * fs_frag */
451 /* this data must be re-computed after crashes */
452         struct ufs_csum fs_cstotal;     /* cylinder summary information */
453 /* these fields are cleared at mount time */
454         __s8    fs_fmod;        /* super block modified flag */
455         __s8    fs_clean;       /* file system is clean flag */
456         __s8    fs_ronly;       /* mounted read-only flag */
457         __s8    fs_flags;
458         union {
459                 struct {
460                         __s8    fs_fsmnt[UFS_MAXMNTLEN];/* name mounted on */
461                         __fs32  fs_cgrotor;     /* last cg searched */
462                         __fs32  fs_csp[UFS_MAXCSBUFS];/*list of fs_cs info buffers */
463                         __fs32  fs_maxcluster;
464                         __fs32  fs_cpc;         /* cyl per cycle in postbl */
465                         __fs16  fs_opostbl[16][8]; /* old rotation block list head */
466                 } fs_u1;
467                 struct {
468                         __s8  fs_fsmnt[UFS2_MAXMNTLEN]; /* name mounted on */
469                         __u8   fs_volname[UFS2_MAXVOLLEN]; /* volume name */
470                         __fs64  fs_swuid;               /* system-wide uid */
471                         __fs32  fs_pad; /* due to alignment of fs_swuid */
472                         __fs32   fs_cgrotor;     /* last cg searched */
473                         __fs32   fs_ocsp[UFS2_NOCSPTRS]; /*list of fs_cs info buffers */
474                         __fs32   fs_contigdirs;/*# of contiguously allocated dirs */
475                         __fs32   fs_csp;        /* cg summary info buffer for fs_cs */
476                         __fs32   fs_maxcluster;
477                         __fs32   fs_active;/* used by snapshots to track fs */
478                         __fs32   fs_old_cpc;    /* cyl per cycle in postbl */
479                         __fs32   fs_maxbsize;/*maximum blocking factor permitted */
480                         __fs64   fs_sparecon64[17];/*old rotation block list head */
481                         __fs64   fs_sblockloc; /* byte offset of standard superblock */
482                         struct  ufs2_csum_total fs_cstotal;/*cylinder summary information*/
483                         struct  ufs_timeval    fs_time;         /* last time written */
484                         __fs64    fs_size;              /* number of blocks in fs */
485                         __fs64    fs_dsize;     /* number of data blocks in fs */
486                         __fs64   fs_csaddr;     /* blk addr of cyl grp summary area */
487                         __fs64    fs_pendingblocks;/* blocks in process of being freed */
488                         __fs32    fs_pendinginodes;/*inodes in process of being freed */
489                 } fs_u2;
490         }  fs_u11;
491         union {
492                 struct {
493                         __fs32  fs_sparecon[53];/* reserved for future constants */
494                         __fs32  fs_reclaim;
495                         __fs32  fs_sparecon2[1];
496                         __fs32  fs_state;       /* file system state time stamp */
497                         __fs32  fs_qbmask[2];   /* ~usb_bmask */
498                         __fs32  fs_qfmask[2];   /* ~usb_fmask */
499                 } fs_sun;
500                 struct {
501                         __fs32  fs_sparecon[53];/* reserved for future constants */
502                         __fs32  fs_reclaim;
503                         __fs32  fs_sparecon2[1];
504                         __fs32  fs_npsect;      /* # sectors/track including spares */
505                         __fs32  fs_qbmask[2];   /* ~usb_bmask */
506                         __fs32  fs_qfmask[2];   /* ~usb_fmask */
507                 } fs_sunx86;
508                 struct {
509                         __fs32  fs_sparecon[50];/* reserved for future constants */
510                         __fs32  fs_contigsumsize;/* size of cluster summary array */
511                         __fs32  fs_maxsymlinklen;/* max length of an internal symlink */
512                         __fs32  fs_inodefmt;    /* format of on-disk inodes */
513                         __fs32  fs_maxfilesize[2];      /* max representable file size */
514                         __fs32  fs_qbmask[2];   /* ~usb_bmask */
515                         __fs32  fs_qfmask[2];   /* ~usb_fmask */
516                         __fs32  fs_state;       /* file system state time stamp */
517                 } fs_44;
518         } fs_u2;
519         __fs32  fs_postblformat;        /* format of positional layout tables */
520         __fs32  fs_nrpos;               /* number of rotational positions */
521         __fs32  fs_postbloff;           /* (__s16) rotation block list head */
522         __fs32  fs_rotbloff;            /* (__u8) blocks for each rotation */
523         __fs32  fs_magic;               /* magic number */
524         __u8    fs_space[1];            /* list of blocks for each rotation */
525 };
526 #endif/*struct ufs_super_block*/
527
528 /*
529  * Preference for optimization.
530  */
531 #define UFS_OPTTIME     0       /* minimize allocation time */
532 #define UFS_OPTSPACE    1       /* minimize disk fragmentation */
533
534 /*
535  * Rotational layout table format types
536  */
537 #define UFS_42POSTBLFMT         -1      /* 4.2BSD rotational table format */
538 #define UFS_DYNAMICPOSTBLFMT    1       /* dynamic rotational table format */
539
540 /*
541  * Convert cylinder group to base address of its global summary info.
542  */
543 #define fs_cs(indx) s_csp[(indx)]
544
545 /*
546  * Cylinder group block for a file system.
547  *
548  * Writable fields in the cylinder group are protected by the associated
549  * super block lock fs->fs_lock.
550  */
551 #define CG_MAGIC        0x090255
552 #define ufs_cg_chkmagic(sb, ucg) \
553         (fs32_to_cpu((sb), (ucg)->cg_magic) == CG_MAGIC)
554
555 /*
556  * size of this structure is 172 B
557  */
558 struct  ufs_cylinder_group {
559         __fs32  cg_link;                /* linked list of cyl groups */
560         __fs32  cg_magic;               /* magic number */
561         __fs32  cg_time;                /* time last written */
562         __fs32  cg_cgx;                 /* we are the cgx'th cylinder group */
563         __fs16  cg_ncyl;                /* number of cyl's this cg */
564         __fs16  cg_niblk;               /* number of inode blocks this cg */
565         __fs32  cg_ndblk;               /* number of data blocks this cg */
566         struct  ufs_csum cg_cs;         /* cylinder summary information */
567         __fs32  cg_rotor;               /* position of last used block */
568         __fs32  cg_frotor;              /* position of last used frag */
569         __fs32  cg_irotor;              /* position of last used inode */
570         __fs32  cg_frsum[UFS_MAXFRAG];  /* counts of available frags */
571         __fs32  cg_btotoff;             /* (__u32) block totals per cylinder */
572         __fs32  cg_boff;                /* (short) free block positions */
573         __fs32  cg_iusedoff;            /* (char) used inode map */
574         __fs32  cg_freeoff;             /* (u_char) free block map */
575         __fs32  cg_nextfreeoff;         /* (u_char) next available space */
576         union {
577                 struct {
578                         __fs32  cg_clustersumoff;       /* (u_int32) counts of avail clusters */
579                         __fs32  cg_clusteroff;          /* (u_int8) free cluster map */
580                         __fs32  cg_nclusterblks;        /* number of clusters this cg */
581                         __fs32  cg_sparecon[13];        /* reserved for future use */
582                 } cg_44;
583                 struct {
584                         __fs32  cg_clustersumoff;/* (u_int32) counts of avail clusters */
585                         __fs32  cg_clusteroff;  /* (u_int8) free cluster map */
586                         __fs32  cg_nclusterblks;/* number of clusters this cg */
587                         __fs32   cg_niblk; /* number of inode blocks this cg */
588                         __fs32   cg_initediblk; /* last initialized inode */
589                         __fs32   cg_sparecon32[3];/* reserved for future use */
590                         __fs64   cg_time;       /* time last written */
591                         __fs64  cg_sparecon[3]; /* reserved for future use */
592                 } cg_u2;
593                 __fs32  cg_sparecon[16];        /* reserved for future use */
594         } cg_u;
595         __u8    cg_space[1];            /* space for cylinder group maps */
596 /* actually longer */
597 };
598
599 /*
600  * structure of an on-disk inode
601  */
602 struct ufs_inode {
603         __fs16  ui_mode;                /*  0x0 */
604         __fs16  ui_nlink;               /*  0x2 */
605         union {
606                 struct {
607                         __fs16  ui_suid;        /*  0x4 */
608                         __fs16  ui_sgid;        /*  0x6 */
609                 } oldids;
610                 __fs32  ui_inumber;             /*  0x4 lsf: inode number */
611                 __fs32  ui_author;              /*  0x4 GNU HURD: author */
612         } ui_u1;
613         __fs64  ui_size;                /*  0x8 */
614         struct ufs_timeval ui_atime;    /* 0x10 access */
615         struct ufs_timeval ui_mtime;    /* 0x18 modification */
616         struct ufs_timeval ui_ctime;    /* 0x20 creation */
617         union {
618                 struct {
619                         __fs32  ui_db[UFS_NDADDR];/* 0x28 data blocks */
620                         __fs32  ui_ib[UFS_NINDIR];/* 0x58 indirect blocks */
621                 } ui_addr;
622                 __u8    ui_symlink[4*(UFS_NDADDR+UFS_NINDIR)];/* 0x28 fast symlink */
623         } ui_u2;
624         __fs32  ui_flags;               /* 0x64 immutable, append-only... */
625         __fs32  ui_blocks;              /* 0x68 blocks in use */
626         __fs32  ui_gen;                 /* 0x6c like ext2 i_version, for NFS support */
627         union {
628                 struct {
629                         __fs32  ui_shadow;      /* 0x70 shadow inode with security data */
630                         __fs32  ui_uid;         /* 0x74 long EFT version of uid */
631                         __fs32  ui_gid;         /* 0x78 long EFT version of gid */
632                         __fs32  ui_oeftflag;    /* 0x7c reserved */
633                 } ui_sun;
634                 struct {
635                         __fs32  ui_uid;         /* 0x70 File owner */
636                         __fs32  ui_gid;         /* 0x74 File group */
637                         __fs32  ui_spare[2];    /* 0x78 reserved */
638                 } ui_44;
639                 struct {
640                         __fs32  ui_uid;         /* 0x70 */
641                         __fs32  ui_gid;         /* 0x74 */
642                         __fs16  ui_modeh;       /* 0x78 mode high bits */
643                         __fs16  ui_spare;       /* 0x7A unused */
644                         __fs32  ui_trans;       /* 0x7c filesystem translator */
645                 } ui_hurd;
646         } ui_u3;
647 };
648
649 #define UFS_NXADDR  2            /* External addresses in inode. */
650 struct ufs2_inode {
651         __fs16     ui_mode;        /*   0: IFMT, permissions; see below. */
652         __fs16     ui_nlink;       /*   2: File link count. */
653         __fs32     ui_uid;         /*   4: File owner. */
654         __fs32     ui_gid;         /*   8: File group. */
655         __fs32     ui_blksize;     /*  12: Inode blocksize. */
656         __fs64     ui_size;        /*  16: File byte count. */
657         __fs64     ui_blocks;      /*  24: Bytes actually held. */
658         struct ufs_timeval   ui_atime;       /*  32: Last access time. */
659         struct ufs_timeval   ui_mtime;       /*  40: Last modified time. */
660         struct ufs_timeval   ui_ctime;       /*  48: Last inode change time. */
661         struct ufs_timeval   ui_birthtime;   /*  56: Inode creation time. */
662         __fs32     ui_mtimensec;   /*  64: Last modified time. */
663         __fs32     ui_atimensec;   /*  68: Last access time. */
664         __fs32     ui_ctimensec;   /*  72: Last inode change time. */
665         __fs32     ui_birthnsec;   /*  76: Inode creation time. */
666         __fs32     ui_gen;         /*  80: Generation number. */
667         __fs32     ui_kernflags;   /*  84: Kernel flags. */
668         __fs32     ui_flags;       /*  88: Status flags (chflags). */
669         __fs32     ui_extsize;     /*  92: External attributes block. */
670         __fs64     ui_extb[UFS_NXADDR];/*  96: External attributes block. */
671         union {
672                 struct {
673                         __fs64     ui_db[UFS_NDADDR]; /* 112: Direct disk blocks. */
674                         __fs64     ui_ib[UFS_NINDIR];/* 208: Indirect disk blocks.*/
675                 } ui_addr;
676         __u8    ui_symlink[2*4*(UFS_NDADDR+UFS_NINDIR)];/* 0x28 fast symlink */
677         } ui_u2;
678         __fs64     ui_spare[3];    /* 232: Reserved; currently unused */
679 };
680
681
682 /* FreeBSD has these in sys/stat.h */
683 /* ui_flags that can be set by a file owner */
684 #define UFS_UF_SETTABLE   0x0000ffff
685 #define UFS_UF_NODUMP     0x00000001  /* do not dump */
686 #define UFS_UF_IMMUTABLE  0x00000002  /* immutable (can't "change") */
687 #define UFS_UF_APPEND     0x00000004  /* append-only */
688 #define UFS_UF_OPAQUE     0x00000008  /* directory is opaque (unionfs) */
689 #define UFS_UF_NOUNLINK   0x00000010  /* can't be removed or renamed */
690 /* ui_flags that only root can set */
691 #define UFS_SF_SETTABLE   0xffff0000
692 #define UFS_SF_ARCHIVED   0x00010000  /* archived */
693 #define UFS_SF_IMMUTABLE  0x00020000  /* immutable (can't "change") */
694 #define UFS_SF_APPEND     0x00040000  /* append-only */
695 #define UFS_SF_NOUNLINK   0x00100000  /* can't be removed or renamed */
696
697 /*
698  * This structure is used for reading disk structures larger
699  * than the size of fragment.
700  */
701 struct ufs_buffer_head {
702         __u64 fragment;                 /* first fragment */
703         __u64 count;                            /* number of fragments */
704         struct buffer_head * bh[UFS_MAXFRAG];   /* buffers */
705 };
706
707 struct ufs_cg_private_info {
708         struct ufs_buffer_head c_ubh;
709         __u32   c_cgx;          /* number of cylidner group */
710         __u16   c_ncyl;         /* number of cyl's this cg */
711         __u16   c_niblk;        /* number of inode blocks this cg */
712         __u32   c_ndblk;        /* number of data blocks this cg */
713         __u32   c_rotor;        /* position of last used block */
714         __u32   c_frotor;       /* position of last used frag */
715         __u32   c_irotor;       /* position of last used inode */
716         __u32   c_btotoff;      /* (__u32) block totals per cylinder */
717         __u32   c_boff;         /* (short) free block positions */
718         __u32   c_iusedoff;     /* (char) used inode map */
719         __u32   c_freeoff;      /* (u_char) free block map */
720         __u32   c_nextfreeoff;  /* (u_char) next available space */
721         __u32   c_clustersumoff;/* (u_int32) counts of avail clusters */
722         __u32   c_clusteroff;   /* (u_int8) free cluster map */
723         __u32   c_nclusterblks; /* number of clusters this cg */
724 };      
725
726 struct ufs_sb_private_info {
727         struct ufs_buffer_head s_ubh; /* buffer containing super block */
728         struct ufs_csum_core cs_total;
729         __u32   s_sblkno;       /* offset of super-blocks in filesys */
730         __u32   s_cblkno;       /* offset of cg-block in filesys */
731         __u32   s_iblkno;       /* offset of inode-blocks in filesys */
732         __u32   s_dblkno;       /* offset of first data after cg */
733         __u32   s_cgoffset;     /* cylinder group offset in cylinder */
734         __u32   s_cgmask;       /* used to calc mod fs_ntrak */
735         __u32   s_size;         /* number of blocks (fragments) in fs */
736         __u32   s_dsize;        /* number of data blocks in fs */
737         __u64   s_u2_size;      /* ufs2: number of blocks (fragments) in fs */
738         __u64   s_u2_dsize;     /*ufs2:  number of data blocks in fs */
739         __u32   s_ncg;          /* number of cylinder groups */
740         __u32   s_bsize;        /* size of basic blocks */
741         __u32   s_fsize;        /* size of fragments */
742         __u32   s_fpb;          /* fragments per block */
743         __u32   s_minfree;      /* minimum percentage of free blocks */
744         __u32   s_bmask;        /* `blkoff'' calc of blk offsets */
745         __u32   s_fmask;        /* s_fsize mask */
746         __u32   s_bshift;       /* `lblkno'' calc of logical blkno */
747         __u32   s_fshift;       /* s_fsize shift */
748         __u32   s_fpbshift;     /* fragments per block shift */
749         __u32   s_fsbtodb;      /* fsbtodb and dbtofsb shift constant */
750         __u32   s_sbsize;       /* actual size of super block */
751         __u32   s_csmask;       /* csum block offset */
752         __u32   s_csshift;      /* csum block number */
753         __u32   s_nindir;       /* value of NINDIR */
754         __u32   s_inopb;        /* value of INOPB */
755         __u32   s_nspf;         /* value of NSPF */
756         __u32   s_npsect;       /* # sectors/track including spares */
757         __u32   s_interleave;   /* hardware sector interleave */
758         __u32   s_trackskew;    /* sector 0 skew, per track */
759         __u32   s_csaddr;       /* blk addr of cyl grp summary area */
760         __u32   s_cssize;       /* size of cyl grp summary area */
761         __u32   s_cgsize;       /* cylinder group size */
762         __u32   s_ntrak;        /* tracks per cylinder */
763         __u32   s_nsect;        /* sectors per track */
764         __u32   s_spc;          /* sectors per cylinder */
765         __u32   s_ipg;          /* inodes per cylinder group */
766         __u32   s_fpg;          /* fragments per group */
767         __u32   s_cpc;          /* cyl per cycle in postbl */
768         __s32   s_contigsumsize;/* size of cluster summary array, 44bsd */
769         __s64   s_qbmask;       /* ~usb_bmask */
770         __s64   s_qfmask;       /* ~usb_fmask */
771         __s32   s_postblformat; /* format of positional layout tables */
772         __s32   s_nrpos;        /* number of rotational positions */
773         __s32   s_postbloff;    /* (__s16) rotation block list head */
774         __s32   s_rotbloff;     /* (__u8) blocks for each rotation */
775
776         __u32   s_fpbmask;      /* fragments per block mask */
777         __u32   s_apb;          /* address per block */
778         __u32   s_2apb;         /* address per block^2 */
779         __u32   s_3apb;         /* address per block^3 */
780         __u32   s_apbmask;      /* address per block mask */
781         __u32   s_apbshift;     /* address per block shift */
782         __u32   s_2apbshift;    /* address per block shift * 2 */
783         __u32   s_3apbshift;    /* address per block shift * 3 */
784         __u32   s_nspfshift;    /* number of sector per fragment shift */
785         __u32   s_nspb;         /* number of sector per block */
786         __u32   s_inopf;        /* inodes per fragment */
787         __u32   s_sbbase;       /* offset of NeXTstep superblock */
788         __u32   s_bpf;          /* bits per fragment */
789         __u32   s_bpfshift;     /* bits per fragment shift*/
790         __u32   s_bpfmask;      /* bits per fragment mask */
791
792         __u32   s_maxsymlinklen;/* upper limit on fast symlinks' size */
793         __s32   fs_magic;       /* filesystem magic */
794         unsigned int s_dirblksize;
795 };
796
797 /*
798  * Sizes of this structures are:
799  *      ufs_super_block_first   512
800  *      ufs_super_block_second  512
801  *      ufs_super_block_third   356
802  */
803 struct ufs_super_block_first {
804         __fs32  fs_link;
805         __fs32  fs_rlink;
806         __fs32  fs_sblkno;
807         __fs32  fs_cblkno;
808         __fs32  fs_iblkno;
809         __fs32  fs_dblkno;
810         __fs32  fs_cgoffset;
811         __fs32  fs_cgmask;
812         __fs32  fs_time;
813         __fs32  fs_size;
814         __fs32  fs_dsize;
815         __fs32  fs_ncg;
816         __fs32  fs_bsize;
817         __fs32  fs_fsize;
818         __fs32  fs_frag;
819         __fs32  fs_minfree;
820         __fs32  fs_rotdelay;
821         __fs32  fs_rps;
822         __fs32  fs_bmask;
823         __fs32  fs_fmask;
824         __fs32  fs_bshift;
825         __fs32  fs_fshift;
826         __fs32  fs_maxcontig;
827         __fs32  fs_maxbpg;
828         __fs32  fs_fragshift;
829         __fs32  fs_fsbtodb;
830         __fs32  fs_sbsize;
831         __fs32  fs_csmask;
832         __fs32  fs_csshift;
833         __fs32  fs_nindir;
834         __fs32  fs_inopb;
835         __fs32  fs_nspf;
836         __fs32  fs_optim;
837         union {
838                 struct {
839                         __fs32  fs_npsect;
840                 } fs_sun;
841                 struct {
842                         __fs32  fs_state;
843                 } fs_sunx86;
844         } fs_u1;
845         __fs32  fs_interleave;
846         __fs32  fs_trackskew;
847         __fs32  fs_id[2];
848         __fs32  fs_csaddr;
849         __fs32  fs_cssize;
850         __fs32  fs_cgsize;
851         __fs32  fs_ntrak;
852         __fs32  fs_nsect;
853         __fs32  fs_spc;
854         __fs32  fs_ncyl;
855         __fs32  fs_cpg;
856         __fs32  fs_ipg;
857         __fs32  fs_fpg;
858         struct ufs_csum fs_cstotal;
859         __s8    fs_fmod;
860         __s8    fs_clean;
861         __s8    fs_ronly;
862         __s8    fs_flags;
863         __s8    fs_fsmnt[UFS_MAXMNTLEN - 212];
864
865 };
866
867 struct ufs_super_block_second {
868         union {
869                 struct {
870                         __s8    fs_fsmnt[212];
871                         __fs32  fs_cgrotor;
872                         __fs32  fs_csp[UFS_MAXCSBUFS];
873                         __fs32  fs_maxcluster;
874                         __fs32  fs_cpc;
875                         __fs16  fs_opostbl[82];
876                 } fs_u1;
877                 struct {
878                         __s8  fs_fsmnt[UFS2_MAXMNTLEN - UFS_MAXMNTLEN + 212];
879                         __u8   fs_volname[UFS2_MAXVOLLEN];
880                         __fs64  fs_swuid;
881                         __fs32  fs_pad;
882                         __fs32   fs_cgrotor;
883                         __fs32   fs_ocsp[UFS2_NOCSPTRS];
884                         __fs32   fs_contigdirs;
885                         __fs32   fs_csp;
886                         __fs32   fs_maxcluster;
887                         __fs32   fs_active;
888                         __fs32   fs_old_cpc;
889                         __fs32   fs_maxbsize;
890                         __fs64   fs_sparecon64[17];
891                         __fs64   fs_sblockloc;
892                         __fs64  cs_ndir;
893                         __fs64  cs_nbfree;
894                 } fs_u2;
895         } fs_un;
896 };
897
898 struct ufs_super_block_third {
899         union {
900                 struct {
901                         __fs16  fs_opostbl[46];
902                 } fs_u1;
903                 struct {
904                         __fs64  cs_nifree;      /* number of free inodes */
905                         __fs64  cs_nffree;      /* number of free frags */
906                         __fs64   cs_numclusters;        /* number of free clusters */
907                         __fs64   cs_spare[3];   /* future expansion */
908                         struct  ufs_timeval    fs_time;         /* last time written */
909                         __fs64    fs_size;              /* number of blocks in fs */
910                         __fs64    fs_dsize;     /* number of data blocks in fs */
911                         __fs64   fs_csaddr;     /* blk addr of cyl grp summary area */
912                         __fs64    fs_pendingblocks;/* blocks in process of being freed */
913                         __fs32    fs_pendinginodes;/*inodes in process of being freed */
914                 } __attribute__ ((packed)) fs_u2;
915         } fs_un1;
916         union {
917                 struct {
918                         __fs32  fs_sparecon[53];/* reserved for future constants */
919                         __fs32  fs_reclaim;
920                         __fs32  fs_sparecon2[1];
921                         __fs32  fs_state;       /* file system state time stamp */
922                         __fs32  fs_qbmask[2];   /* ~usb_bmask */
923                         __fs32  fs_qfmask[2];   /* ~usb_fmask */
924                 } fs_sun;
925                 struct {
926                         __fs32  fs_sparecon[53];/* reserved for future constants */
927                         __fs32  fs_reclaim;
928                         __fs32  fs_sparecon2[1];
929                         __fs32  fs_npsect;      /* # sectors/track including spares */
930                         __fs32  fs_qbmask[2];   /* ~usb_bmask */
931                         __fs32  fs_qfmask[2];   /* ~usb_fmask */
932                 } fs_sunx86;
933                 struct {
934                         __fs32  fs_sparecon[50];/* reserved for future constants */
935                         __fs32  fs_contigsumsize;/* size of cluster summary array */
936                         __fs32  fs_maxsymlinklen;/* max length of an internal symlink */
937                         __fs32  fs_inodefmt;    /* format of on-disk inodes */
938                         __fs32  fs_maxfilesize[2];      /* max representable file size */
939                         __fs32  fs_qbmask[2];   /* ~usb_bmask */
940                         __fs32  fs_qfmask[2];   /* ~usb_fmask */
941                         __fs32  fs_state;       /* file system state time stamp */
942                 } fs_44;
943         } fs_un2;
944         __fs32  fs_postblformat;
945         __fs32  fs_nrpos;
946         __fs32  fs_postbloff;
947         __fs32  fs_rotbloff;
948         __fs32  fs_magic;
949         __u8    fs_space[1];
950 };
951
952 #ifdef __KERNEL__
953
954 /* balloc.c */
955 extern void ufs_free_fragments (struct inode *, unsigned, unsigned);
956 extern void ufs_free_blocks (struct inode *, unsigned, unsigned);
957 extern unsigned ufs_new_fragments(struct inode *, __fs32 *, unsigned, unsigned,
958                                   unsigned, int *, struct page *);
959
960 /* cylinder.c */
961 extern struct ufs_cg_private_info * ufs_load_cylinder (struct super_block *, unsigned);
962 extern void ufs_put_cylinder (struct super_block *, unsigned);
963
964 /* dir.c */
965 extern struct inode_operations ufs_dir_inode_operations;
966 extern int ufs_add_link (struct dentry *, struct inode *);
967 extern ino_t ufs_inode_by_name(struct inode *, struct dentry *);
968 extern int ufs_make_empty(struct inode *, struct inode *);
969 extern struct ufs_dir_entry *ufs_find_entry(struct inode *, struct dentry *, struct page **);
970 extern int ufs_delete_entry(struct inode *, struct ufs_dir_entry *, struct page *);
971 extern int ufs_empty_dir (struct inode *);
972 extern struct ufs_dir_entry *ufs_dotdot(struct inode *, struct page **);
973 extern void ufs_set_link(struct inode *dir, struct ufs_dir_entry *de,
974                          struct page *page, struct inode *inode);
975
976 /* file.c */
977 extern struct inode_operations ufs_file_inode_operations;
978 extern const struct file_operations ufs_file_operations;
979
980 extern const struct address_space_operations ufs_aops;
981
982 /* ialloc.c */
983 extern void ufs_free_inode (struct inode *inode);
984 extern struct inode * ufs_new_inode (struct inode *, int);
985
986 /* inode.c */
987 extern void ufs_read_inode (struct inode *);
988 extern void ufs_put_inode (struct inode *);
989 extern int ufs_write_inode (struct inode *, int);
990 extern int ufs_sync_inode (struct inode *);
991 extern void ufs_delete_inode (struct inode *);
992 extern struct buffer_head * ufs_bread (struct inode *, unsigned, int, int *);
993 extern int ufs_getfrag_block (struct inode *inode, sector_t fragment, struct buffer_head *bh_result, int create);
994
995 /* namei.c */
996 extern const struct file_operations ufs_dir_operations;
997         
998 /* super.c */
999 extern void ufs_warning (struct super_block *, const char *, const char *, ...) __attribute__ ((format (printf, 3, 4)));
1000 extern void ufs_error (struct super_block *, const char *, const char *, ...) __attribute__ ((format (printf, 3, 4)));
1001 extern void ufs_panic (struct super_block *, const char *, const char *, ...) __attribute__ ((format (printf, 3, 4)));
1002
1003 /* symlink.c */
1004 extern struct inode_operations ufs_fast_symlink_inode_operations;
1005
1006 /* truncate.c */
1007 extern int ufs_truncate (struct inode *, loff_t);
1008
1009 static inline struct ufs_sb_info *UFS_SB(struct super_block *sb)
1010 {
1011         return sb->s_fs_info;
1012 }
1013
1014 static inline struct ufs_inode_info *UFS_I(struct inode *inode)
1015 {
1016         return container_of(inode, struct ufs_inode_info, vfs_inode);
1017 }
1018
1019 #endif  /* __KERNEL__ */
1020
1021 #endif /* __LINUX_UFS_FS_H */