X-Git-Url: https://scm.lunaixsky.com/lunaix-os.git/blobdiff_plain/cbc8fdbfe473e23e19690204418e19999a9522d1..0fd474df7001837bde53da0e42e83081827c9641:/lunaix-os/includes/lunaix/fs.h?ds=sidebyside diff --git a/lunaix-os/includes/lunaix/fs.h b/lunaix-os/includes/lunaix/fs.h index 6feb2aa..bba939c 100644 --- a/lunaix-os/includes/lunaix/fs.h +++ b/lunaix-os/includes/lunaix/fs.h @@ -13,6 +13,7 @@ #include #include #include +#include #include @@ -248,6 +249,11 @@ struct v_inode u32_t link_count; u32_t lb_usage; u32_t fsize; + + u32_t acl; + uid_t uid; + gid_t gid; + void* data; // 允许底层FS绑定他的一些专有数据 struct llist_header aka_dnodes; struct llist_header xattrs; @@ -389,6 +395,10 @@ vfs_walk_proc(const char* path, struct hstr* component, int options); +int +vfs_walkat(int fd, const char* path, int at_opts, + struct v_dnode** dnode_out); + int vfs_mount(const char* target, const char* fs_name, @@ -707,4 +717,28 @@ check_symlink_node(struct v_inode* inode) return check_itype(inode->itype, VFS_IFSYMLINK); } +static inline bool +check_allow_ops(struct v_inode* inode, unsigned int perm) +{ + return fsacl_allow_ops(perm, inode->acl, inode->uid, inode->gid); +} + +static inline bool +check_allow_read(struct v_inode* inode) +{ + return check_allow_ops(inode, FSACL_aR); +} + +static inline bool +check_allow_write(struct v_inode* inode) +{ + return check_allow_ops(inode, FSACL_aW); +} + +static inline bool +check_allow_execute(struct v_inode* inode) +{ + return check_allow_ops(inode, FSACL_aX); +} + #endif /* __LUNAIX_VFS_H */