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