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