aboutsummaryrefslogtreecommitdiffstats
path: root/module/zfs/zpl_xattr.c
diff options
context:
space:
mode:
authorChunwei Chen <[email protected]>2015-11-23 15:06:46 -0800
committerBrian Behlendorf <[email protected]>2015-12-01 16:48:25 -0800
commit61d482f7cd1687177185140699c6843c904b38d4 (patch)
tree3240dbdd43598b72269d236be575e5a0ab7a369c /module/zfs/zpl_xattr.c
parent1a093716788a08b5d038c49ab99a6e9363c97a64 (diff)
Linux 4.4 compat: xattr operations takes xattr_handler
The xattr_hander->{list,get,set} were changed to take a xattr_handler, and handler_flags argument was removed and should be accessed by handler->flags. Signed-off-by: Chunwei Chen <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Issue #4021
Diffstat (limited to 'module/zfs/zpl_xattr.c')
-rw-r--r--module/zfs/zpl_xattr.c69
1 files changed, 67 insertions, 2 deletions
diff --git a/module/zfs/zpl_xattr.c b/module/zfs/zpl_xattr.c
index 202199c6d..d224078ef 100644
--- a/module/zfs/zpl_xattr.c
+++ b/module/zfs/zpl_xattr.c
@@ -1022,6 +1022,29 @@ zpl_xattr_acl_list_default(struct dentry *dentry, char *list,
list, list_size, name, name_len, type);
}
+#elif defined(HAVE_HANDLER_XATTR_LIST)
+static size_t
+zpl_xattr_acl_list_access(const struct xattr_handler *handler,
+ struct dentry *dentry, char *list, size_t list_size, const char *name,
+ size_t name_len)
+{
+ int type = handler->flags;
+ ASSERT3S(type, ==, ACL_TYPE_ACCESS);
+ return zpl_xattr_acl_list(dentry->d_inode,
+ list, list_size, name, name_len, type);
+}
+
+static size_t
+zpl_xattr_acl_list_default(const struct xattr_handler *handler,
+ struct dentry *dentry, char *list, size_t list_size, const char *name,
+ size_t name_len)
+{
+ int type = handler->flags;
+ ASSERT3S(type, ==, ACL_TYPE_DEFAULT);
+ return zpl_xattr_acl_list(dentry->d_inode,
+ list, list_size, name, name_len, type);
+}
+
#else
static size_t
@@ -1083,6 +1106,25 @@ zpl_xattr_acl_get_default(struct dentry *dentry, const char *name,
return (zpl_xattr_acl_get(dentry->d_inode, name, buffer, size, type));
}
+#elif defined(HAVE_HANDLER_XATTR_GET)
+static int
+zpl_xattr_acl_get_access(const struct xattr_handler *handler,
+ struct dentry *dentry, const char *name, void *buffer, size_t size)
+{
+ int type = handler->flags;
+ ASSERT3S(type, ==, ACL_TYPE_ACCESS);
+ return (zpl_xattr_acl_get(dentry->d_inode, name, buffer, size, type));
+}
+
+static int
+zpl_xattr_acl_get_default(const struct xattr_handler *handler,
+ struct dentry *dentry, const char *name, void *buffer, size_t size)
+{
+ int type = handler->flags;
+ ASSERT3S(type, ==, ACL_TYPE_DEFAULT);
+ return (zpl_xattr_acl_get(dentry->d_inode, name, buffer, size, type));
+}
+
#else
static int
@@ -1156,6 +1198,29 @@ zpl_xattr_acl_set_default(struct dentry *dentry, const char *name,
name, value, size, flags, type);
}
+#elif defined(HAVE_HANDLER_XATTR_SET)
+static int
+zpl_xattr_acl_set_access(const struct xattr_handler *handler,
+ struct dentry *dentry, const char *name, const void *value, size_t size,
+ int flags)
+{
+ int type = handler->flags;
+ ASSERT3S(type, ==, ACL_TYPE_ACCESS);
+ return (zpl_xattr_acl_set(dentry->d_inode,
+ name, value, size, flags, type));
+}
+
+static int
+zpl_xattr_acl_set_default(const struct xattr_handler *handler,
+ struct dentry *dentry, const char *name, const void *value, size_t size,
+ int flags)
+{
+ int type = handler->flags;
+ ASSERT3S(type, ==, ACL_TYPE_DEFAULT);
+ return zpl_xattr_acl_set(dentry->d_inode,
+ name, value, size, flags, type);
+}
+
#else
static int
@@ -1181,7 +1246,7 @@ struct xattr_handler zpl_xattr_acl_access_handler =
.list = zpl_xattr_acl_list_access,
.get = zpl_xattr_acl_get_access,
.set = zpl_xattr_acl_set_access,
-#ifdef HAVE_DENTRY_XATTR_LIST
+#if defined(HAVE_DENTRY_XATTR_LIST) || defined(HAVE_HANDLER_XATTR_LIST)
.flags = ACL_TYPE_ACCESS,
#endif /* HAVE_DENTRY_XATTR_LIST */
};
@@ -1192,7 +1257,7 @@ struct xattr_handler zpl_xattr_acl_default_handler =
.list = zpl_xattr_acl_list_default,
.get = zpl_xattr_acl_get_default,
.set = zpl_xattr_acl_set_default,
-#ifdef HAVE_DENTRY_XATTR_LIST
+#if defined(HAVE_DENTRY_XATTR_LIST) || defined(HAVE_HANDLER_XATTR_LIST)
.flags = ACL_TYPE_DEFAULT,
#endif /* HAVE_DENTRY_XATTR_LIST */
};