1*3097Swnj /* dinode.h 4.5 81/03/09 */ 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 162291Swnj #define NINDEX 6 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 { 42109Sbill daddr_t I_addr[NADDR]; /* if normal file/directory */ 43224Sbill daddr_t I_lastr; /* last read (for read-ahead) */ 44109Sbill } i_f; 45109Sbill #define i_addr i_f.I_addr 46109Sbill #define i_lastr i_f.I_lastr 4758Sbill struct { 48109Sbill daddr_t I_rdev; /* i_addr[0] */ 49109Sbill struct group I_group; /* multiplexor group file */ 50109Sbill } i_d; 51109Sbill #define i_rdev i_d.I_rdev 52109Sbill #define i_group i_d.I_group 5358Sbill } i_un; 5458Sbill short i_vfdcnt; /* number of fd's vreading this inode */ 5558Sbill short i_hlink; /* link in hash chain (iget/iput/ifind) */ 5658Sbill }; 5758Sbill 5858Sbill #ifdef KERNEL 59*3097Swnj struct inode *inode, *inodeNINODE; 60*3097Swnj int ninode; 6158Sbill 6258Sbill struct inode *rootdir; /* pointer to inode of root directory */ 6358Sbill struct inode *mpxip; /* mpx virtual inode */ 6458Sbill 6558Sbill struct inode *ialloc(); 6658Sbill struct inode *ifind(); 6758Sbill struct inode *iget(); 6858Sbill struct inode *owner(); 6958Sbill struct inode *maknode(); 7058Sbill struct inode *namei(); 7158Sbill #endif 7258Sbill 7358Sbill /* flags */ 7458Sbill #define ILOCK 01 /* inode is locked */ 7558Sbill #define IUPD 02 /* file has been modified */ 7658Sbill #define IACC 04 /* inode access time to be updated */ 7758Sbill #define IMOUNT 010 /* inode is mounted on */ 7858Sbill #define IWANT 020 /* some process waiting on lock */ 7958Sbill #define ITEXT 040 /* inode is pure text prototype */ 8058Sbill #define ICHG 0100 /* inode has been changed */ 8184Sbill #define IPIPE 0200 /* inode is a pipe */ 8258Sbill 8358Sbill /* modes */ 8458Sbill #define IFMT 0170000 /* type of file */ 8558Sbill #define IFDIR 0040000 /* directory */ 8658Sbill #define IFCHR 0020000 /* character special */ 8758Sbill #define IFBLK 0060000 /* block special */ 8858Sbill #define IFREG 0100000 /* regular */ 8958Sbill #define IFMPC 0030000 /* multiplexed char special */ 9058Sbill #define IFMPB 0070000 /* multiplexed block special */ 9158Sbill #define ISUID 04000 /* set user id on execution */ 9258Sbill #define ISGID 02000 /* set group id on execution */ 9358Sbill #define ISVTX 01000 /* save swapped text even after use */ 9458Sbill #define IREAD 0400 /* read, write, execute permissions */ 9558Sbill #define IWRITE 0200 9658Sbill #define IEXEC 0100 97