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 <david.chen@osnexus.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Issue #4021
This commit is contained in:
Chunwei Chen
2015-11-23 15:06:46 -08:00
committed by Brian Behlendorf
parent 1a09371678
commit 61d482f7cd
3 changed files with 164 additions and 2 deletions
+67 -2
View File
@@ -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 */
};