patch-2.1.87 linux/include/linux/ufs_fs.h

Next file: linux/include/linux/ufs_fs_i.h
Previous file: linux/include/linux/tty_driver.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.86/linux/include/linux/ufs_fs.h linux/include/linux/ufs_fs.h
@@ -9,6 +9,13 @@
  * Clean swab support by Fare <rideau@ens.fr>
  * just hope no one is using NNUUXXI on __?64 structure elements
  * 64-bit clean thanks to Maciej W. Rozycki <macro@ds2.pg.gda.pl>
+ *
+ * 4.4BSD (FreeBSD) support added on February 1st 1998 by
+ * Niels Kristian Bech Jensen <nkbj@image.dk> partially based
+ * on code by Martin von Loewis <martin@mira.isdn.cs.tu-berlin.de>.
+ *
+ * NeXTstep support added on February 5th 1998 by
+ * Niels Kristian Bech Jensen <nkbj@image.dk>.
  */
 
 #ifndef __LINUX_UFS_FS_H
@@ -49,13 +56,45 @@
 #define UFS_FSACTIVE  ((char)0x00)
 #define UFS_FSCLEAN   ((char)0x01)
 #define UFS_FSSTABLE  ((char)0x02)
+#define UFS_FSOSF1    ((char)0x03)	/* is this correct for DEC OSF/1? */
 #define UFS_FSBAD     ((char)0xff)
 
-/* Flags for ufs_sb_info */
-#define UFS_DEBUG       0x00000001
-#define UFS_DEBUG_INODE 0x00000002
-#define UFS_DEBUG_NAMEI 0x00000004
-#define UFS_DEBUG_LINKS 0x00000008
+/* From here to next blank line, s_flags for ufs_sb_info */
+/* endianness */
+#define UFS_BYTESEX		0x00000001	/* mask; leave room to 0xF */
+#define UFS_LITTLE_ENDIAN	0x00000000
+#define UFS_BIG_ENDIAN		0x00000001
+/* directory entry encoding */
+#define UFS_DE_MASK		0x00000010	/* mask for the following */
+#define UFS_DE_OLD		0x00000000
+#define UFS_DE_44BSD		0x00000010
+/* uid encoding */
+#define UFS_UID_MASK		0x00000060	/* mask for the following */
+#define UFS_UID_OLD		0x00000000
+#define UFS_UID_44BSD		0x00000020
+#define UFS_UID_EFT		0x00000040
+/* superblock state encoding */
+#define UFS_ST_MASK		0x00000700	/* mask for the following */
+#define UFS_ST_OLD		0x00000000
+#define UFS_ST_44BSD		0x00000100
+#define UFS_ST_SUN		0x00000200
+#define UFS_ST_NEXT		0x00000400
+/* filesystem flavors (combo of features) */
+#define UFS_FEATURES		0x00FFFFF0	/* room for extension */
+#define UFS_VANILLA		0x00000000
+#define UFS_OLD			0x00000000	/* 4.2BSD */
+#define UFS_44BSD		0x00000130
+#define UFS_HURD		0x00000130
+#define UFS_SUN			0x00000200
+#define UFS_NEXT		0x00000400
+/* we preserve distinction in flavor identification even without difference,
+ * because yet-to-be-supported features may introduce difference in the future
+ */
+/* last but not least, debug flags */
+#define UFS_DEBUG       	0x01000000
+#define UFS_DEBUG_INODE 	0x02000000
+#define UFS_DEBUG_NAMEI 	0x04000000
+#define UFS_DEBUG_LINKS 	0x08000000
 
 #ifdef UFS_HEAVY_DEBUG
 #  define UFS_DEBUG_INITIAL UFS_DEBUG
@@ -63,10 +102,9 @@
 #  define UFS_DEBUG_INITIAL 0
 #endif
 
-/* (!) HERE WE ASSUME EITHER BIG OR LITTLE ENDIAN UFSes */
-#define UFS_LITTLE_ENDIAN 0x00000000	/* 0x00010000 */
-#define UFS_BIG_ENDIAN    0x00010000	/* 0x00020000 */
-#define UFS_BYTESEX	  0x00010000	/* 0x00030000 */
+/* fs_inodefmt options */
+#define UFS_42INODEFMT	-1
+#define UFS_44INODEFMT	2
 
 #define UFS_ADDR_PER_BLOCK(sb)		((sb)->u.ufs_sb.s_bsize >> 2)
 #define UFS_ADDR_PER_BLOCK_BITS(sb)	((sb)->u.ufs_sb.s_bshift - 2)
@@ -87,6 +125,12 @@
 /* XXX - this can be optimized if s_ipg is a power of 2. */
 #define ufs_ino2cg(inode)  ((inode)->i_ino/(inode)->i_sb->u.ufs_sb.s_ipg)
 
+/* current filesystem state; method depends on flags */
+#define UFS_STATE(usb) \
+		( ((flags&UFS_ST_MASK) == UFS_ST_OLD) \
+                  ? (usb)->fs_u.fs_sun.fs_state /* old normal way */ \
+                  : (usb)->fs_u.fs_44.fs_state /* 4.4BSD way */ )
+
 #define	UFS_MAXNAMLEN 255
 
 #define ufs_lbn(sb, block)		((block) >> (sb)->u.ufs_sb.s_lshift)
