added a lot of printk output to ease writing of emulator
[linux-2.4.21-pre4.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  */
26
27 #ifndef __LINUX_UFS_FS_H
28 #define __LINUX_UFS_FS_H
29
30 #include <linux/types.h>
31 #include <linux/kernel.h>
32 #include <linux/time.h>
33 #include <linux/stat.h>
34
35 #define UFS_BBLOCK 0
36 #define UFS_BBSIZE 8192
37 #define UFS_SBLOCK 8192
38 #define UFS_SBSIZE 8192
39
40 #define UFS_SECTOR_SIZE 512
41 #define UFS_SECTOR_BITS 9
42 #define UFS_MAGIC 0x00011954
43 #define UFS_CIGAM 0x54190100 /* byteswapped MAGIC */
44
45
46 /* HP specific MAGIC values */
47
48 #define UFS_MAGIC_LFN   0x00095014 /* fs supports filenames > 14 chars */
49 #define UFS_CIGAM_LFN   0x14500900 /* srahc 41 < semanelif stroppus sf */
50
51 #define UFS_MAGIC_SEC   0x00612195 /* B1 security fs */
52 #define UFS_CIGAM_SEC   0x95216100
53
54 #define UFS_MAGIC_FEA   0x00195612 /* fs_featurebits supported */
55 #define UFS_CIGAM_FEA   0x12561900
56
57 #define UFS_MAGIC_4GB   0x05231994 /* fs > 4 GB && fs_featurebits */
58 #define UFS_CIGAM_4GB   0x94192305
59
60 /* Seems somebody at HP goofed here. B1 and lfs are both 0x2 !?! */
61 #define UFS_FSF_LFN     0x00000001 /* long file names */
62 #define UFS_FSF_B1      0x00000002 /* B1 security */
63 #define UFS_FSF_LFS     0x00000002 /* large files */
64 #define UFS_FSF_LUID    0x00000004 /* large UIDs */
65
66 /* End of HP stuff */
67
68
69 #define UFS_BSIZE       8192
70 #define UFS_MINBSIZE    4096
71 #define UFS_FSIZE       1024
72 #define UFS_MAXFRAG     (UFS_BSIZE / UFS_FSIZE)
73
74 #define UFS_NDADDR 12
75 #define UFS_NINDIR 3
76
77 #define UFS_IND_BLOCK   (UFS_NDADDR + 0)
78 #define UFS_DIND_BLOCK  (UFS_NDADDR + 1)
79 #define UFS_TIND_BLOCK  (UFS_NDADDR + 2)
80
81 #define UFS_NDIR_FRAGMENT (UFS_NDADDR << uspi->s_fpbshift)
82 #define UFS_IND_FRAGMENT (UFS_IND_BLOCK << uspi->s_fpbshift)
83 #define UFS_DIND_FRAGMENT (UFS_DIND_BLOCK << uspi->s_fpbshift)
84 #define UFS_TIND_FRAGMENT (UFS_TIND_BLOCK << uspi->s_fpbshift)
85
86 #define UFS_ROOTINO 2
87 #define UFS_FIRST_INO (UFS_ROOTINO + 1)
88
89 #define UFS_USEEFT  ((__u16)65535)
90
91 #define UFS_FSOK      0x7c269d38
92 #define UFS_FSACTIVE  ((char)0x00)
93 #define UFS_FSCLEAN   ((char)0x01)
94 #define UFS_FSSTABLE  ((char)0x02)
95 #define UFS_FSOSF1    ((char)0x03)      /* is this correct for DEC OSF/1? */
96 #define UFS_FSBAD     ((char)0xff)
97
98 /* From here to next blank line, s_flags for ufs_sb_info */
99 /* directory entry encoding */
100 #define UFS_DE_MASK             0x00000010      /* mask for the following */
101 #define UFS_DE_OLD              0x00000000
102 #define UFS_DE_44BSD            0x00000010
103 /* uid encoding */
104 #define UFS_UID_MASK            0x00000060      /* mask for the following */
105 #define UFS_UID_OLD             0x00000000
106 #define UFS_UID_44BSD           0x00000020
107 #define UFS_UID_EFT             0x00000040
108 /* superblock state encoding */
109 #define UFS_ST_MASK             0x00000700      /* mask for the following */
110 #define UFS_ST_OLD              0x00000000
111 #define UFS_ST_44BSD            0x00000100
112 #define UFS_ST_SUN              0x00000200
113 #define UFS_ST_SUNx86           0x00000400
114 /*cylinder group encoding */
115 #define UFS_CG_MASK             0x00003000      /* mask for the following */
116 #define UFS_CG_OLD              0x00000000
117 #define UFS_CG_44BSD            0x00002000
118 #define UFS_CG_SUN              0x00001000
119
120 /* fs_inodefmt options */
121 #define UFS_42INODEFMT  -1
122 #define UFS_44INODEFMT  2
123
124 /* mount options */
125 #define UFS_MOUNT_ONERROR               0x0000000F
126 #define UFS_MOUNT_ONERROR_PANIC         0x00000001
127 #define UFS_MOUNT_ONERROR_LOCK          0x00000002
128 #define UFS_MOUNT_ONERROR_UMOUNT        0x00000004
129 #define UFS_MOUNT_ONERROR_REPAIR        0x00000008
130
131 #define UFS_MOUNT_UFSTYPE               0x00000FF0
132 #define UFS_MOUNT_UFSTYPE_OLD           0x00000010
133 #define UFS_MOUNT_UFSTYPE_44BSD         0x00000020
134 #define UFS_MOUNT_UFSTYPE_SUN           0x00000040
135 #define UFS_MOUNT_UFSTYPE_NEXTSTEP      0x00000080
136 #define UFS_MOUNT_UFSTYPE_NEXTSTEP_CD   0x00000100
137 #define UFS_MOUNT_UFSTYPE_OPENSTEP      0x00000200
138 #define UFS_MOUNT_UFSTYPE_SUNx86        0x00000400
139 #define UFS_MOUNT_UFSTYPE_HP            0x00000800
140
141 #define ufs_clear_opt(o,opt)    o &= ~UFS_MOUNT_##opt
142 #define ufs_set_opt(o,opt)      o |= UFS_MOUNT_##opt
143 #define ufs_test_opt(o,opt)     ((o) & UFS_MOUNT_##opt)
144
145 /*
146  * MINFREE gives the minimum acceptable percentage of file system
147  * blocks which may be free. If the freelist drops below this level
148  * only the superuser may continue to allocate blocks. This may
149  * be set to 0 if no reserve of free blocks is deemed necessary,
150  * however throughput drops by fifty percent if the file system
151  * is run at between 95% and 100% full; thus the minimum default
152  * value of fs_minfree is 5%. However, to get good clustering
153  * performance, 10% is a better choice. hence we use 10% as our
154  * default value. With 10% free space, fragmentation is not a
155  * problem, so we choose to optimize for time.
156  */
157 #define UFS_MINFREE         5
158 #define UFS_DEFAULTOPT      UFS_OPTTIME
159             
160 /*
161  * Turn file system block numbers into disk block addresses.
162  * This maps file system blocks to device size blocks.
163  */
164 #define ufs_fsbtodb(uspi, b)    ((b) << (uspi)->s_fsbtodb)
165 #define ufs_dbtofsb(uspi, b)    ((b) >> (uspi)->s_fsbtodb)
166
167 /*
168  * Cylinder group macros to locate things in cylinder groups.
169  * They calc file system addresses of cylinder group data structures.
170  */
171 #define ufs_cgbase(c)   (uspi->s_fpg * (c))
172 #define ufs_cgstart(c)  (ufs_cgbase(c)  + uspi->s_cgoffset * ((c) & ~uspi->s_cgmask))
173 #define ufs_cgsblock(c) (ufs_cgstart(c) + uspi->s_sblkno)       /* super blk */
174 #define ufs_cgcmin(c)   (ufs_cgstart(c) + uspi->s_cblkno)       /* cg block */
175 #define ufs_cgimin(c)   (ufs_cgstart(c) + uspi->s_iblkno)       /* inode blk */
176 #define ufs_cgdmin(c)   (ufs_cgstart(c) + uspi->s_dblkno)       /* 1st data */
177
178 /*
179  * Macros for handling inode numbers:
180  *     inode number to file system block offset.
181  *     inode number to cylinder group number.
182  *     inode number to file system block address.
183  */
184 #define ufs_inotocg(x)          ((x) / uspi->s_ipg)
185 #define ufs_inotocgoff(x)       ((x) % uspi->s_ipg)
186 #define ufs_inotofsba(x)        (ufs_cgimin(ufs_inotocg(x)) + ufs_inotocgoff(x) / uspi->s_inopf)
187 #define ufs_inotofsbo(x)        ((x) % uspi->s_inopf)
188
189 /*
190  * Give cylinder group number for a file system block.
191  * Give cylinder group block number for a file system block.
192  */
193 #define ufs_dtog(d)     ((d) / uspi->s_fpg)
194 #define ufs_dtogd(d)    ((d) % uspi->s_fpg)
195
196 /*
197  * Compute the cylinder and rotational position of a cyl block addr.
198  */
199 #define ufs_cbtocylno(bno) \
200         ((bno) * uspi->s_nspf / uspi->s_spc)
201 #define ufs_cbtorpos(bno) \
202         ((((bno) * uspi->s_nspf % uspi->s_spc / uspi->s_nsect \
203         * uspi->s_trackskew + (bno) * uspi->s_nspf % uspi->s_spc \
204         % uspi->s_nsect * uspi->s_interleave) % uspi->s_nsect \
205         * uspi->s_nrpos) / uspi->s_npsect)
206
207 /*
208  * The following macros optimize certain frequently calculated
209  * quantities by using shifts and masks in place of divisions
210  * modulos and multiplications.
211  */
212 #define ufs_blkoff(loc)         ((loc) & uspi->s_qbmask)
213 #define ufs_fragoff(loc)        ((loc) & uspi->s_qfmask)
214 #define ufs_lblktosize(blk)     ((blk) << uspi->s_bshift)
215 #define ufs_lblkno(loc)         ((loc) >> uspi->s_bshift)
216 #define ufs_numfrags(loc)       ((loc) >> uspi->s_fshift)
217 #define ufs_blkroundup(size)    (((size) + uspi->s_qbmask) & uspi->s_bmask)
218 #define ufs_fragroundup(size)   (((size) + uspi->s_qfmask) & uspi->s_fmask)
219 #define ufs_fragstoblks(frags)  ((frags) >> uspi->s_fpbshift)
220 #define ufs_blkstofrags(blks)   ((blks) << uspi->s_fpbshift)
221 #define ufs_fragnum(fsb)        ((fsb) & uspi->s_fpbmask)
222 #define ufs_blknum(fsb)         ((fsb) & ~uspi->s_fpbmask)
223
224 #define UFS_MAXNAMLEN 255
225 #define UFS_MAXMNTLEN 512
226 #define UFS_MAXCSBUFS 31
227 #define UFS_LINK_MAX 32000
228
229 /*
230  * UFS_DIR_PAD defines the directory entries boundaries
231  * (must be a multiple of 4)
232  */
233 #define UFS_DIR_PAD                     4
234 #define UFS_DIR_ROUND                   (UFS_DIR_PAD - 1)
235 #define UFS_DIR_REC_LEN(name_len)       (((name_len) + 1 + 8 + UFS_DIR_ROUND) & ~UFS_DIR_ROUND)
236
237 struct ufs_timeval {
238         __s32   tv_sec;
239         __s32   tv_usec;
240 };
241
242 struct ufs_dir_entry {
243         __u32  d_ino;                   /* inode number of this entry */
244         __u16  d_reclen;                /* length of this entry */
245         union {
246                 __u16   d_namlen;               /* actual length of d_name */
247                 struct {
248                         __u8    d_type;         /* file type */
249                         __u8    d_namlen;       /* length of string in d_name */
250                 } d_44;
251         } d_u;
252         __u8    d_name[UFS_MAXNAMLEN + 1];      /* file name */
253 };
254
255 struct ufs_csum {
256         __u32   cs_ndir;        /* number of directories */
257         __u32   cs_nbfree;      /* number of free blocks */
258         __u32   cs_nifree;      /* number of free inodes */
259         __u32   cs_nffree;      /* number of free frags */
260 };
261
262 /*
263  * This is the actual superblock, as it is laid out on the disk.
264  */
265 struct ufs_super_block {
266         __u32   fs_link;        /* UNUSED */
267         __u32   fs_rlink;       /* UNUSED */
268         __u32   fs_sblkno;      /* addr of super-block in filesys */
269         __u32   fs_cblkno;      /* offset of cyl-block in filesys */
270         __u32   fs_iblkno;      /* offset of inode-blocks in filesys */
271         __u32   fs_dblkno;      /* offset of first data after cg */
272         __u32   fs_cgoffset;    /* cylinder group offset in cylinder */
273         __u32   fs_cgmask;      /* used to calc mod fs_ntrak */
274         __u32   fs_time;        /* last time written -- time_t */
275         __u32   fs_size;        /* number of blocks in fs */
276         __u32   fs_dsize;       /* number of data blocks in fs */
277         __u32   fs_ncg;         /* number of cylinder groups */
278         __u32   fs_bsize;       /* size of basic blocks in fs */
279         __u32   fs_fsize;       /* size of frag blocks in fs */
280         __u32   fs_frag;        /* number of frags in a block in fs */
281 /* these are configuration parameters */
282         __u32   fs_minfree;     /* minimum percentage of free blocks */
283         __u32   fs_rotdelay;    /* num of ms for optimal next block */
284         __u32   fs_rps;         /* disk revolutions per second */
285 /* these fields can be computed from the others */
286         __u32   fs_bmask;       /* ``blkoff'' calc of blk offsets */
287         __u32   fs_fmask;       /* ``fragoff'' calc of frag offsets */
288         __u32   fs_bshift;      /* ``lblkno'' calc of logical blkno */
289         __u32   fs_fshift;      /* ``numfrags'' calc number of frags */
290 /* these are configuration parameters */
291         __u32   fs_maxcontig;   /* max number of contiguous blks */
292         __u32   fs_maxbpg;      /* max number of blks per cyl group */
293 /* these fields can be computed from the others */
294         __u32   fs_fragshift;   /* block to frag shift */
295         __u32   fs_fsbtodb;     /* fsbtodb and dbtofsb shift constant */
296         __u32   fs_sbsize;      /* actual size of super block */
297         __u32   fs_csmask;      /* csum block offset */
298         __u32   fs_csshift;     /* csum block number */
299         __u32   fs_nindir;      /* value of NINDIR */
300         __u32   fs_inopb;       /* value of INOPB */
301         __u32   fs_nspf;        /* value of NSPF */
302 /* yet another configuration parameter */
303         __u32   fs_optim;       /* optimization preference, see below */
304 /* these fields are derived from the hardware */
305         union {
306                 struct {
307                         __u32   fs_npsect;      /* # sectors/track including spares */
308                 } fs_sun;
309                 struct {
310                         __s32   fs_state;       /* file system state time stamp */
311                 } fs_sunx86;
312         } fs_u1;
313         __u32   fs_interleave;  /* hardware sector interleave */
314         __u32   fs_trackskew;   /* sector 0 skew, per track */
315 /* a unique id for this filesystem (currently unused and unmaintained) */
316 /* In 4.3 Tahoe this space is used by fs_headswitch and fs_trkseek */
317 /* Neither of those fields is used in the Tahoe code right now but */
318 /* there could be problems if they are.                            */
319         __u32   fs_id[2];       /* file system id */
320 /* sizes determined by number of cylinder groups and their sizes */
321         __u32   fs_csaddr;      /* blk addr of cyl grp summary area */
322         __u32   fs_cssize;      /* size of cyl grp summary area */
323         __u32   fs_cgsize;      /* cylinder group size */
324 /* these fields are derived from the hardware */
325         __u32   fs_ntrak;       /* tracks per cylinder */
326         __u32   fs_nsect;       /* sectors per track */
327         __u32   fs_spc;         /* sectors per cylinder */
328 /* this comes from the disk driver partitioning */
329         __u32   fs_ncyl;        /* cylinders in file system */
330 /* these fields can be computed from the others */
331         __u32   fs_cpg;         /* cylinders per group */
332         __u32   fs_ipg;         /* inodes per group */
333         __u32   fs_fpg;         /* blocks per group * fs_frag */
334 /* this data must be re-computed after crashes */
335         struct ufs_csum fs_cstotal;     /* cylinder summary information */
336 /* these fields are cleared at mount time */
337         __s8    fs_fmod;        /* super block modified flag */
338         __s8    fs_clean;       /* file system is clean flag */
339         __s8    fs_ronly;       /* mounted read-only flag */
340         __s8    fs_flags;       /* currently unused flag */
341         __s8    fs_fsmnt[UFS_MAXMNTLEN];        /* name mounted on */
342 /* these fields retain the current block allocation info */
343         __u32   fs_cgrotor;     /* last cg searched */
344         __u32   fs_csp[UFS_MAXCSBUFS];  /* list of fs_cs info buffers */
345         __u32   fs_maxcluster;
346         __u32   fs_cpc;         /* cyl per cycle in postbl */
347         __u16   fs_opostbl[16][8];      /* old rotation block list head */      
348         union {
349                 struct {
350                         __s32   fs_sparecon[53];/* reserved for future constants */
351                         __s32   fs_reclaim;
352                         __s32   fs_sparecon2[1];
353                         __s32   fs_state;       /* file system state time stamp */
354                         __u32   fs_qbmask[2];   /* ~usb_bmask */
355                         __u32   fs_qfmask[2];   /* ~usb_fmask */
356                 } fs_sun;
357                 struct {
358                         __s32   fs_sparecon[53];/* reserved for future constants */
359                         __s32   fs_reclaim;
360                         __s32   fs_sparecon2[1];
361                         __u32   fs_npsect;      /* # sectors/track including spares */
362                         __u32   fs_qbmask[2];   /* ~usb_bmask */
363                         __u32   fs_qfmask[2];   /* ~usb_fmask */
364                 } fs_sunx86;
365                 struct {
366                         __s32   fs_sparecon[50];/* reserved for future constants */
367                         __s32   fs_contigsumsize;/* size of cluster summary array */
368                         __s32   fs_maxsymlinklen;/* max length of an internal symlink */
369                         __s32   fs_inodefmt;    /* format of on-disk inodes */
370                         __u32   fs_maxfilesize[2];      /* max representable file size */
371                         __u32   fs_qbmask[2];   /* ~usb_bmask */
372                         __u32   fs_qfmask[2];   /* ~usb_fmask */
373                         __s32   fs_state;       /* file system state time stamp */
374                 } fs_44;
375         } fs_u2;
376         __s32   fs_postblformat;        /* format of positional layout tables */
377         __s32   fs_nrpos;               /* number of rotational positions */
378         __s32   fs_postbloff;           /* (__s16) rotation block list head */
379         __s32   fs_rotbloff;            /* (__u8) blocks for each rotation */
380         __s32   fs_magic;               /* magic number */
381         __u8    fs_space[1];            /* list of blocks for each rotation */
382 };
383
384 /*
385  * Preference for optimization.
386  */
387 #define UFS_OPTTIME     0       /* minimize allocation time */
388 #define UFS_OPTSPACE    1       /* minimize disk fragmentation */
389
390 /*
391  * Rotational layout table format types
392  */
393 #define UFS_42POSTBLFMT         -1      /* 4.2BSD rotational table format */
394 #define UFS_DYNAMICPOSTBLFMT    1       /* dynamic rotational table format */
395
396 /*
397  * Convert cylinder group to base address of its global summary info.
398  */
399 #define fs_cs(indx) \
400         u.ufs_sb.s_csp[(indx) >> uspi->s_csshift][(indx) & ~uspi->s_csmask]
401
402 /*
403  * Cylinder group block for a file system.
404  *
405  * Writable fields in the cylinder group are protected by the associated
406  * super block lock fs->fs_lock.
407  */
408 #define CG_MAGIC        0x090255
409 #define ufs_cg_chkmagic(sb, ucg) \
410         (fs32_to_cpu((sb), (ucg)->cg_magic) == CG_MAGIC)
411
412 /*
413  * size of this structure is 172 B
414  */
415 struct  ufs_cylinder_group {
416         __u32   cg_link;                /* linked list of cyl groups */
417         __u32   cg_magic;               /* magic number */
418         __u32   cg_time;                /* time last written */
419         __u32   cg_cgx;                 /* we are the cgx'th cylinder group */
420         __u16   cg_ncyl;                /* number of cyl's this cg */
421         __u16   cg_niblk;               /* number of inode blocks this cg */
422         __u32   cg_ndblk;               /* number of data blocks this cg */
423         struct  ufs_csum cg_cs;         /* cylinder summary information */
424         __u32   cg_rotor;               /* position of last used block */
425         __u32   cg_frotor;              /* position of last used frag */
426         __u32   cg_irotor;              /* position of last used inode */
427         __u32   cg_frsum[UFS_MAXFRAG];  /* counts of available frags */
428         __u32   cg_btotoff;             /* (__u32) block totals per cylinder */
429         __u32   cg_boff;                /* (short) free block positions */
430         __u32   cg_iusedoff;            /* (char) used inode map */
431         __u32   cg_freeoff;             /* (u_char) free block map */
432         __u32   cg_nextfreeoff;         /* (u_char) next available space */
433         union {
434                 struct {
435                         __u32   cg_clustersumoff;       /* (u_int32) counts of avail clusters */
436                         __u32   cg_clusteroff;          /* (u_int8) free cluster map */
437                         __u32   cg_nclusterblks;        /* number of clusters this cg */
438                         __u32   cg_sparecon[13];        /* reserved for future use */
439                 } cg_44;
440                 __u32   cg_sparecon[16];        /* reserved for future use */
441         } cg_u;
442         __u8    cg_space[1];            /* space for cylinder group maps */
443 /* actually longer */
444 };
445
446 /*
447  * structure of an on-disk inode
448  */
449 struct ufs_inode {
450         __u16   ui_mode;                /*  0x0 */
451         __u16   ui_nlink;               /*  0x2 */
452         union {
453                 struct {
454                         __u16   ui_suid;        /*  0x4 */
455                         __u16   ui_sgid;        /*  0x6 */
456                 } oldids;
457                 __u32   ui_inumber;             /*  0x4 lsf: inode number */
458                 __u32   ui_author;              /*  0x4 GNU HURD: author */
459         } ui_u1;
460         __u64   ui_size;                /*  0x8 */
461         struct ufs_timeval ui_atime;    /* 0x10 access */
462         struct ufs_timeval ui_mtime;    /* 0x18 modification */
463         struct ufs_timeval ui_ctime;    /* 0x20 creation */
464         union {
465                 struct {
466                         __u32   ui_db[UFS_NDADDR];/* 0x28 data blocks */
467                         __u32   ui_ib[UFS_NINDIR];/* 0x58 indirect blocks */
468                 } ui_addr;
469                 __u8    ui_symlink[4*(UFS_NDADDR+UFS_NINDIR)];/* 0x28 fast symlink */
470         } ui_u2;
471         __u32   ui_flags;               /* 0x64 immutable, append-only... */
472         __u32   ui_blocks;              /* 0x68 blocks in use */
473         __u32   ui_gen;                 /* 0x6c like ext2 i_version, for NFS support */
474         union {
475                 struct {
476                         __u32   ui_shadow;      /* 0x70 shadow inode with security data */
477                         __u32   ui_uid;         /* 0x74 long EFT version of uid */
478                         __u32   ui_gid;         /* 0x78 long EFT version of gid */
479                         __u32   ui_oeftflag;    /* 0x7c reserved */
480                 } ui_sun;
481                 struct {
482                         __u32   ui_uid;         /* 0x70 File owner */
483                         __u32   ui_gid;         /* 0x74 File group */
484                         __s32   ui_spare[2];    /* 0x78 reserved */
485                 } ui_44;
486                 struct {
487                         __u32   ui_uid;         /* 0x70 */
488                         __u32   ui_gid;         /* 0x74 */
489                         __u16   ui_modeh;       /* 0x78 mode high bits */
490                         __u16   ui_spare;       /* 0x7A unused */
491                         __u32   ui_trans;       /* 0x7c filesystem translator */
492                 } ui_hurd;
493         } ui_u3;
494 };
495
496 /* FreeBSD has these in sys/stat.h */
497 /* ui_flags that can be set by a file owner */
498 #define UFS_UF_SETTABLE   0x0000ffff
499 #define UFS_UF_NODUMP     0x00000001  /* do not dump */
500 #define UFS_UF_IMMUTABLE  0x00000002  /* immutable (can't "change") */
501 #define UFS_UF_APPEND     0x00000004  /* append-only */
502 #define UFS_UF_OPAQUE     0x00000008  /* directory is opaque (unionfs) */
503 #define UFS_UF_NOUNLINK   0x00000010  /* can't be removed or renamed */
504 /* ui_flags that only root can set */
505 #define UFS_SF_SETTABLE   0xffff0000
506 #define UFS_SF_ARCHIVED   0x00010000  /* archived */
507 #define UFS_SF_IMMUTABLE  0x00020000  /* immutable (can't "change") */
508 #define UFS_SF_APPEND     0x00040000  /* append-only */
509 #define UFS_SF_NOUNLINK   0x00100000  /* can't be removed or renamed */
510
511 #ifdef __KERNEL__
512
513 /* balloc.c */
514 extern void ufs_free_fragments (struct inode *, unsigned, unsigned);
515 extern void ufs_free_blocks (struct inode *, unsigned, unsigned);
516 extern unsigned ufs_new_fragments (struct inode *, u32 *, unsigned, unsigned, unsigned, int *);
517
518 /* cylinder.c */
519 extern struct ufs_cg_private_info * ufs_load_cylinder (struct super_block *, unsigned);
520 extern void ufs_put_cylinder (struct super_block *, unsigned);
521
522 /* dir.c */
523 extern struct inode_operations ufs_dir_inode_operations;
524 extern int ufs_check_dir_entry (const char *, struct inode *, struct ufs_dir_entry *, struct buffer_head *, unsigned long);
525 extern int ufs_add_link (struct dentry *, struct inode *);
526 extern ino_t ufs_inode_by_name(struct inode *, struct dentry *);
527 extern int ufs_make_empty(struct inode *, struct inode *);
528 extern struct ufs_dir_entry * ufs_find_entry (struct dentry *, struct buffer_head **);
529 extern int ufs_delete_entry (struct inode *, struct ufs_dir_entry *, struct buffer_head *);
530 extern int ufs_empty_dir (struct inode *);
531 extern struct ufs_dir_entry * ufs_dotdot (struct inode *, struct buffer_head **);
532 extern void ufs_set_link(struct inode *, struct ufs_dir_entry *, struct buffer_head *, struct inode *);
533
534 /* file.c */
535 extern struct inode_operations ufs_file_inode_operations;
536 extern struct file_operations ufs_file_operations;
537
538 extern struct address_space_operations ufs_aops;
539
540 /* ialloc.c */
541 extern void ufs_free_inode (struct inode *inode);
542 extern struct inode * ufs_new_inode (const struct inode *, int);
543
544 /* inode.c */
545 extern int ufs_frag_map (struct inode *, int);
546 extern void ufs_read_inode (struct inode *);
547 extern void ufs_put_inode (struct inode *);
548 extern void ufs_write_inode (struct inode *, int);
549 extern int ufs_sync_inode (struct inode *);
550 extern void ufs_delete_inode (struct inode *);
551 extern struct buffer_head * ufs_getfrag (struct inode *, unsigned, int, int *);
552 extern struct buffer_head * ufs_bread (struct inode *, unsigned, int, int *);
553
554 /* namei.c */
555 extern struct file_operations ufs_dir_operations;
556         
557 /* super.c */
558 extern struct file_system_type ufs_fs_type;
559 extern void ufs_warning (struct super_block *, const char *, const char *, ...) __attribute__ ((format (printf, 3, 4)));
560 extern void ufs_error (struct super_block *, const char *, const char *, ...) __attribute__ ((format (printf, 3, 4)));
561 extern void ufs_panic (struct super_block *, const char *, const char *, ...) __attribute__ ((format (printf, 3, 4)));
562 extern void ufs_write_super (struct super_block *);
563
564 /* symlink.c */
565 extern struct inode_operations ufs_fast_symlink_inode_operations;
566
567 /* truncate.c */
568 extern void ufs_truncate (struct inode *);
569
570 #endif  /* __KERNEL__ */
571
572 #endif /* __LINUX_UFS_FS_H */