-#define NINDEX 15
-struct group
-{
- short g_state;
- char g_index;
- char g_rot;
- struct group *g_group;
- struct inode *g_inode;
- struct file *g_file;
- short g_rotmask;
- short g_datq;
- struct chan *g_chans[NINDEX];
-};
-struct inode
-{
- char i_flag;
- char i_count; /* reference count */
- dev_t i_dev; /* device where inode resides */
- ino_t i_number; /* i number, 1-to-1 with device address */
- unsigned short i_mode;
- short i_nlink; /* directory entries */
- short i_uid; /* owner */
- short i_gid; /* group of owner */
- off_t i_size; /* size of file */
- union {
- struct {
- daddr_t I_addr[NADDR]; /* if normal file/directory */
- daddr_t I_lastr; /* last read (for read-ahead) */
- } i_f;
-#define i_addr i_f.I_addr
-#define i_lastr i_f.I_lastr
- struct {
- daddr_t I_rdev; /* i_addr[0] */
- struct group I_group; /* multiplexor group file */
- } i_d;
-#define i_rdev i_d.I_rdev
-#define i_group i_d.I_group
- } i_un;
- short i_vfdcnt; /* number of fd's vreading this inode */
- short i_hlink; /* link in hash chain (iget/iput/ifind) */
+/*
+ * Theoretically, directories can be more than 2Gb in length, however, in
+ * practice this seems unlikely. So, we define the type doff_t as a long
+ * to keep down the cost of doing lookup on a 32-bit machine. If you are
+ * porting to a 64-bit architecture, you should make doff_t the same as off_t.
+ */
+#define doff_t long
+
+/*
+ * The inode is used to describe each active (or recently active)
+ * file in the UFS filesystem. It is composed of two types of
+ * information. The first part is the information that is needed
+ * only while the file is active (such as the identity of the file
+ * and linkage to speed its lookup). The second part is the
+ * permannent meta-data associated with the file which is read
+ * in from the permanent dinode from long term storage when the
+ * file becomes active, and is put back when the file is no longer
+ * being used.
+ */
+struct inode {
+ struct inode *i_next; /* Hash chain forward. */
+ struct inode **i_prev; /* Hash chain back. */
+ struct vnode *i_vnode; /* Vnode associated with this inode. */
+ struct vnode *i_devvp; /* Vnode for block I/O. */
+ u_long i_flag; /* I* flags. */
+ dev_t i_dev; /* Device associated with the inode. */
+ ino_t i_number; /* The identity of the inode. */
+ union { /* Associated filesystem. */
+ struct fs *fs; /* FFS */
+ struct lfs *lfs; /* LFS */
+ } inode_u;
+#define i_fs inode_u.fs
+#define i_lfs inode_u.lfs
+ struct dquot *i_dquot[MAXQUOTAS]; /* Dquot structures. */
+ u_quad_t i_modrev; /* Revision level for lease. */
+ struct lockf *i_lockf; /* Head of byte-level lock list. */
+ pid_t i_lockholder; /* DEBUG: holder of inode lock. */
+ pid_t i_lockwaiter; /* DEBUG: latest blocked for inode lock. */
+ /*
+ * Side effects; used during directory lookup.
+ */
+ long i_count; /* Size of free slot in directory. */
+ doff_t i_endoff; /* End of useful stuff in directory. */
+ doff_t i_diroff; /* Offset in dir, where we found last entry. */
+ doff_t i_offset; /* Offset of free space in directory. */
+ ino_t i_ino; /* Inode number of found directory. */
+ u_long i_reclen; /* Size of found directory entry. */
+ long i_spare[11]; /* Spares to round up to 128 bytes. */
+ /*
+ * The on-disk dinode itself.
+ */
+ struct dinode i_din; /* 128 bytes of the on-disk dinode. */