config: remove HAVE_XATTR_(GET|SET|LIST)_HANDLER

Sponsored-by: https://despairlabs.com/sponsor/
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Tino Reichardt <milky-zfs@mcmilk.de>
Signed-off-by: Rob Norris <robn@despairlabs.com>
Closes #16479
This commit is contained in:
Rob Norris 2024-08-16 18:17:39 +10:00 committed by Tony Hutter
parent 783fa01cc6
commit a0f51c5820
3 changed files with 11 additions and 136 deletions

View File

@ -49,18 +49,6 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_XATTR_HANDLER_GET], [
}; };
],[]) ],[])
ZFS_LINUX_TEST_SRC([xattr_handler_get_xattr_handler], [
#include <linux/xattr.h>
static 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,
};
],[])
ZFS_LINUX_TEST_SRC([xattr_handler_get_dentry_inode_flags], [ ZFS_LINUX_TEST_SRC([xattr_handler_get_dentry_inode_flags], [
#include <linux/xattr.h> #include <linux/xattr.h>
@ -88,34 +76,19 @@ AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_GET], [
[xattr_handler->get() wants both dentry and inode]) [xattr_handler->get() wants both dentry and inode])
],[ ],[
dnl # dnl #
dnl # 4.4 API change, dnl # Android API change,
dnl # The xattr_handler->get() callback was changed to take a dnl # The xattr_handler->get() callback was
dnl # attr_handler, and handler_flags argument was removed and dnl # changed to take dentry, inode and flags.
dnl # should be accessed by handler->flags.
dnl # dnl #
AC_MSG_RESULT(no) AC_MSG_RESULT(no)
AC_MSG_CHECKING( AC_MSG_CHECKING(
[whether xattr_handler->get() wants xattr_handler]) [whether xattr_handler->get() wants dentry and inode and flags])
ZFS_LINUX_TEST_RESULT([xattr_handler_get_xattr_handler], [ ZFS_LINUX_TEST_RESULT([xattr_handler_get_dentry_inode_flags], [
AC_MSG_RESULT(yes) AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_XATTR_GET_HANDLER, 1, AC_DEFINE(HAVE_XATTR_GET_DENTRY_INODE_FLAGS, 1,
[xattr_handler->get() wants xattr_handler]) [xattr_handler->get() wants dentry and inode and flags])
],[ ],[
dnl # ZFS_LINUX_TEST_ERROR([xattr get()])
dnl # Android API change,
dnl # The xattr_handler->get() callback was
dnl # changed to take dentry, inode and flags.
dnl #
AC_MSG_RESULT(no)
AC_MSG_CHECKING(
[whether xattr_handler->get() wants dentry and inode and flags])
ZFS_LINUX_TEST_RESULT([xattr_handler_get_dentry_inode_flags], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_XATTR_GET_DENTRY_INODE_FLAGS, 1,
[xattr_handler->get() wants dentry and inode and flags])
],[
ZFS_LINUX_TEST_ERROR([xattr get()])
])
]) ])
]) ])
]) ])
@ -167,19 +140,6 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_XATTR_HANDLER_SET], [
.set = set, .set = set,
}; };
],[]) ],[])
ZFS_LINUX_TEST_SRC([xattr_handler_set_xattr_handler], [
#include <linux/xattr.h>
static 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_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_SET], [ AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_SET], [
@ -215,22 +175,7 @@ AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_SET], [
AC_DEFINE(HAVE_XATTR_SET_DENTRY_INODE, 1, AC_DEFINE(HAVE_XATTR_SET_DENTRY_INODE, 1,
[xattr_handler->set() wants both dentry and inode]) [xattr_handler->set() wants both dentry and inode])
],[ ],[
dnl # ZFS_LINUX_TEST_ERROR([xattr set()])
dnl # 4.4 API change,
dnl # The xattr_handler->set() callback was changed to take a
dnl # xattr_handler, and handler_flags argument was removed and
dnl # should be accessed by handler->flags.
dnl #
AC_MSG_RESULT(no)
AC_MSG_CHECKING(
[whether xattr_handler->set() wants xattr_handler])
ZFS_LINUX_TEST_RESULT([xattr_handler_set_xattr_handler], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_XATTR_SET_HANDLER, 1,
[xattr_handler->set() wants xattr_handler])
],[
ZFS_LINUX_TEST_ERROR([xattr set()])
])
]) ])
]) ])
]) ])
@ -249,18 +194,6 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_XATTR_HANDLER_LIST], [
.list = list, .list = list,
}; };
],[]) ],[])
ZFS_LINUX_TEST_SRC([xattr_handler_list_xattr_handler], [
#include <linux/xattr.h>
static 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_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_LIST], [ AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_LIST], [
@ -273,22 +206,7 @@ AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_LIST], [
AC_DEFINE(HAVE_XATTR_LIST_SIMPLE, 1, AC_DEFINE(HAVE_XATTR_LIST_SIMPLE, 1,
[xattr_handler->list() wants simple]) [xattr_handler->list() wants simple])
],[ ],[
dnl #
dnl # 4.4 API change,
dnl # The xattr_handler->list() callback was changed to take a
dnl # xattr_handler, and handler_flags argument was removed
dnl # and should be accessed by handler->flags.
dnl #
AC_MSG_RESULT(no) AC_MSG_RESULT(no)
AC_MSG_CHECKING(
[whether xattr_handler->list() wants xattr_handler])
ZFS_LINUX_TEST_RESULT([xattr_handler_list_xattr_handler], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_XATTR_LIST_HANDLER, 1,
[xattr_handler->list() wants xattr_handler])
],[
ZFS_LINUX_TEST_ERROR([xattr list()])
])
]) ])
]) ])

