xref: /csrg-svn/sys/ufs/ffs/inode.h (revision 4814)
1*4814Swnj /*	inode.h	4.8	81/11/08	*/
258Sbill 
358Sbill /*
4*4814Swnj  * The I node is the focus of all file activity in UNIX.
5*4814Swnj  * There is a unique inode allocated for each active file,
6*4814Swnj  * each current directory, each mounted-on file, text file, and the root.
7*4814Swnj  * An inode is 'named' by its dev/inumber pair. (iget/iget.c)
8*4814Swnj  * Data, from mode on, is read in from permanent inode on volume.
958Sbill  */
1058Sbill #define	NADDR	13
1158Sbill 
12*4814Swnj struct inode {
1358Sbill 	char	i_flag;
1458Sbill 	char	i_count;	/* reference count */
1558Sbill 	dev_t	i_dev;		/* device where inode resides */
1658Sbill 	ino_t	i_number;	/* i number, 1-to-1 with device address */
17*4814Swnj /* begin read from disk */
18*4814Swnj 	u_short	i_mode;
1958Sbill 	short	i_nlink;	/* directory entries */
2058Sbill 	short	i_uid;		/* owner */
2158Sbill 	short	i_gid;		/* group of owner */
2258Sbill 	off_t	i_size;		/* size of file */
2358Sbill 	union {
2458Sbill 		struct {
25109Sbill 			daddr_t	I_addr[NADDR];	/* if normal file/directory */
26*4814Swnj 			daddr_t	I_lastr;	/* last read (read-ahead) */
27109Sbill 		} i_f;
28109Sbill #define	i_addr	i_f.I_addr
29109Sbill #define	i_lastr	i_f.I_lastr
3058Sbill 		struct {
31109Sbill 			daddr_t	I_rdev;		/* i_addr[0] */
32109Sbill 		} i_d;
33109Sbill #define	i_rdev	i_d.I_rdev
3458Sbill 	} i_un;
35*4814Swnj /* end read from disk */
36*4814Swnj 	short	i_XXXXXX;	/* ### */
37*4814Swnj /* SHOULD USE POINTERS, NOT INDICES, FOR HAS CHAIN */
3858Sbill 	short	i_hlink;	/* link in hash chain (iget/iput/ifind) */
3958Sbill };
4058Sbill 
4158Sbill #ifdef KERNEL
423097Swnj struct	inode *inode, *inodeNINODE;
433097Swnj int	ninode;
4458Sbill 
4558Sbill struct	inode *rootdir;		/* pointer to inode of root directory */
4658Sbill 
4758Sbill struct	inode *ialloc();
4858Sbill struct	inode *ifind();
4958Sbill struct	inode *iget();
5058Sbill struct	inode *owner();
5158Sbill struct	inode *maknode();
5258Sbill struct	inode *namei();
5358Sbill #endif
5458Sbill 
5558Sbill /* flags */
5658Sbill #define	ILOCK	01		/* inode is locked */
5758Sbill #define	IUPD	02		/* file has been modified */
5858Sbill #define	IACC	04		/* inode access time to be updated */
5958Sbill #define	IMOUNT	010		/* inode is mounted on */
6058Sbill #define	IWANT	020		/* some process waiting on lock */
6158Sbill #define	ITEXT	040		/* inode is pure text prototype */
6258Sbill #define	ICHG	0100		/* inode has been changed */
6358Sbill 
6458Sbill /* modes */
6558Sbill #define	IFMT	0170000		/* type of file */
6658Sbill #define		IFDIR	0040000	/* directory */
6758Sbill #define		IFCHR	0020000	/* character special */
6858Sbill #define		IFBLK	0060000	/* block special */
6958Sbill #define		IFREG	0100000	/* regular */
7058Sbill #define	ISUID	04000		/* set user id on execution */
7158Sbill #define	ISGID	02000		/* set group id on execution */
7258Sbill #define	ISVTX	01000		/* save swapped text even after use */
7358Sbill #define	IREAD	0400		/* read, write, execute permissions */
7458Sbill #define	IWRITE	0200
7558Sbill #define	IEXEC	0100
76