1 // SPDX-License-Identifier: GPL-2.0
5 (C) 2001 Andreas Gruenbacher, <a.gruenbacher@computer.org>
8 #include <linux/posix_acl_xattr.h>
10 #define EXT4_ACL_VERSION 0x0001
21 } ext4_acl_entry_short;
27 static inline size_t ext4_acl_size(int count)
30 return sizeof(ext4_acl_header) +
31 count * sizeof(ext4_acl_entry_short);
33 return sizeof(ext4_acl_header) +
34 4 * sizeof(ext4_acl_entry_short) +
35 (count - 4) * sizeof(ext4_acl_entry);
39 static inline int ext4_acl_count(size_t size)
42 size -= sizeof(ext4_acl_header);
43 s = size - 4 * sizeof(ext4_acl_entry_short);
45 if (size % sizeof(ext4_acl_entry_short))
47 return size / sizeof(ext4_acl_entry_short);
49 if (s % sizeof(ext4_acl_entry))
51 return s / sizeof(ext4_acl_entry) + 4;
55 #ifdef CONFIG_EXT4_FS_POSIX_ACL
58 struct posix_acl *ext4_get_acl(struct inode *inode, int type, bool rcu);
59 int ext4_set_acl(struct mnt_idmap *idmap, struct dentry *dentry,
60 struct posix_acl *acl, int type);
61 extern int ext4_init_acl(handle_t *, struct inode *, struct inode *);
63 #else /* CONFIG_EXT4_FS_POSIX_ACL */
64 #include <linux/sched.h>
65 #define ext4_get_acl NULL
66 #define ext4_set_acl NULL
69 ext4_init_acl(handle_t *handle, struct inode *inode, struct inode *dir)
73 #endif /* CONFIG_EXT4_FS_POSIX_ACL */