mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-26 11:19:32 +03:00
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:
parent
1a09371678
commit
61d482f7cd
@ -37,6 +37,11 @@ dnl # 2.6.33 API change,
|
|||||||
dnl # The xattr_hander->get() callback was changed to take a dentry
|
dnl # The xattr_hander->get() callback was changed to take a dentry
|
||||||
dnl # instead of an inode, and a handler_flags argument was added.
|
dnl # instead of an inode, and a handler_flags argument was added.
|
||||||
dnl #
|
dnl #
|
||||||
|
dnl # 4.4 API change,
|
||||||
|
dnl # The xattr_hander->get() callback was changed to take a xattr_handler,
|
||||||
|
dnl # and handler_flags argument was removed and should be accessed by
|
||||||
|
dnl # handler->flags.
|
||||||
|
dnl #
|
||||||
AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_GET], [
|
AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_GET], [
|
||||||
AC_MSG_CHECKING([whether xattr_handler->get() wants dentry])
|
AC_MSG_CHECKING([whether xattr_handler->get() wants dentry])
|
||||||
ZFS_LINUX_TRY_COMPILE([
|
ZFS_LINUX_TRY_COMPILE([
|
||||||
@ -55,6 +60,24 @@ AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_GET], [
|
|||||||
[xattr_handler->get() wants dentry])
|
[xattr_handler->get() wants dentry])
|
||||||
],[
|
],[
|
||||||
AC_MSG_RESULT(no)
|
AC_MSG_RESULT(no)
|
||||||
|
AC_MSG_CHECKING([whether xattr_handler->get() wants xattr_handler])
|
||||||
|
ZFS_LINUX_TRY_COMPILE([
|
||||||
|
#include <linux/xattr.h>
|
||||||
|
|
||||||
|
int get(const struct xattr_handler *handler, struct dentry *dentry,
|
||||||
|
const char *name, void *buffer, size_t size) { return 0; }
|
||||||
|
static const struct xattr_handler
|
||||||
|
xops __attribute__ ((unused)) = {
|
||||||
|
.get = get,
|
||||||
|
};
|
||||||
|
],[
|
||||||
|
],[
|
||||||
|
AC_MSG_RESULT(yes)
|
||||||
|
AC_DEFINE(HAVE_HANDLER_XATTR_GET, 1,
|
||||||
|
[xattr_handler->get() wants xattr_handler])
|
||||||
|
],[
|
||||||
|
AC_MSG_RESULT(no)
|
||||||
|
])
|
||||||
])
|
])
|
||||||
])
|
])
|
||||||
|
|
||||||
@ -63,6 +86,11 @@ dnl # 2.6.33 API change,
|
|||||||
dnl # The xattr_hander->set() callback was changed to take a dentry
|
dnl # The xattr_hander->set() callback was changed to take a dentry
|
||||||
dnl # instead of an inode, and a handler_flags argument was added.
|
dnl # instead of an inode, and a handler_flags argument was added.
|
||||||
dnl #
|
dnl #
|
||||||
|
dnl # 4.4 API change,
|
||||||
|
dnl # The xattr_hander->set() callback was changed to take a xattr_handler,
|
||||||
|
dnl # and handler_flags argument was removed and should be accessed by
|
||||||
|
dnl # handler->flags.
|
||||||
|
dnl #
|
||||||
AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_SET], [
|
AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_SET], [
|
||||||
AC_MSG_CHECKING([whether xattr_handler->set() wants dentry])
|
AC_MSG_CHECKING([whether xattr_handler->set() wants dentry])
|
||||||
ZFS_LINUX_TRY_COMPILE([
|
ZFS_LINUX_TRY_COMPILE([
|
||||||
@ -82,6 +110,24 @@ AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_SET], [
|
|||||||
[xattr_handler->set() wants dentry])
|
[xattr_handler->set() wants dentry])
|
||||||
],[
|
],[
|
||||||
AC_MSG_RESULT(no)
|
AC_MSG_RESULT(no)
|
||||||
|
AC_MSG_CHECKING([whether xattr_handler->set() wants xattr_handler])
|
||||||
|
ZFS_LINUX_TRY_COMPILE([
|
||||||
|
#include <linux/xattr.h>
|
||||||
|
|
||||||
|
int set(const struct xattr_handler *handler, struct dentry *dentry,
|
||||||
|
const char *name, const void *buffer, size_t size, int flags) { return 0; }
|
||||||
|
static const struct xattr_handler
|
||||||
|
xops __attribute__ ((unused)) = {
|
||||||
|
.set = set,
|
||||||
|
};
|
||||||
|
],[
|
||||||
|
],[
|
||||||
|
AC_MSG_RESULT(yes)
|
||||||
|
AC_DEFINE(HAVE_HANDLER_XATTR_SET, 1,
|
||||||
|
[xattr_handler->set() wants xattr_handler])
|
||||||
|
],[
|
||||||
|
AC_MSG_RESULT(no)
|
||||||
|
])
|
||||||
])
|
])
|
||||||
])
|
])
|
||||||
|
|
||||||
@ -90,6 +136,11 @@ dnl # 2.6.33 API change,
|
|||||||
dnl # The xattr_hander->list() callback was changed to take a dentry
|
dnl # The xattr_hander->list() callback was changed to take a dentry
|
||||||
dnl # instead of an inode, and a handler_flags argument was added.
|
dnl # instead of an inode, and a handler_flags argument was added.
|
||||||
dnl #
|
dnl #
|
||||||
|
dnl # 4.4 API change,
|
||||||
|
dnl # The xattr_hander->list() callback was changed to take a xattr_handler,
|
||||||
|
dnl # and handler_flags argument was removed and should be accessed by
|
||||||
|
dnl # handler->flags.
|
||||||
|
dnl #
|
||||||
AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_LIST], [
|
AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_LIST], [
|
||||||
AC_MSG_CHECKING([whether xattr_handler->list() wants dentry])
|
AC_MSG_CHECKING([whether xattr_handler->list() wants dentry])
|
||||||
ZFS_LINUX_TRY_COMPILE([
|
ZFS_LINUX_TRY_COMPILE([
|
||||||
@ -109,6 +160,24 @@ AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_LIST], [
|
|||||||
[xattr_handler->list() wants dentry])
|
[xattr_handler->list() wants dentry])
|
||||||
],[
|
],[
|
||||||
AC_MSG_RESULT(no)
|
AC_MSG_RESULT(no)
|
||||||
|
AC_MSG_CHECKING([whether xattr_handler->list() wants xattr_handler])
|
||||||
|
ZFS_LINUX_TRY_COMPILE([
|
||||||
|
#include <linux/xattr.h>
|
||||||
|
|
||||||
|
size_t list(const struct xattr_handler *handler, struct dentry *dentry,
|
||||||
|
char *list, size_t list_size, const char *name, size_t name_len) { return 0; }
|
||||||
|
static const struct xattr_handler
|
||||||
|
xops __attribute__ ((unused)) = {
|
||||||
|
.list = list,
|
||||||
|
};
|
||||||
|
],[
|
||||||
|
],[
|
||||||
|
AC_MSG_RESULT(yes)
|
||||||
|
AC_DEFINE(HAVE_HANDLER_XATTR_LIST, 1,
|
||||||
|
[xattr_handler->list() wants xattr_handler])
|
||||||
|
],[
|
||||||
|
AC_MSG_RESULT(no)
|
||||||
|
])
|
||||||
])
|
])
|
||||||
])
|
])
|
||||||
|
|
||||||
|
@ -54,6 +54,20 @@ fn(struct dentry *dentry, const char *name, void *buffer, size_t size, \
|
|||||||
{ \
|
{ \
|
||||||
return (__ ## fn(dentry->d_inode, name, buffer, size)); \
|
return (__ ## fn(dentry->d_inode, name, buffer, size)); \
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
* 4.4 API change,
|
||||||
|
* The xattr_hander->get() callback was changed to take a xattr_handler,
|
||||||
|
* and handler_flags argument was removed and should be accessed by
|
||||||
|
* handler->flags.
|
||||||
|
*/
|
||||||
|
#elif defined(HAVE_HANDLER_XATTR_GET)
|
||||||
|
#define ZPL_XATTR_GET_WRAPPER(fn) \
|
||||||
|
static int \
|
||||||
|
fn(const struct xattr_handler *handler, struct dentry *dentry, \
|
||||||
|
const char *name, void *buffer, size_t size) \
|
||||||
|
{ \
|
||||||
|
return (__ ## fn(dentry->d_inode, name, buffer, size)); \
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
#define ZPL_XATTR_GET_WRAPPER(fn) \
|
#define ZPL_XATTR_GET_WRAPPER(fn) \
|
||||||
static int \
|
static int \
|
||||||
@ -76,6 +90,20 @@ fn(struct dentry *dentry, const char *name, const void *buffer, \
|
|||||||
{ \
|
{ \
|
||||||
return (__ ## fn(dentry->d_inode, name, buffer, size, flags)); \
|
return (__ ## fn(dentry->d_inode, name, buffer, size, flags)); \
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
* 4.4 API change,
|
||||||
|
* The xattr_hander->set() callback was changed to take a xattr_handler,
|
||||||
|
* and handler_flags argument was removed and should be accessed by
|
||||||
|
* handler->flags.
|
||||||
|
*/
|
||||||
|
#elif defined(HAVE_HANDLER_XATTR_SET)
|
||||||
|
#define ZPL_XATTR_SET_WRAPPER(fn) \
|
||||||
|
static int \
|
||||||
|
fn(const struct xattr_handler *handler, struct dentry *dentry, \
|
||||||
|
const char *name, const void *buffer, size_t size, int flags) \
|
||||||
|
{ \
|
||||||
|
return (__ ## fn(dentry->d_inode, name, buffer, size, flags)); \
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
#define ZPL_XATTR_SET_WRAPPER(fn) \
|
#define ZPL_XATTR_SET_WRAPPER(fn) \
|
||||||
static int \
|
static int \
|
||||||
|
@ -1022,6 +1022,29 @@ zpl_xattr_acl_list_default(struct dentry *dentry, char *list,
|
|||||||
list, list_size, name, name_len, type);
|
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
|
#else
|
||||||
|
|
||||||
static size_t
|
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));
|
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
|
#else
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -1156,6 +1198,29 @@ zpl_xattr_acl_set_default(struct dentry *dentry, const char *name,
|
|||||||
name, value, size, flags, type);
|
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
|
#else
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -1181,7 +1246,7 @@ struct xattr_handler zpl_xattr_acl_access_handler =
|
|||||||
.list = zpl_xattr_acl_list_access,
|
.list = zpl_xattr_acl_list_access,
|
||||||
.get = zpl_xattr_acl_get_access,
|
.get = zpl_xattr_acl_get_access,
|
||||||
.set = zpl_xattr_acl_set_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,
|
.flags = ACL_TYPE_ACCESS,
|
||||||
#endif /* HAVE_DENTRY_XATTR_LIST */
|
#endif /* HAVE_DENTRY_XATTR_LIST */
|
||||||
};
|
};
|
||||||
@ -1192,7 +1257,7 @@ struct xattr_handler zpl_xattr_acl_default_handler =
|
|||||||
.list = zpl_xattr_acl_list_default,
|
.list = zpl_xattr_acl_list_default,
|
||||||
.get = zpl_xattr_acl_get_default,
|
.get = zpl_xattr_acl_get_default,
|
||||||
.set = zpl_xattr_acl_set_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,
|
.flags = ACL_TYPE_DEFAULT,
|
||||||
#endif /* HAVE_DENTRY_XATTR_LIST */
|
#endif /* HAVE_DENTRY_XATTR_LIST */
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user