@@ -101,8 +145,14 @@
 struct ufs_direct {
 	__u32  d_ino;			/* inode number of this entry */
 	__u16  d_reclen;		/* length of this entry */
-	__u16  d_namlen;		/* actual length of d_name */
-	char   d_name[UFS_MAXNAMLEN + 1];	/* file name */
+	union {
+		__u16	d_namlen;		/* actual length of d_name */
+		struct {
+			__u8	d_type;		/* file type */
+			__u8	d_namlen;	/* length of string in d_name */
+		} d_44;
+	} d_u;
+	__u8	d_name[UFS_MAXNAMLEN + 1];	/* file name */
 };
 
 #define MAXMNTLEN 512
@@ -193,10 +243,24 @@
 	__u32	fs_csp[MAXCSBUFS];	/* list of fs_cs info buffers */
 	__u32	fs_cpc;		/* cyl per cycle in postbl */
 	__u16	fs_opostbl[16][8];	/* old rotation block list head */	
-	__s32	fs_sparecon[55];	/* reserved for future constants */
-	__s32	fs_state;		/* file system state time stamp */
-	__u32	fs_qbmask[2];		/* ~usb_bmask */
-	__u32	fs_qfmask[2];		/* ~usb_fmask */
+	union {
+		struct {
+			__s32	fs_sparecon[55];/* reserved for future constants */
+			__s32	fs_state;	/* file system state time stamp */
+			__u32	fs_qbmask[2];	/* ~usb_bmask */
+			__u32	fs_qfmask[2];	/* ~usb_fmask */
+		} fs_sun;
+		struct {
+			__s32	fs_sparecon[50];/* reserved for future constants */
+			__s32	fs_contigsumsize;/* size of cluster summary array */
+			__s32	fs_maxsymlinklen;/* max length of an internal symlink */
+			__s32	fs_inodefmt;	/* format of on-disk inodes */
+			__u64	fs_maxfilesize;	/* max representable file size */
+			__u32	fs_qbmask[2];	/* ~usb_bmask */
+			__u32	fs_qfmask[2];	/* ~usb_fmask */
+			__s32	fs_state;	/* file system state time stamp */
+		} fs_44;
+	} fs_u;
 	__s32	fs_postblformat;	/* format of positional layout tables */
 	__s32	fs_nrpos;		/* number of rotational positions */
 	__s32	fs_postbloff;		/* (__s16) rotation block list head */
@@ -211,24 +275,50 @@
 struct ufs_inode {
 	__u16	ui_mode;		/*  0x0 */
 	__u16	ui_nlink;		/*  0x2 */
-	__u16	ui_suid;		/*  0x4 */
-	__u16	ui_sgid;		/*  0x6 */
+	union {
+		struct {
+			__u16	suid;	/*  0x4 */
+			__u16	sgid;	/*  0x6 */
+		} oldids;
+		__u32	inumber;	/*  0x4 lsf: inode number */
+		__u32	author;		/*  0x4 GNU HURD: author */
+	} ui_u1;
 	__u64	ui_size;		/*  0x8 */
 	struct ufs_timeval ui_atime;	/* 0x10 access */
 	struct ufs_timeval ui_mtime;	/* 0x18 modification */
 	struct ufs_timeval ui_ctime;	/* 0x20 creation */
-	__u32	ui_db[UFS_NDADDR];	/* 0x28 data blocks */
-	__u32	ui_ib[UFS_NINDIR];	/* 0x58 indirect blocks */
+	union {
+		struct {
+			__u32	ui_db[UFS_NDADDR];/* 0x28 data blocks */
+			__u32	ui_ib[UFS_NINDIR];/* 0x58 indirect blocks */
+		} ui_addr;
+		__u8	ui_symlink[4*(UFS_NDADDR+UFS_NINDIR)];/* 0x28 fast symlink */
+	} ui_u2;
 	__u32	ui_flags;		/* 0x64 unused -- "status flags (chflags)" ??? */
 	__u32	ui_blocks;		/* 0x68 blocks in use */
 	__u32	ui_gen;			/* 0x6c generation number XXX - what is this? */
-	__u32	ui_shadow;		/* 0x70 shadow inode XXX - what is this?*/
-	__u32	ui_uid;			/* 0x74 long EFT version of uid */
-	__u32	ui_gid;			/* 0x78 long EFT version of gid */
-	__u32	ui_oeftflag;		/* 0x7c reserved */
+	union {
+		struct {
+			__u32	ui_shadow;/* 0x70 shadow inode XXX - what is this?*/
+			__u32	ui_uid;	/* 0x74 long EFT version of uid */
+			__u32	ui_gid;	/* 0x78 long EFT version of gid */
+			__u32	ui_oeftflag;/* 0x7c reserved */
+		} ui_sun;
+		struct {
+			__u32	ui_uid;	/* 0x70 File owner */
+			__u32	ui_gid;	/* 0x74 File group */
+			__s32	ui_spare[2];/* 0x78 reserved */
+		} ui_44;
+		struct {
+			__u32	ui_uid;	/* 0x70 */
+			__u32	ui_gid;	/* 0x74 */
+			__u16	ui_modeh;/* 0x78 mode high bits */
+			__u16	ui_spare;/* 0x7A unused */
+			__u32	ui_trans;/* 0x7c filesystem translator */
+		} ui_hurd;
+	} ui_u3;
 };
-
-
+ 
 #ifdef __KERNEL__
 /*
  * Function prototypes

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov