refactor: inode hashing and reusing
[lunaix-os.git] / lunaix-os / kernel / fs / twifs / twifs.c
index 506d604abf4cdc974eb9131f796d9debe1553370..1f061df88d66cc261d61ded7e8daa21e6cfc98a6 100644 (file)
@@ -19,6 +19,8 @@ static struct twifs_node* fs_root;
 
 static struct cake_pile* twi_pile;
 
+static volatile int32_t inode_id = 0;
+
 int
 __twifs_dirlookup(struct v_inode* inode, struct v_dnode* dnode);
 
@@ -58,6 +60,7 @@ twifs_init()
     twifs->fs_name = HSTR("twifs", 5);
     twifs->mount = __twifs_mount;
     twifs->types = FSTYPE_ROFS;
+    twifs->fs_id = 0;
 
     fsm_register(twifs);
 
@@ -164,7 +167,7 @@ __twifs_mount(struct v_superblock* vsb, struct v_dnode* mount_point)
 struct v_inode*
 __twifs_create_inode(struct twifs_node* twi_node)
 {
-    struct v_inode* inode = vfs_i_alloc();
+    struct v_inode* inode = vfs_i_alloc(1, inode_id++);
     inode->itype = twi_node->itype;
     inode->data = twi_node;