X-Git-Url: https://scm.lunaixsky.com/lunaix-os.git/blobdiff_plain/5f4f16c074be65639b5c3333441d48b1d418104c..c8cc1783ef26803aeb94747ff8704bbe6962628a:/lunaix-os/includes/lunaix/fs_acl.h?ds=sidebyside diff --git a/lunaix-os/includes/lunaix/fs_acl.h b/lunaix-os/includes/lunaix/fs_acl.h index c05080b..43ab5e2 100644 --- a/lunaix-os/includes/lunaix/fs_acl.h +++ b/lunaix-os/includes/lunaix/fs_acl.h @@ -8,6 +8,8 @@ #define FSACL_WRITE 2 #define FSACL_EXEC 1 +#define FSACL_MASK 03777 +#define FSACL_RWXMASK 0777 #define FSACL_U(x) (((x) & 0b111) << 6) #define FSACL_G(x) (((x) & 0b111) << 3) #define FSACL_O(x) ((x) & 0b111) @@ -24,6 +26,10 @@ #define FSACL_oW FSACL_O(FSACL_WRITE) #define FSACL_oX FSACL_O(FSACL_EXEC) +#define FSACL_suid 04000 +#define FSACL_sgid 02000 +#define FSACL_svtx 01000 + // permitted read (any usr or group matched) #define FSACL_RD (FSACL_uRD | FSACL_gRD) // permitted write (any usr or group matched) @@ -35,13 +41,17 @@ #define FSACL_g_ 0 #define FSACL_o_ 0 -// any read +// any #define FSACL_aR (FSACL_uR | FSACL_gR | FSACL_oR) -// any write #define FSACL_aW (FSACL_uW | FSACL_gW | FSACL_oW) -// any execute #define FSACL_aX (FSACL_uX | FSACL_gX | FSACL_oX) +// user/group +#define FSACL_ugR (FSACL_uR | FSACL_gR) +#define FSACL_ugW (FSACL_uW | FSACL_gW) +#define FSACL_ugX (FSACL_uX | FSACL_gX) + + #define __fsacl_sel(scope, type) (FSACL_##scope##type) #define FSACL_u(r, w, x) \ (v__(__fsacl_sel(u, r)) | v__(__fsacl_sel(u, w)) | v__(__fsacl_sel(u, x))) @@ -52,6 +62,11 @@ #define FSACL_o(r, w, x) \ (v__(__fsacl_sel(o, r)) | v__(__fsacl_sel(o, w)) | v__(__fsacl_sel(o, x))) +#define FSACL_DEFAULT \ + (FSACL_u(R, W, X) | FSACL_g(R, W, X) | FSACL_o(R, _, X)) + +#define fsacl_test(acl, type) ((acl) & (FSACL_##type)) + static inline bool must_inline fsacl_allow_ops(unsigned int ops, unsigned int acl, uid_t uid, gid_t gid) {