1290001Sglebius/* SPDX-License-Identifier: GPL-2.0 */
2290001Sglebius#ifndef _BCACHEFS_ACL_H
3290001Sglebius#define _BCACHEFS_ACL_H
4290001Sglebius
5290001Sglebiusstruct bch_inode_unpacked;
6290001Sglebiusstruct bch_hash_info;
7290001Sglebiusstruct bch_inode_info;
8290001Sglebiusstruct posix_acl;
9290001Sglebius
10290001Sglebius#define BCH_ACL_VERSION	0x0001
11290001Sglebius
12290001Sglebiustypedef struct {
13290001Sglebius	__le16		e_tag;
14290001Sglebius	__le16		e_perm;
15290001Sglebius	__le32		e_id;
16290001Sglebius} bch_acl_entry;
17290001Sglebius
18290001Sglebiustypedef struct {
19290001Sglebius	__le16		e_tag;
20290001Sglebius	__le16		e_perm;
21290001Sglebius} bch_acl_entry_short;
22290001Sglebius
23290001Sglebiustypedef struct {
24290001Sglebius	__le32		a_version;
25290001Sglebius} bch_acl_header;
26290001Sglebius
27293896Sglebiusvoid bch2_acl_to_text(struct printbuf *, const void *, size_t);
28290001Sglebius
29290001Sglebius#ifdef CONFIG_BCACHEFS_POSIX_ACL
30290001Sglebius
31290001Sglebiusstruct posix_acl *bch2_get_acl(struct mnt_idmap *, struct dentry *, int);
32290001Sglebius
33290001Sglebiusint bch2_set_acl_trans(struct btree_trans *, subvol_inum,
34290001Sglebius		       struct bch_inode_unpacked *,
35290001Sglebius		       struct posix_acl *, int);
36290001Sglebiusint bch2_set_acl(struct mnt_idmap *, struct dentry *, struct posix_acl *, int);
37290001Sglebiusint bch2_acl_chmod(struct btree_trans *, subvol_inum,
38290001Sglebius		   struct bch_inode_unpacked *,
39290001Sglebius		   umode_t, struct posix_acl **);
40290001Sglebius
41290001Sglebius#else
42290001Sglebius
43290001Sglebiusstatic inline int bch2_set_acl_trans(struct btree_trans *trans, subvol_inum inum,
44290001Sglebius				     struct bch_inode_unpacked *inode_u,
45290001Sglebius				     struct posix_acl *acl, int type)
46290001Sglebius{
47290001Sglebius	return 0;
48290001Sglebius}
49290001Sglebius
50290001Sglebiusstatic inline int bch2_acl_chmod(struct btree_trans *trans, subvol_inum inum,
51290001Sglebius				 struct bch_inode_unpacked *inode,
52290001Sglebius				 umode_t mode,
53290001Sglebius				 struct posix_acl **new_acl)
54290001Sglebius{
55290001Sglebius	return 0;
56290001Sglebius}
57290001Sglebius
58293896Sglebius#endif /* CONFIG_BCACHEFS_POSIX_ACL */
59293896Sglebius
60293896Sglebius#endif /* _BCACHEFS_ACL_H */
61293896Sglebius