In commit
2211d5ba5c6c4e972ba6dbc912b2897425ea6621 typedef of
posix_acl_xattr_{header,entry} was removed and replaced with
struct posix_acl_xattr_{header,entry} declaration. Also member
a_entries was removed from struct posix_acl_xattr_header.
Since we have to support older kernels this patch does the
opposite of what was done upstream in that we treat struct
posix_acl_xattr_{header,entry} of newer kernels as the typedef
used by older kernels.
Change-Id: I880f73d495dc6c35a1671b49e509350118f6e154
Signed-off-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-on: https://review.whamcloud.com/25892
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Tested-by: Jenkins
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
]) # LC_GROUP_INFO_GID
#
+# LC_STRUCT_POSIX_ACL_XATTR
+#
+# Kernel version 4.8 commit 2211d5ba5c6c4e972ba6dbc912b2897425ea6621
+# posix_acl: xattr representation cleanups
+#
+AC_DEFUN([LC_STRUCT_POSIX_ACL_XATTR], [
+LB_CHECK_COMPILE([if 'struct posix_acl_xattr_{header,entry}' defined],
+struct_posix_acl_xattr, [
+ #include <linux/fs.h>
+ #include <linux/posix_acl_xattr.h>
+],[
+ struct posix_acl_xattr_header *h = NULL;
+ struct posix_acl_xattr_entry *e;
+ e = (void *)(h + 1);
+],[
+ AC_DEFINE(HAVE_STRUCT_POSIX_ACL_XATTR, 1,
+ [struct posix_acl_xattr_{header,entry} defined])
+])
+]) # LC_STRUCT_POSIX_ACL_XATTR
+
+#
# LC_PROG_LINUX
#
# Lustre linux kernel checks
LC_HAVE_POSIX_ACL_VALID_USER_NS
LC_D_COMPARE_4ARGS
LC_FULL_NAME_HASH_3ARGS
+ LC_STRUCT_POSIX_ACL_XATTR
# 4.9
LC_GROUP_INFO_GID
# define ll_full_name_hash(salt, name, len) full_name_hash(name, len)
#endif
+#ifdef HAVE_STRUCT_POSIX_ACL_XATTR
+# define posix_acl_xattr_header struct posix_acl_xattr_header
+# define posix_acl_xattr_entry struct posix_acl_xattr_entry
+# define GET_POSIX_ACL_XATTR_ENTRY(head) ((void *)((head) + 1))
+#else
+# define GET_POSIX_ACL_XATTR_ENTRY(head) ((head)->a_entries)
+#endif
+
#endif /* _LUSTRE_COMPAT_H */
struct lu_attr;
struct lustre_idmap_table;
+#ifdef HAVE_STRUCT_POSIX_ACL_XATTR
+# define posix_acl_xattr_header struct posix_acl_xattr_header
+# define posix_acl_xattr_entry struct posix_acl_xattr_entry
+#endif
+
extern int lustre_posix_acl_permission(struct lu_ucred *mu,
const struct lu_attr *la, int want,
posix_acl_xattr_entry *entry,
buf.lb_len = rc;
head = (posix_acl_xattr_header *)(buf.lb_buf);
- entry = head->a_entries;
+ entry = GET_POSIX_ACL_XATTR_ENTRY(head);
entry_count = (buf.lb_len - sizeof(head->a_version)) /
sizeof(posix_acl_xattr_entry);
if (entry_count <= 0)
ENTRY;
head = (posix_acl_xattr_header *)(buf->lb_buf);
- entry = head->a_entries;
+ entry = GET_POSIX_ACL_XATTR_ENTRY(head);
entry_count = (buf->lb_len - sizeof(head->a_version)) /
sizeof(posix_acl_xattr_entry);
if (entry_count <= 0)
ENTRY;
head = (posix_acl_xattr_header *)(buf->lb_buf);
- entry = head->a_entries;
+ entry = GET_POSIX_ACL_XATTR_ENTRY(head);
entry_count = (buf->lb_len - sizeof(head->a_version)) /
sizeof(posix_acl_xattr_entry);
if (entry_count <= 0)
buf.lb_len = rc;
head = (posix_acl_xattr_header *)(buf.lb_buf);
- entry = head->a_entries;
+ entry = GET_POSIX_ACL_XATTR_ENTRY(head);
entry_count = posix_acl_xattr_count(buf.lb_len);
/* Disregard empty ACLs and fall back to
enum nodemap_tree_type tree_type)
{
posix_acl_xattr_header *header = buf;
- posix_acl_xattr_entry *entry = &header->a_entries[0];
+ posix_acl_xattr_entry *entry = GET_POSIX_ACL_XATTR_ENTRY(header);
posix_acl_xattr_entry *new_entry = entry;
posix_acl_xattr_entry *end;
int count;
(long long)(int)offsetof(posix_acl_xattr_header, a_version));
LASSERTF((int)sizeof(((posix_acl_xattr_header *)0)->a_version) == 4, "found %lld\n",
(long long)(int)sizeof(((posix_acl_xattr_header *)0)->a_version));
+#ifndef HAVE_STRUCT_POSIX_ACL_XATTR
LASSERTF((int)offsetof(posix_acl_xattr_header, a_entries) == 4, "found %lld\n",
(long long)(int)offsetof(posix_acl_xattr_header, a_entries));
LASSERTF((int)sizeof(((posix_acl_xattr_header *)0)->a_entries) == 0, "found %lld\n",
(long long)(int)sizeof(((posix_acl_xattr_header *)0)->a_entries));
+#endif
#endif /* CONFIG_FS_POSIX_ACL */
/* Checks for struct link_ea_header */