From 1af510b550398c90ebc4aca4265d07bd5081a725 Mon Sep 17 00:00:00 2001 From: Rob Norris Date: Fri, 16 Aug 2024 18:50:48 +1000 Subject: [PATCH] config: remove HAVE_XATTR_GET_DENTRY_INODE 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 | 53 +++++--------------- include/os/linux/kernel/linux/xattr_compat.h | 26 ++++------ 2 files changed, 22 insertions(+), 57 deletions(-) diff --git a/config/kernel-xattr-handler.m4 b/config/kernel-xattr-handler.m4 index f83e33b00..704b1d74e 100644 --- a/config/kernel-xattr-handler.m4 +++ b/config/kernel-xattr-handler.m4 @@ -34,21 +34,11 @@ AC_DEFUN([ZFS_AC_KERNEL_CONST_XATTR_HANDLER], [ ]) dnl # -dnl # Supported xattr handler get() interfaces checked newest to oldest. +dnl # Android API change, +dnl # The xattr_handler->get() callback was +dnl # changed to take dentry, inode and flags. dnl # -AC_DEFUN([ZFS_AC_KERNEL_SRC_XATTR_HANDLER_GET], [ - ZFS_LINUX_TEST_SRC([xattr_handler_get_dentry_inode], [ - #include - - static int get(const struct xattr_handler *handler, - struct dentry *dentry, struct inode *inode, - const char *name, void *buffer, size_t size) { return 0; } - static const struct xattr_handler - xops __attribute__ ((unused)) = { - .get = get, - }; - ],[]) - +AC_DEFUN([ZFS_AC_KERNEL_SRC_XATTR_HANDLER_GET_DENTRY_INODE_FLAGS], [ ZFS_LINUX_TEST_SRC([xattr_handler_get_dentry_inode_flags], [ #include @@ -63,33 +53,16 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_XATTR_HANDLER_GET], [ ],[]) ]) -AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_GET], [ - dnl # - dnl # 4.7 API change, - dnl # The xattr_handler->get() callback was changed to take both - dnl # dentry and inode. - dnl # - AC_MSG_CHECKING([whether xattr_handler->get() wants dentry and inode]) - ZFS_LINUX_TEST_RESULT([xattr_handler_get_dentry_inode], [ +AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_GET_DENTRY_INODE_FLAGS], [ + 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, 1, - [xattr_handler->get() wants both dentry and inode]) + 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()]) - ]) ]) ]) @@ -211,14 +184,14 @@ AC_DEFUN([ZFS_AC_KERNEL_GENERIC_SETXATTR], [ AC_DEFUN([ZFS_AC_KERNEL_SRC_XATTR], [ ZFS_AC_KERNEL_SRC_CONST_XATTR_HANDLER - ZFS_AC_KERNEL_SRC_XATTR_HANDLER_GET + ZFS_AC_KERNEL_SRC_XATTR_HANDLER_GET_DENTRY_INODE_FLAGS ZFS_AC_KERNEL_SRC_XATTR_HANDLER_SET ZFS_AC_KERNEL_SRC_GENERIC_SETXATTR ]) AC_DEFUN([ZFS_AC_KERNEL_XATTR], [ ZFS_AC_KERNEL_CONST_XATTR_HANDLER - ZFS_AC_KERNEL_XATTR_HANDLER_GET + ZFS_AC_KERNEL_XATTR_HANDLER_GET_DENTRY_INODE_FLAGS ZFS_AC_KERNEL_XATTR_HANDLER_SET ZFS_AC_KERNEL_GENERIC_SETXATTR ]) diff --git a/include/os/linux/kernel/linux/xattr_compat.h b/include/os/linux/kernel/linux/xattr_compat.h index 9f3b78a7e..f7e62da62 100644 --- a/include/os/linux/kernel/linux/xattr_compat.h +++ b/include/os/linux/kernel/linux/xattr_compat.h @@ -47,25 +47,11 @@ fn(struct dentry *dentry) \ return (!!__ ## fn(dentry->d_inode, NULL, 0, NULL, 0)); \ } -/* - * 4.7 API change, - * The xattr_handler->get() callback was changed to take a both dentry and - * inode, because the dentry might not be attached to an inode yet. - */ -#if defined(HAVE_XATTR_GET_DENTRY_INODE) -#define ZPL_XATTR_GET_WRAPPER(fn) \ -static int \ -fn(const struct xattr_handler *handler, struct dentry *dentry, \ - struct inode *inode, const char *name, void *buffer, size_t size) \ -{ \ - return (__ ## fn(inode, name, buffer, size)); \ -} +#ifdef HAVE_XATTR_GET_DENTRY_INODE_FLAGS /* * Android API change, - * The xattr_handler->get() callback was changed to take a dentry and inode - * and flags, because the dentry might not be attached to an inode yet. + * The xattr_handler->get() callback also takes a flags arg. */ -#elif defined(HAVE_XATTR_GET_DENTRY_INODE_FLAGS) #define ZPL_XATTR_GET_WRAPPER(fn) \ static int \ fn(const struct xattr_handler *handler, struct dentry *dentry, \ @@ -75,7 +61,13 @@ fn(const struct xattr_handler *handler, struct dentry *dentry, \ return (__ ## fn(inode, name, buffer, size)); \ } #else -#error "Unsupported kernel" +#define ZPL_XATTR_GET_WRAPPER(fn) \ +static int \ +fn(const struct xattr_handler *handler, struct dentry *dentry, \ + struct inode *inode, const char *name, void *buffer, size_t size) \ +{ \ + return (__ ## fn(inode, name, buffer, size)); \ +} #endif /*