]) #LC_HAVE_KEY_PAYLOAD_DATA_ARRAY
#
+# LC_HAVE_XATTR_HANDLER_NAME
+#
+# Kernel version 4.4 commit 98e9cb5711c68223f0e4d5201b9a6add255ec550
+# add a name member to struct xattr_handler
+#
+AC_DEFUN([LC_HAVE_XATTR_HANDLER_NAME], [
+tmp_flags="$EXTRA_KCFLAGS"
+EXTRA_KCFLAGS="-Werror"
+LB_CHECK_COMPILE([if 'struct xattr_handler' has a name member],
+xattr_handler_name, [
+ #include <linux/xattr.h>
+],[
+ ((struct xattr_handler *)NULL)->name = NULL;
+],[
+ AC_DEFINE(HAVE_XATTR_HANDLER_NAME, 1, [xattr_handler has a name member])
+])
+EXTRA_KCFLAGS="$tmp_flags"
+]) # LC_HAVE_XATTR_HANDLER_NAME
+
+#
# LC_HAVE_FILE_DENTRY
#
# 4.5 adds wrapper file_dentry
# 4.4
LC_HAVE_LOCKS_LOCK_FILE_WAIT
LC_HAVE_KEY_PAYLOAD_DATA_ARRAY
+ LC_HAVE_XATTR_HANDLER_NAME
LC_HAVE_BI_CNT
LC_HAVE_BI_RW
LC_HAVE_SUBMIT_BIO_2ARGS
#include "llite_internal.h"
+#ifndef HAVE_XATTR_HANDLER_NAME
+static inline const char *xattr_prefix(const struct xattr_handler *handler)
+{
+ return handler->prefix;
+}
+#endif
+
const struct xattr_handler *get_xattr_type(const char *name)
{
- int i = 0;
+ int i;
- while (ll_xattr_handlers[i]) {
- size_t len = strlen(ll_xattr_handlers[i]->prefix);
+ for (i = 0; ll_xattr_handlers[i]; i++) {
+ const char *prefix = xattr_prefix(ll_xattr_handlers[i]);
+ size_t prefix_len = strlen(prefix);
- if (!strncmp(ll_xattr_handlers[i]->prefix, name, len))
+ if (!strncmp(prefix, name, prefix_len))
return ll_xattr_handlers[i];
- i++;
}
+
return NULL;
}
RETURN(-EPERM);
}
- fullname = kasprintf(GFP_KERNEL, "%s%s", handler->prefix, name);
+ fullname = kasprintf(GFP_KERNEL, "%s%s", xattr_prefix(handler), name);
if (!fullname)
RETURN(-ENOMEM);
RETURN(-ENODATA);
#endif
- fullname = kasprintf(GFP_KERNEL, "%s%s", handler->prefix, name);
+ fullname = kasprintf(GFP_KERNEL, "%s%s", xattr_prefix(handler), name);
if (!fullname)
RETURN(-ENOMEM);
};
static const struct xattr_handler ll_acl_access_xattr_handler = {
+#ifdef HAVE_XATTR_HANDLER_NAME
+ .name = XATTR_NAME_POSIX_ACL_ACCESS,
+#else
.prefix = XATTR_NAME_POSIX_ACL_ACCESS,
+#endif
.flags = XATTR_ACL_ACCESS_T,
#if defined(HAVE_XATTR_HANDLER_SIMPLIFIED)
.get = ll_xattr_get_common_4_3,
};
static const struct xattr_handler ll_acl_default_xattr_handler = {
+#ifdef HAVE_XATTR_HANDLER_NAME
+ .name = XATTR_NAME_POSIX_ACL_DEFAULT,
+#else
.prefix = XATTR_NAME_POSIX_ACL_DEFAULT,
+#endif
.flags = XATTR_ACL_DEFAULT_T,
#if defined(HAVE_XATTR_HANDLER_SIMPLIFIED)
.get = ll_xattr_get_common_4_3,