Fix some bugs when testing opensds ansible
[stor4nfv.git] / src / ceph / src / client / posix_acl.h
1 #ifndef CEPH_POSIX_ACL
2 #define CEPH_POSIX_ACL
3
4 #define ACL_EA_VERSION          0x0002
5
6 #define ACL_USER_OBJ            0x01
7 #define ACL_USER                0x02
8 #define ACL_GROUP_OBJ           0x04
9 #define ACL_GROUP               0x08
10 #define ACL_MASK                0x10
11 #define ACL_OTHER               0x20
12
13 #define ACL_EA_ACCESS  "system.posix_acl_access"
14 #define ACL_EA_DEFAULT "system.posix_acl_default"
15
16 typedef struct {
17   ceph_le16       e_tag;
18   ceph_le16       e_perm;
19   ceph_le32       e_id;
20 } acl_ea_entry;
21
22 typedef struct {
23   ceph_le32       a_version;
24   acl_ea_entry    a_entries[0];
25 } acl_ea_header;
26
27 class UserPerm;
28
29 int posix_acl_check(const void *xattr, size_t size);
30 int posix_acl_equiv_mode(const void *xattr, size_t size, mode_t *mode_p);
31 int posix_acl_inherit_mode(bufferptr& acl, mode_t *mode_p);
32 int posix_acl_access_chmod(bufferptr& acl, mode_t mode);
33 int posix_acl_permits(const bufferptr& acl, uid_t i_uid, gid_t i_gid,
34                       const UserPerm& groups, unsigned want);
35 #endif