X-Git-Url: https://scm.lunaixsky.com/lunaix-os.git/blobdiff_plain/841bc2c7be78b30f5d0e13bb344db78da0ed665d..74926d2db1d9f3228acdfca03013a8ba0ac1d8c0:/lunaix-os/kernel/fs/vfs.c diff --git a/lunaix-os/kernel/fs/vfs.c b/lunaix-os/kernel/fs/vfs.c index 9680f2e..d3d1023 100644 --- a/lunaix-os/kernel/fs/vfs.c +++ b/lunaix-os/kernel/fs/vfs.c @@ -44,7 +44,6 @@ */ #include -#include #include #include #include @@ -53,9 +52,12 @@ #include #include #include +#include #include +#include + static struct cake_pile* dnode_pile; static struct cake_pile* inode_pile; static struct cake_pile* file_pile; @@ -624,13 +626,13 @@ __vfs_readdir_callback(struct dir_context* dctx, const int len, const int dtype) { - struct dirent* dent = (struct dirent*)dctx->cb_data; + struct lx_dirent* dent = (struct lx_dirent*)dctx->cb_data; strncpy(dent->d_name, name, DIRENT_NAME_MAX_LEN); dent->d_nlen = len; dent->d_type = dtype; } -__DEFINE_LXSYSCALL2(int, readdir, int, fd, struct dirent*, dent) +__DEFINE_LXSYSCALL2(int, sys_readdir, int, fd, struct lx_dirent*, dent) { struct v_fd* fd_s; int errno; @@ -1223,6 +1225,12 @@ done: return DO_STATUS(errno); } +void +vfs_ref_file(struct v_file* file) +{ + atomic_fetch_add(&file->ref_count, 1); +} + void vfs_ref_dnode(struct v_dnode* dnode) {