00001 /* Inode table. This table holds inodes that are currently in use. In some 00002 * cases they have been opened by an open() or creat() system call, in other 00003 * cases the file system itself needs the inode for one reason or another, 00004 * such as to search a directory for a path name. 00005 * The first part of the struct holds fields that are present on the 00006 * disk; the second part holds fields not present on the disk. 00007 * The disk inode part is also declared in "type.h" as 'd1_inode' for V1 00008 * file systems and 'd2_inode' for V2 file systems. 00009 * 00010 * Updates: 00011 * 2007-01-06: jfdsmit@gmail.com added i_zsearch 00012 */ 00013 00014 #include <sys/queue.h> 00015 00016 EXTERN struct inode { 00017 mode_t i_mode; /* file type, protection, etc. */ 00018 nlink_t i_nlinks; /* how many links to this file */ 00019 uid_t i_uid; /* user id of the file's owner */ 00020 gid_t i_gid; /* group number */ 00021 off_t i_size; /* current file size in bytes */ 00022 time_t i_atime; /* time of last access (V2 only) */ 00023 time_t i_mtime; /* when was file data last changed */ 00024 time_t i_ctime; /* when was inode itself changed (V2 only)*/ 00025 zone_t i_zone[V2_NR_TZONES]; /* zone numbers for direct, ind, and dbl ind */ 00026 00027 /* The following items are not present on the disk. */ 00028 dev_t i_dev; /* which device is the inode on */ 00029 ino_t i_num; /* inode number on its (minor) device */ 00030 int i_count; /* # times inode used; 0 means slot is free */ 00031 int i_ndzones; /* # direct zones (Vx_NR_DZONES) */ 00032 int i_nindirs; /* # indirect zones per indirect block */ 00033 struct super_block *i_sp; /* pointer to super block for inode's device */ 00034 char i_dirt; /* CLEAN or DIRTY */ 00035 bit_t i_zsearch; /* where to start search for new zones */ 00036 00037 char i_mountpoint; /* true if mounted on */ 00038 00039 char i_seek; /* set on LSEEK, cleared on READ/WRITE */ 00040 char i_update; /* the ATIME, CTIME, and MTIME bits are here */ 00041 00042 LIST_ENTRY(inode) i_hash; /* hash list */ 00043 TAILQ_ENTRY(inode) i_unused; /* free and unused list */ 00044 00045 } inode[NR_INODES]; 00046 00047 /* list of unused/free inodes */ 00048 EXTERN TAILQ_HEAD(unused_inodes_t, inode) unused_inodes; 00049 00050 /* inode hashtable */ 00051 EXTERN LIST_HEAD(inodelist, inode) hash_inodes[INODE_HASH_SIZE]; 00052 00053 EXTERN unsigned int inode_cache_hit; 00054 EXTERN unsigned int inode_cache_miss; 00055 00056 #define NIL_INODE (struct inode *) 0 /* indicates absence of inode slot */ 00057 00058 /* Field values. Note that CLEAN and DIRTY are defined in "const.h" */ 00059 #define NO_SEEK 0 /* i_seek = NO_SEEK if last op was not SEEK */ 00060 #define ISEEK 1 /* i_seek = ISEEK if last op was SEEK */
1.5.8