]> git.sesse.net Git - bcachefs-tools-debian/blob - libbcachefs/acl.h
New upstream release
[bcachefs-tools-debian] / libbcachefs / acl.h
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _BCACHEFS_ACL_H
3 #define _BCACHEFS_ACL_H
4
5 struct bch_inode_unpacked;
6 struct bch_hash_info;
7 struct bch_inode_info;
8 struct posix_acl;
9
10 #ifdef CONFIG_BCACHEFS_POSIX_ACL
11
12 #define BCH_ACL_VERSION 0x0001
13
14 typedef struct {
15         __le16          e_tag;
16         __le16          e_perm;
17         __le32          e_id;
18 } bch_acl_entry;
19
20 typedef struct {
21         __le16          e_tag;
22         __le16          e_perm;
23 } bch_acl_entry_short;
24
25 typedef struct {
26         __le32          a_version;
27 } bch_acl_header;
28
29 struct posix_acl *bch2_get_acl(struct inode *, int);
30
31 int bch2_set_acl_trans(struct btree_trans *,
32                        struct bch_inode_unpacked *,
33                        const struct bch_hash_info *,
34                        struct posix_acl *, int);
35 int bch2_set_acl(struct user_namespace *, struct inode *, struct posix_acl *, int);
36 int bch2_acl_chmod(struct btree_trans *, struct bch_inode_unpacked *,
37                    umode_t, struct posix_acl **);
38
39 #else
40
41 static inline int bch2_set_acl_trans(struct btree_trans *trans,
42                                      struct bch_inode_unpacked *inode_u,
43                                      const struct bch_hash_info *hash_info,
44                                      struct posix_acl *acl, int type)
45 {
46         return 0;
47 }
48
49 static inline int bch2_acl_chmod(struct btree_trans *trans,
50                                  struct bch_inode_unpacked *inode,
51                                  umode_t mode,
52                                  struct posix_acl **new_acl)
53 {
54         return 0;
55 }
56
57 #endif /* CONFIG_BCACHEFS_POSIX_ACL */
58
59 #endif /* _BCACHEFS_ACL_H */