X-Git-Url: https://scm.lunaixsky.com/lunaix-os.git/blobdiff_plain/d8d001a6664b88b66524989589fcd809de6d3a92..9461d582084ab8c0d85e8dca1df276945366a84b:/lunaix-os/includes/lunaix/fs.h diff --git a/lunaix-os/includes/lunaix/fs.h b/lunaix-os/includes/lunaix/fs.h index 2d405ee..fd09e96 100644 --- a/lunaix-os/includes/lunaix/fs.h +++ b/lunaix-os/includes/lunaix/fs.h @@ -3,6 +3,7 @@ #include #include +#include #include #include #include @@ -12,10 +13,11 @@ #define VFS_NAME_MAXLEN 128 #define VFS_MAX_FD 32 -#define VFS_INODE_TYPE_DIR 0x1 -#define VFS_INODE_TYPE_FILE 0x2 -#define VFS_INODE_TYPE_DEVICE 0x4 -#define VFS_INODE_TYPE_SYMLINK 0x8 +#define VFS_IFDIR 0x1 +#define VFS_IFFILE 0x2 +#define VFS_IFSEQDEV 0x4 +#define VFS_IFVOLDEV 0x8 +#define VFS_IFSYMLINK 0x16 #define VFS_WALK_MKPARENT 0x1 #define VFS_WALK_FSRELATIVE 0x2 @@ -100,9 +102,10 @@ struct v_fd struct v_inode { uint32_t itype; - uint32_t ctime; - uint32_t mtime; - uint64_t lb_addr; + time_t ctime; + time_t mtime; + time_t atime; + lba_t lb_addr; uint32_t open_count; uint32_t link_count; uint32_t lb_usage; @@ -122,6 +125,7 @@ struct v_inode int (*symlink)(struct v_inode* this, const char* target); int (*dir_lookup)(struct v_inode* this, struct v_dnode* dnode); } ops; + struct v_file_ops default_fops; }; struct v_dnode @@ -133,6 +137,7 @@ struct v_dnode struct llist_header children; struct llist_header siblings; struct v_superblock* super_block; + uint32_t ref_count; struct { void (*destruct)(struct v_dnode* dnode); @@ -230,6 +235,9 @@ vfs_i_alloc(); void vfs_i_free(struct v_inode* inode); +int +vfs_dup_fd(struct v_fd* old, struct v_fd** new); + void pcache_init(struct pcache* pcache); @@ -249,10 +257,10 @@ pcache_get_page(struct pcache* pcache, struct pcache_pg** page); int -pcache_write(struct v_file* file, void* data, uint32_t len); +pcache_write(struct v_file* file, void* data, uint32_t len, uint32_t fpos); int -pcache_read(struct v_file* file, void* data, uint32_t len); +pcache_read(struct v_file* file, void* data, uint32_t len, uint32_t fpos); void pcache_release(struct pcache* pcache);