View File

@ -47,15 +47,6 @@ fn(struct dentry *dentry) \
{ \ { \
return (!!__ ## fn(dentry->d_inode, NULL, 0, NULL, 0)); \ return (!!__ ## fn(dentry->d_inode, NULL, 0, NULL, 0)); \
} }
#elif defined(HAVE_XATTR_LIST_HANDLER)
#define ZPL_XATTR_LIST_WRAPPER(fn) \
static size_t \
fn(const struct xattr_handler *handler, struct dentry *dentry, \
char *list, size_t list_size, const char *name, size_t name_len) \
{ \
return (__ ## fn(dentry->d_inode, \
list, list_size, name, name_len)); \
}
#else #else
#error "Unsupported kernel" #error "Unsupported kernel"
#endif #endif
@ -73,20 +64,6 @@ fn(const struct xattr_handler *handler, struct dentry *dentry, \
{ \ { \
return (__ ## fn(inode, name, buffer, size)); \ return (__ ## fn(inode, name, buffer, size)); \
} }
/*
* 4.4 API change,
* The xattr_handler->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_XATTR_GET_HANDLER)
#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)); \
}
/* /*
* Android API change, * Android API change,
* The xattr_handler->get() callback was changed to take a dentry and inode * The xattr_handler->get() callback was changed to take a dentry and inode
@ -149,21 +126,6 @@ fn(const struct xattr_handler *handler, struct dentry *dentry, \
{ \ { \
return (__ ## fn(kcred->user_ns, inode, name, buffer, size, flags));\ return (__ ## fn(kcred->user_ns, inode, name, buffer, size, flags));\
} }
/*
* 4.4 API change,
* The xattr_handler->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_XATTR_SET_HANDLER)
#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(kcred->user_ns, dentry->d_inode, name, \
buffer, size, flags)); \
}
#else #else
#error "Unsupported kernel" #error "Unsupported kernel"
#endif #endif

View File

@ -1363,8 +1363,7 @@ static xattr_handler_t 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,
#if defined(HAVE_XATTR_LIST_SIMPLE) || \ #if defined(HAVE_XATTR_LIST_SIMPLE)
defined(HAVE_XATTR_LIST_HANDLER)
.flags = ACL_TYPE_ACCESS, .flags = ACL_TYPE_ACCESS,
#endif #endif
}; };
@ -1380,8 +1379,7 @@ static xattr_handler_t 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,
#if defined(HAVE_XATTR_LIST_SIMPLE) || \ #if defined(HAVE_XATTR_LIST_SIMPLE)
defined(HAVE_XATTR_LIST_HANDLER)
.flags = ACL_TYPE_DEFAULT, .flags = ACL_TYPE_DEFAULT,
#endif #endif
}; };
@ -1451,9 +1449,6 @@ zpl_xattr_permission(xattr_filldir_t *xf, const char *name, int name_len)
#if defined(HAVE_XATTR_LIST_SIMPLE) #if defined(HAVE_XATTR_LIST_SIMPLE)
if (!handler->list(d)) if (!handler->list(d))
return (XAPERM_DENY); return (XAPERM_DENY);
#elif defined(HAVE_XATTR_LIST_HANDLER)
if (!handler->list(handler, d, NULL, 0, name, name_len))
return (XAPERM_DENY);
#endif #endif
} }