posix_acl: xattr representation cleanups

Remove the unnecessary typedefs and the zero-length a_entries array in
struct posix_acl_xattr_header.

Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
Andreas Gruenbacher
2016-09-27 13:03:22 +02:00
committed by Al Viro
parent de04e76935
commit 2211d5ba5c
6 changed files with 51 additions and 54 deletions

View File

@@ -18,34 +18,33 @@
/* An undefined entry e_id value */
#define ACL_UNDEFINED_ID (-1)
typedef struct {
struct posix_acl_xattr_entry {
__le16 e_tag;
__le16 e_perm;
__le32 e_id;
} posix_acl_xattr_entry;
};
typedef struct {
struct posix_acl_xattr_header {
__le32 a_version;
posix_acl_xattr_entry a_entries[0];
} posix_acl_xattr_header;
};
static inline size_t
posix_acl_xattr_size(int count)
{
return (sizeof(posix_acl_xattr_header) +
(count * sizeof(posix_acl_xattr_entry)));
return (sizeof(struct posix_acl_xattr_header) +
(count * sizeof(struct posix_acl_xattr_entry)));
}
static inline int
posix_acl_xattr_count(size_t size)
{
if (size < sizeof(posix_acl_xattr_header))
if (size < sizeof(struct posix_acl_xattr_header))
return -1;
size -= sizeof(posix_acl_xattr_header);
if (size % sizeof(posix_acl_xattr_entry))
size -= sizeof(struct posix_acl_xattr_header);
if (size % sizeof(struct posix_acl_xattr_entry))
return -1;
return size / sizeof(posix_acl_xattr_entry);
return size / sizeof(struct posix_acl_xattr_entry);
}
#ifdef CONFIG_FS_POSIX_ACL