refactor: add a simple ramfs for rootfs. Twifs should have more specific job in future.
[lunaix-os.git] / lunaix-os / includes / lunaix / fs / twifs.h
index bd9dfeb63032dd4885397e28b239737df88c02a8..f4614d8f72d4fe4e9f3a1a42664f059f1ed4cabc 100644 (file)
@@ -5,28 +5,44 @@
 
 struct twifs_node
 {
-    struct v_inode* inode;
     struct hstr name;
+    inode_t ino_id;
     void* data;
     uint32_t itype;
     struct llist_header children;
     struct llist_header siblings;
-    struct v_file_ops fops;
+    struct
+    {
+        int (*write)(struct v_inode* inode,
+                     void* buffer,
+                     size_t len,
+                     size_t fpos);
+        int (*read)(struct v_inode* inode,
+                    void* buffer,
+                    size_t len,
+                    size_t fpos);
+    } ops;
 };
 
 void
 twifs_init();
 
 struct twifs_node*
-twifs_file_node(struct twifs_node* parent, const char* name, int name_len);
+twifs_file_node(struct twifs_node* parent,
+                const char* name,
+                int name_len,
+                uint32_t itype);
 
 struct twifs_node*
-twifs_dir_node(struct twifs_node* parent, const char* name, int name_len);
+twifs_dir_node(struct twifs_node* parent,
+               const char* name,
+               int name_len,
+               uint32_t itype);
 
 struct twifs_node*
-twifs_toplevel_node(const char* name, int name_len);
+twifs_toplevel_node(const char* name, int name_len, uint32_t itype);
 
-void
+int
 twifs_rm_node(struct twifs_node* node);
 
 #endif /* __LUNAIX_TWIFS_H */