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 EXT2_ACL_VERSION 0x0001
21 } ext2_acl_entry_short;
27 static inline size_t ext2_acl_size(int count)
30 return sizeof(ext2_acl_header) +
31 count * sizeof(ext2_acl_entry_short);
33 return sizeof(ext2_acl_header) +
34 4 * sizeof(ext2_acl_entry_short) +
35 (count - 4) * sizeof(ext2_acl_entry);
39 static inline int ext2_acl_count(size_t size)
42 size -= sizeof(ext2_acl_header);
43 s = size - 4 * sizeof(ext2_acl_entry_short);
45 if (size % sizeof(ext2_acl_entry_short))
47 return size / sizeof(ext2_acl_entry_short);
49 if (s % sizeof(ext2_acl_entry))
51 return s / sizeof(ext2_acl_entry) + 4;
55 #ifdef CONFIG_EXT2_FS_POSIX_ACL
58 extern struct posix_acl *ext2_get_acl(struct inode *inode, int type);
59 extern int ext2_set_acl(struct user_namespace *mnt_userns, struct inode *inode,
60 struct posix_acl *acl, int type);
61 extern int ext2_init_acl (struct inode *, struct inode *);
64 #include <linux/sched.h>
65 #define ext2_get_acl NULL
66 #define ext2_set_acl NULL
68 static inline int ext2_init_acl (struct inode *inode, struct inode *dir)