1*84Sbill /* inode.h 3.2 10/14/12 */ 258Sbill 358Sbill /* 458Sbill * The I node is the focus of all 558Sbill * file activity in unix. There is a unique 658Sbill * inode allocated for each active file, 758Sbill * each current directory, each mounted-on 858Sbill * file, text file, and the root. An inode is 'named' 958Sbill * by its dev/inumber pair. (iget/iget.c) 1058Sbill * Data, from mode on, is read in 1158Sbill * from permanent inode on volume. 1258Sbill */ 1358Sbill 1458Sbill #define NADDR 13 1558Sbill 1658Sbill #define NINDEX 15 1758Sbill struct group 1858Sbill { 1958Sbill short g_state; 2058Sbill char g_index; 2158Sbill char g_rot; 2258Sbill struct group *g_group; 2358Sbill struct inode *g_inode; 2458Sbill struct file *g_file; 2558Sbill short g_rotmask; 2658Sbill short g_datq; 2758Sbill struct chan *g_chans[NINDEX]; 2858Sbill }; 2958Sbill struct inode 3058Sbill { 3158Sbill char i_flag; 3258Sbill char i_count; /* reference count */ 3358Sbill dev_t i_dev; /* device where inode resides */ 3458Sbill ino_t i_number; /* i number, 1-to-1 with device address */ 3558Sbill unsigned short i_mode; 3658Sbill short i_nlink; /* directory entries */ 3758Sbill short i_uid; /* owner */ 3858Sbill short i_gid; /* group of owner */ 3958Sbill off_t i_size; /* size of file */ 4058Sbill union { 4158Sbill struct { 4258Sbill daddr_t i_addr[NADDR]; /* if normal file/directory */ 4358Sbill daddr_t i_lastr; /* last logical block read (for read-ahead) */ 4458Sbill }; 4558Sbill struct { 4658Sbill daddr_t i_rdev; /* i_addr[0] */ 4758Sbill struct group i_group; /* multiplexor group file */ 4858Sbill }; 4958Sbill } i_un; 5058Sbill short i_vfdcnt; /* number of fd's vreading this inode */ 5158Sbill short i_hlink; /* link in hash chain (iget/iput/ifind) */ 5258Sbill }; 5358Sbill 5458Sbill #ifdef KERNEL 5558Sbill extern struct inode inode[]; /* The inode table itself */ 5658Sbill 5758Sbill struct inode *rootdir; /* pointer to inode of root directory */ 5858Sbill struct inode *mpxip; /* mpx virtual inode */ 5958Sbill 6058Sbill struct inode *ialloc(); 6158Sbill struct inode *ifind(); 6258Sbill struct inode *iget(); 6358Sbill struct inode *owner(); 6458Sbill struct inode *maknode(); 6558Sbill struct inode *namei(); 6658Sbill #endif 6758Sbill 6858Sbill /* flags */ 6958Sbill #define ILOCK 01 /* inode is locked */ 7058Sbill #define IUPD 02 /* file has been modified */ 7158Sbill #define IACC 04 /* inode access time to be updated */ 7258Sbill #define IMOUNT 010 /* inode is mounted on */ 7358Sbill #define IWANT 020 /* some process waiting on lock */ 7458Sbill #define ITEXT 040 /* inode is pure text prototype */ 7558Sbill #define ICHG 0100 /* inode has been changed */ 76*84Sbill #define IPIPE 0200 /* inode is a pipe */ 7758Sbill 7858Sbill /* modes */ 7958Sbill #define IFMT 0170000 /* type of file */ 8058Sbill #define IFDIR 0040000 /* directory */ 8158Sbill #define IFCHR 0020000 /* character special */ 8258Sbill #define IFBLK 0060000 /* block special */ 8358Sbill #define IFREG 0100000 /* regular */ 8458Sbill #define IFMPC 0030000 /* multiplexed char special */ 8558Sbill #define IFMPB 0070000 /* multiplexed block special */ 8658Sbill #define ISUID 04000 /* set user id on execution */ 8758Sbill #define ISGID 02000 /* set group id on execution */ 8858Sbill #define ISVTX 01000 /* save swapped text even after use */ 8958Sbill #define IREAD 0400 /* read, write, execute permissions */ 9058Sbill #define IWRITE 0200 9158Sbill #define IEXEC 0100 92