From 733317966fa9d9a060c62771e1f0065de5019567 Mon Sep 17 00:00:00 2001 From: Rob Norris Date: Mon, 5 Aug 2024 19:47:27 +1000 Subject: [PATCH] config: remove HAVE_XATTR_(GET|SET|LIST)_DENTRY Sponsored-by: https://despairlabs.com/sponsor/ Reviewed-by: Brian Behlendorf Reviewed-by: Tony Hutter Reviewed-by: Tino Reichardt Signed-off-by: Rob Norris Closes #16479 --- config/kernel-xattr-handler.m4 | 102 ++----------------- include/os/linux/kernel/linux/xattr_compat.h | 42 -------- module/os/linux/zfs/zpl_xattr.c | 5 - 3 files changed, 10 insertions(+), 139 deletions(-) diff --git a/config/kernel-xattr-handler.m4 b/config/kernel-xattr-handler.m4 index 5d4eb567c..6a07e9ee5 100644 --- a/config/kernel-xattr-handler.m4 +++ b/config/kernel-xattr-handler.m4 @@ -89,18 +89,6 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_XATTR_HANDLER_GET], [ }; ],[]) - ZFS_LINUX_TEST_SRC([xattr_handler_get_dentry], [ - #include - - static int get(struct dentry *dentry, const char *name, - void *buffer, size_t size, int handler_flags) - { return 0; } - static const struct xattr_handler - xops __attribute__ ((unused)) = { - .get = get, - }; - ],[]) - ZFS_LINUX_TEST_SRC([xattr_handler_get_dentry_inode_flags], [ #include @@ -142,34 +130,19 @@ AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_GET], [ [xattr_handler->get() wants xattr_handler]) ],[ dnl # - dnl # 2.6.33 API change, - dnl # The xattr_handler->get() callback was changed - dnl # to take a dentry instead of an inode, and a - dnl # handler_flags argument was added. + 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]) - ZFS_LINUX_TEST_RESULT([xattr_handler_get_dentry], [ + [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, 1, - [xattr_handler->get() wants dentry]) + AC_DEFINE(HAVE_XATTR_GET_DENTRY_INODE_FLAGS, 1, + [xattr_handler->get() wants dentry and inode and flags]) ],[ - dnl # - 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()]) - ]) + ZFS_LINUX_TEST_ERROR([xattr get()]) ]) ]) ]) @@ -235,18 +208,6 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_XATTR_HANDLER_SET], [ .set = set, }; ],[]) - - ZFS_LINUX_TEST_SRC([xattr_handler_set_dentry], [ - #include - - static int set(struct dentry *dentry, const char *name, - const void *buffer, size_t size, int flags, - int handler_flags) { return 0; } - static const struct xattr_handler - xops __attribute__ ((unused)) = { - .set = set, - }; - ],[]) ]) AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_SET], [ @@ -296,22 +257,7 @@ AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_SET], [ AC_DEFINE(HAVE_XATTR_SET_HANDLER, 1, [xattr_handler->set() wants xattr_handler]) ],[ - dnl # - dnl # 2.6.33 API change, - dnl # The xattr_handler->set() callback was changed - dnl # to take a dentry instead of an inode, and a - dnl # handler_flags argument was added. - dnl # - AC_MSG_RESULT(no) - AC_MSG_CHECKING( - [whether xattr_handler->set() wants dentry]) - ZFS_LINUX_TEST_RESULT([xattr_handler_set_dentry], [ - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_XATTR_SET_DENTRY, 1, - [xattr_handler->set() wants dentry]) - ],[ - ZFS_LINUX_TEST_ERROR([xattr set()]) - ]) + ZFS_LINUX_TEST_ERROR([xattr set()]) ]) ]) ]) @@ -343,19 +289,6 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_XATTR_HANDLER_LIST], [ .list = list, }; ],[]) - - ZFS_LINUX_TEST_SRC([xattr_handler_list_dentry], [ - #include - - static size_t list(struct dentry *dentry, - char *list, size_t list_size, - const char *name, size_t name_len, - int handler_flags) { return 0; } - static const struct xattr_handler - xops __attribute__ ((unused)) = { - .list = list, - }; - ],[]) ]) AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_LIST], [ @@ -382,22 +315,7 @@ AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_LIST], [ AC_DEFINE(HAVE_XATTR_LIST_HANDLER, 1, [xattr_handler->list() wants xattr_handler]) ],[ - dnl # - dnl # 2.6.33 API change, - dnl # The xattr_handler->list() callback was changed - dnl # to take a dentry instead of an inode, and a - dnl # handler_flags argument was added. - dnl # - AC_MSG_RESULT(no) - AC_MSG_CHECKING( - [whether xattr_handler->list() wants dentry]) - ZFS_LINUX_TEST_RESULT([xattr_handler_list_dentry], [ - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_XATTR_LIST_DENTRY, 1, - [xattr_handler->list() wants dentry]) - ],[ - ZFS_LINUX_TEST_ERROR([xattr list()]) - ]) + ZFS_LINUX_TEST_ERROR([xattr list()]) ]) ]) ]) diff --git a/include/os/linux/kernel/linux/xattr_compat.h b/include/os/linux/kernel/linux/xattr_compat.h index bcc7289ad..b3761a422 100644 --- a/include/os/linux/kernel/linux/xattr_compat.h +++ b/include/os/linux/kernel/linux/xattr_compat.h @@ -47,21 +47,6 @@ fn(struct dentry *dentry) \ { \ return (!!__ ## fn(dentry->d_inode, NULL, 0, NULL, 0)); \ } -/* - * 4.4 API change, - */ -#elif defined(HAVE_XATTR_LIST_DENTRY) -#define ZPL_XATTR_LIST_WRAPPER(fn) \ -static size_t \ -fn(struct dentry *dentry, char *list, size_t list_size, \ - const char *name, size_t name_len, int type) \ -{ \ - return (__ ## fn(dentry->d_inode, \ - list, list_size, name, name_len)); \ -} -/* - * 2.6.33 API change, - */ #elif defined(HAVE_XATTR_LIST_HANDLER) #define ZPL_XATTR_LIST_WRAPPER(fn) \ static size_t \ @@ -102,19 +87,6 @@ fn(const struct xattr_handler *handler, struct dentry *dentry, \ { \ return (__ ## fn(dentry->d_inode, name, buffer, size)); \ } -/* - * 2.6.33 API change, - * The xattr_handler->get() callback was changed to take a dentry - * instead of an inode, and a handler_flags argument was added. - */ -#elif defined(HAVE_XATTR_GET_DENTRY) -#define ZPL_XATTR_GET_WRAPPER(fn) \ -static int \ -fn(struct dentry *dentry, const char *name, void *buffer, size_t size, \ - int unused_handler_flags) \ -{ \ - return (__ ## fn(dentry->d_inode, name, buffer, size)); \ -} /* * Android API change, * The xattr_handler->get() callback was changed to take a dentry and inode @@ -192,20 +164,6 @@ fn(const struct xattr_handler *handler, struct dentry *dentry, \ return (__ ## fn(kcred->user_ns, dentry->d_inode, name, \ buffer, size, flags)); \ } -/* - * 2.6.33 API change, - * The xattr_handler->set() callback was changed to take a dentry - * instead of an inode, and a handler_flags argument was added. - */ -#elif defined(HAVE_XATTR_SET_DENTRY) -#define ZPL_XATTR_SET_WRAPPER(fn) \ -static int \ -fn(struct dentry *dentry, const char *name, const void *buffer, \ - size_t size, int flags, int unused_handler_flags) \ -{ \ - return (__ ## fn(kcred->user_ns, dentry->d_inode, name, \ - buffer, size, flags)); \ -} #else #error "Unsupported kernel" #endif diff --git a/module/os/linux/zfs/zpl_xattr.c b/module/os/linux/zfs/zpl_xattr.c index 9c0559333..beca5b655 100644 --- a/module/os/linux/zfs/zpl_xattr.c +++ b/module/os/linux/zfs/zpl_xattr.c @@ -1425,7 +1425,6 @@ static xattr_handler_t zpl_xattr_acl_access_handler = { .get = zpl_xattr_acl_get_access, .set = zpl_xattr_acl_set_access, #if defined(HAVE_XATTR_LIST_SIMPLE) || \ - defined(HAVE_XATTR_LIST_DENTRY) || \ defined(HAVE_XATTR_LIST_HANDLER) .flags = ACL_TYPE_ACCESS, #endif @@ -1447,7 +1446,6 @@ static xattr_handler_t zpl_xattr_acl_default_handler = { .get = zpl_xattr_acl_get_default, .set = zpl_xattr_acl_set_default, #if defined(HAVE_XATTR_LIST_SIMPLE) || \ - defined(HAVE_XATTR_LIST_DENTRY) || \ defined(HAVE_XATTR_LIST_HANDLER) .flags = ACL_TYPE_DEFAULT, #endif @@ -1518,9 +1516,6 @@ zpl_xattr_permission(xattr_filldir_t *xf, const char *name, int name_len) #if defined(HAVE_XATTR_LIST_SIMPLE) if (!handler->list(d)) return (XAPERM_DENY); -#elif defined(HAVE_XATTR_LIST_DENTRY) - if (!handler->list(d, NULL, 0, name, name_len, 0)) - return (XAPERM_DENY); #elif defined(HAVE_XATTR_LIST_HANDLER) if (!handler->list(handler, d, NULL, 0, name, name_len)) return (XAPERM_DENY);