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