* fix an issue that execve attempts to parse directory as elf file.
[lunaix-os.git] / lunaix-os / includes / lunaix / fs.h
index d5990235253f2b06485b7f10d23d63ac2b5f84cd..0240c96a4ddc8348597b3096734f18477c95f7ad 100644 (file)
@@ -98,6 +98,7 @@ extern struct v_dnode* vfs_sysroot;
 
 struct filesystem
 {
+    struct llist_header fs_flat;
     struct hlist_node fs_list;
     struct hstr fs_name;
     u32_t types;
@@ -144,8 +145,8 @@ struct v_file_ops
     // These additional operations allow underlying fs to use more specialized
     // and optimized code.
 
-    int (*write_page)(struct v_inode* inode, void* pg, size_t len, size_t fpos);
-    int (*read_page)(struct v_inode* inode, void* pg, size_t len, size_t fpos);
+    int (*write_page)(struct v_inode* inode, void* pg, size_t fpos);
+    int (*read_page)(struct v_inode* inode, void* pg, size_t fpos);
 
     int (*readdir)(struct v_file* file, struct dir_context* dctx);
     int (*seek)(struct v_inode* inode, size_t offset); // optional
@@ -297,6 +298,12 @@ struct pcache_pg
     u32_t len;
 };
 
+static inline bool
+check_itype_any(struct v_inode* inode, unsigned int type_mask)
+{
+    return !!(inode->itype & type_mask) || !type_mask;
+}
+
 void
 fsm_init();
 
@@ -497,6 +504,12 @@ default_file_write(struct v_inode* inode,
                    size_t len,
                    size_t fpos);
 
+int
+default_file_read_page(struct v_inode* inode, void* buffer, size_t fpos);
+
+int
+default_file_write_page(struct v_inode* inode, void* buffer, size_t fpos);
+
 int
 default_file_readdir(struct v_file* file, struct dir_context* dctx);