Merge branch 'master' into vfs-dev
[lunaix-os.git] / lunaix-os / includes / lunaix / fs / twifs.h
1 #ifndef __LUNAIX_TWIFS_H
2 #define __LUNAIX_TWIFS_H
3
4 #include <lunaix/fs.h>
5
6 struct twifs_node
7 {
8     struct v_inode* inode;
9     struct hstr name;
10     void* data;
11     uint32_t itype;
12     struct llist_header children;
13     struct llist_header siblings;
14     struct
15     {
16         int (*write)(struct v_file* file,
17                      void* buffer,
18                      size_t len,
19                      size_t fpos);
20         int (*read)(struct v_file* file, void* buffer, size_t len, size_t fpos);
21     } ops;
22 };
23
24 void
25 twifs_init();
26
27 struct twifs_node*
28 twifs_file_node(struct twifs_node* parent,
29                 const char* name,
30                 int name_len,
31                 uint32_t itype);
32
33 struct twifs_node*
34 twifs_dir_node(struct twifs_node* parent,
35                const char* name,
36                int name_len,
37                uint32_t itype);
38
39 struct twifs_node*
40 twifs_toplevel_node(const char* name, int name_len, uint32_t itype);
41
42 int
43 twifs_rm_node(struct twifs_node* node);
44
45 #endif /* __LUNAIX_TWIFS_H */