1*58Sbill /* inode.h 3.1 10/14/12 */ 2*58Sbill 3*58Sbill /* 4*58Sbill * The I node is the focus of all 5*58Sbill * file activity in unix. There is a unique 6*58Sbill * inode allocated for each active file, 7*58Sbill * each current directory, each mounted-on 8*58Sbill * file, text file, and the root. An inode is 'named' 9*58Sbill * by its dev/inumber pair. (iget/iget.c) 10*58Sbill * Data, from mode on, is read in 11*58Sbill * from permanent inode on volume. 12*58Sbill */ 13*58Sbill 14*58Sbill #define NADDR 13 15*58Sbill 16*58Sbill #define NINDEX 15 17*58Sbill struct group 18*58Sbill { 19*58Sbill short g_state; 20*58Sbill char g_index; 21*58Sbill char g_rot; 22*58Sbill struct group *g_group; 23*58Sbill struct inode *g_inode; 24*58Sbill struct file *g_file; 25*58Sbill short g_rotmask; 26*58Sbill short g_datq; 27*58Sbill struct chan *g_chans[NINDEX]; 28*58Sbill }; 29*58Sbill struct inode 30*58Sbill { 31*58Sbill char i_flag; 32*58Sbill char i_count; /* reference count */ 33*58Sbill dev_t i_dev; /* device where inode resides */ 34*58Sbill ino_t i_number; /* i number, 1-to-1 with device address */ 35*58Sbill unsigned short i_mode; 36*58Sbill short i_nlink; /* directory entries */ 37*58Sbill short i_uid; /* owner */ 38*58Sbill short i_gid; /* group of owner */ 39*58Sbill off_t i_size; /* size of file */ 40*58Sbill union { 41*58Sbill struct { 42*58Sbill daddr_t i_addr[NADDR]; /* if normal file/directory */ 43*58Sbill daddr_t i_lastr; /* last logical block read (for read-ahead) */ 44*58Sbill }; 45*58Sbill struct { 46*58Sbill daddr_t i_rdev; /* i_addr[0] */ 47*58Sbill struct group i_group; /* multiplexor group file */ 48*58Sbill }; 49*58Sbill } i_un; 50*58Sbill short i_vfdcnt; /* number of fd's vreading this inode */ 51*58Sbill short i_hlink; /* link in hash chain (iget/iput/ifind) */ 52*58Sbill }; 53*58Sbill 54*58Sbill #ifdef KERNEL 55*58Sbill extern struct inode inode[]; /* The inode table itself */ 56*58Sbill 57*58Sbill struct inode *rootdir; /* pointer to inode of root directory */ 58*58Sbill struct inode *mpxip; /* mpx virtual inode */ 59*58Sbill 60*58Sbill struct inode *ialloc(); 61*58Sbill struct inode *ifind(); 62*58Sbill struct inode *iget(); 63*58Sbill struct inode *owner(); 64*58Sbill struct inode *maknode(); 65*58Sbill struct inode *namei(); 66*58Sbill #endif 67*58Sbill 68*58Sbill /* flags */ 69*58Sbill #define ILOCK 01 /* inode is locked */ 70*58Sbill #define IUPD 02 /* file has been modified */ 71*58Sbill #define IACC 04 /* inode access time to be updated */ 72*58Sbill #define IMOUNT 010 /* inode is mounted on */ 73*58Sbill #define IWANT 020 /* some process waiting on lock */ 74*58Sbill #define ITEXT 040 /* inode is pure text prototype */ 75*58Sbill #define ICHG 0100 /* inode has been changed */ 76*58Sbill 77*58Sbill /* modes */ 78*58Sbill #define IFMT 0170000 /* type of file */ 79*58Sbill #define IFDIR 0040000 /* directory */ 80*58Sbill #define IFCHR 0020000 /* character special */ 81*58Sbill #define IFBLK 0060000 /* block special */ 82*58Sbill #define IFREG 0100000 /* regular */ 83*58Sbill #define IFMPC 0030000 /* multiplexed char special */ 84*58Sbill #define IFMPB 0070000 /* multiplexed block special */ 85*58Sbill #define ISUID 04000 /* set user id on execution */ 86*58Sbill #define ISGID 02000 /* set group id on execution */ 87*58Sbill #define ISVTX 01000 /* save swapped text even after use */ 88*58Sbill #define IREAD 0400 /* read, write, execute permissions */ 89*58Sbill #define IWRITE 0200 90*58Sbill #define IEXEC 0100 91