1 #ifndef _VTREEFS_INODE_H 2 #define _VTREEFS_INODE_H 3 4 /* 5 * The inodes that are active, form a fully connected tree. Each node except 6 * the root node has a parent and a tail queue of children, where each child 7 * inode points to the "next" and "previous" inode with a common parent. 8 * 9 * Each inode that has a parent (i.e. active and not the root), is part of a 10 * <parent,name> -> inode hashtable, and if it has an index into the parent, 11 * is part of a <parent,index> -> inode hashtable. 12 * 13 * Inodes that are not active, are either deleted or free. A deleted inode is 14 * in use as long as it still has a nonzero reference count, even though it is 15 * no longer part of the tree. Inodes that are free, are part of the list of 16 * unused inodes. 17 */ 18 struct inode { 19 /* Inode identity */ 20 unsigned int i_num; /* index number into the inode array */ 21 /* Note that the actual inode number (of type ino_t) is (i_num + 1). */ 22 23 /* Inode metadata */ 24 struct inode_stat i_stat; /* POSIX attributes */ 25 char i_namebuf[PNAME_MAX + 1]; /* buffer for static (short) names */ 26 char *i_name; /* name of the inode in the parent */ 27 unsigned int i_count; /* reference count */ 28 index_t i_index; /* index number in parent / NO_INDEX */ 29 int i_indexed; /* number of indexed entries */ 30 cbdata_t i_cbdata; /* callback data */ 31 unsigned short i_flags; /* I_DELETED or 0 */ 32 33 /* Tree structure */ 34 struct inode *i_parent; /* parent of the node */ 35 TAILQ_ENTRY(inode) i_siblings; /* hash list for parent's children */ 36 TAILQ_HEAD(i_child, inode) i_children; /* parent's children */ 37 38 /* Hash/free structure */ 39 LIST_ENTRY(inode) i_hname; /* hash list for name hash table */ 40 LIST_ENTRY(inode) i_hindex; /* hash list for index hash table */ 41 TAILQ_ENTRY(inode) i_unused; /* list of unused nodes */ 42 }; 43 44 #define I_DELETED 0x1 /* the inode is scheduled for deletion */ 45 46 #endif /* _VTREEFS_INODE_H */ 47