X-Git-Url: https://scm.lunaixsky.com/lunaix-os.git/blobdiff_plain/871af48a7d8d1a8cca7b27e0e15d1dfa030bd172..5f4f16c074be65639b5c3333441d48b1d418104c:/lunaix-os/includes/lunaix/fs.h diff --git a/lunaix-os/includes/lunaix/fs.h b/lunaix-os/includes/lunaix/fs.h index 6feb2aa..b64cdcf 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; @@ -707,4 +713,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 */