mirror of
				https://git.proxmox.com/git/mirror_zfs.git
				synced 2025-10-26 18:05:04 +03:00 
			
		
		
		
	config: remove HAVE_XATTR_HANDLER_NAME
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:
		
							parent
							
								
									5a615294ff
								
							
						
					
					
						commit
						783fa01cc6
					
				@ -33,34 +33,6 @@ AC_DEFUN([ZFS_AC_KERNEL_CONST_XATTR_HANDLER], [
 | 
			
		||||
	])
 | 
			
		||||
])
 | 
			
		||||
 | 
			
		||||
dnl #
 | 
			
		||||
dnl # 4.5 API change,
 | 
			
		||||
dnl # struct xattr_handler added new member "name".
 | 
			
		||||
dnl # xattr_handler which matches to whole name rather than prefix should use
 | 
			
		||||
dnl # "name" instead of "prefix", e.g. "system.posix_acl_access"
 | 
			
		||||
dnl #
 | 
			
		||||
AC_DEFUN([ZFS_AC_KERNEL_SRC_XATTR_HANDLER_NAME], [
 | 
			
		||||
	ZFS_LINUX_TEST_SRC([xattr_handler_name], [
 | 
			
		||||
		#include <linux/xattr.h>
 | 
			
		||||
 | 
			
		||||
		static const struct xattr_handler
 | 
			
		||||
		    xops __attribute__ ((unused)) = {
 | 
			
		||||
			.name = XATTR_NAME_POSIX_ACL_ACCESS,
 | 
			
		||||
		};
 | 
			
		||||
	],[])
 | 
			
		||||
])
 | 
			
		||||
 | 
			
		||||
AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_NAME], [
 | 
			
		||||
	AC_MSG_CHECKING([whether xattr_handler has name])
 | 
			
		||||
	ZFS_LINUX_TEST_RESULT([xattr_handler_name], [
 | 
			
		||||
		AC_MSG_RESULT(yes)
 | 
			
		||||
		AC_DEFINE(HAVE_XATTR_HANDLER_NAME, 1,
 | 
			
		||||
		    [xattr_handler has name])
 | 
			
		||||
	],[
 | 
			
		||||
		AC_MSG_RESULT(no)
 | 
			
		||||
	])
 | 
			
		||||
])
 | 
			
		||||
 | 
			
		||||
dnl #
 | 
			
		||||
dnl # Supported xattr handler get() interfaces checked newest to oldest.
 | 
			
		||||
dnl #
 | 
			
		||||
@ -350,7 +322,6 @@ 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_NAME
 | 
			
		||||
	ZFS_AC_KERNEL_SRC_XATTR_HANDLER_GET
 | 
			
		||||
	ZFS_AC_KERNEL_SRC_XATTR_HANDLER_SET
 | 
			
		||||
	ZFS_AC_KERNEL_SRC_XATTR_HANDLER_LIST
 | 
			
		||||
@ -359,7 +330,6 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_XATTR], [
 | 
			
		||||
 | 
			
		||||
AC_DEFUN([ZFS_AC_KERNEL_XATTR], [
 | 
			
		||||
	ZFS_AC_KERNEL_CONST_XATTR_HANDLER
 | 
			
		||||
	ZFS_AC_KERNEL_XATTR_HANDLER_NAME
 | 
			
		||||
	ZFS_AC_KERNEL_XATTR_HANDLER_GET
 | 
			
		||||
	ZFS_AC_KERNEL_XATTR_HANDLER_SET
 | 
			
		||||
	ZFS_AC_KERNEL_XATTR_HANDLER_LIST
 | 
			
		||||
 | 
			
		||||
@ -712,10 +712,6 @@ __zpl_xattr_user_get(struct inode *ip, const char *name,
 | 
			
		||||
{
 | 
			
		||||
	int error;
 | 
			
		||||
	/* xattr_resolve_name will do this for us if this is defined */
 | 
			
		||||
#ifndef HAVE_XATTR_HANDLER_NAME
 | 
			
		||||
	if (strcmp(name, "") == 0)
 | 
			
		||||
		return (-EINVAL);
 | 
			
		||||
#endif
 | 
			
		||||
	if (ZFS_XA_NS_PREFIX_FORBIDDEN(name))
 | 
			
		||||
		return (-EINVAL);
 | 
			
		||||
	if (!(ITOZSB(ip)->z_flags & ZSB_XATTR))
 | 
			
		||||
@ -745,10 +741,6 @@ __zpl_xattr_user_set(zidmap_t *user_ns,
 | 
			
		||||
	(void) user_ns;
 | 
			
		||||
	int error = 0;
 | 
			
		||||
	/* xattr_resolve_name will do this for us if this is defined */
 | 
			
		||||
#ifndef HAVE_XATTR_HANDLER_NAME
 | 
			
		||||
	if (strcmp(name, "") == 0)
 | 
			
		||||
		return (-EINVAL);
 | 
			
		||||
#endif
 | 
			
		||||
	if (ZFS_XA_NS_PREFIX_FORBIDDEN(name))
 | 
			
		||||
		return (-EINVAL);
 | 
			
		||||
	if (!(ITOZSB(ip)->z_flags & ZSB_XATTR))
 | 
			
		||||
@ -835,10 +827,6 @@ __zpl_xattr_trusted_get(struct inode *ip, const char *name,
 | 
			
		||||
	if (!capable(CAP_SYS_ADMIN))
 | 
			
		||||
		return (-EACCES);
 | 
			
		||||
	/* xattr_resolve_name will do this for us if this is defined */
 | 
			
		||||
#ifndef HAVE_XATTR_HANDLER_NAME
 | 
			
		||||
	if (strcmp(name, "") == 0)
 | 
			
		||||
		return (-EINVAL);
 | 
			
		||||
#endif
 | 
			
		||||
	xattr_name = kmem_asprintf("%s%s", XATTR_TRUSTED_PREFIX, name);
 | 
			
		||||
	error = zpl_xattr_get(ip, xattr_name, value, size);
 | 
			
		||||
	kmem_strfree(xattr_name);
 | 
			
		||||
@ -859,10 +847,6 @@ __zpl_xattr_trusted_set(zidmap_t *user_ns,
 | 
			
		||||
	if (!capable(CAP_SYS_ADMIN))
 | 
			
		||||
		return (-EACCES);
 | 
			
		||||
	/* xattr_resolve_name will do this for us if this is defined */
 | 
			
		||||
#ifndef HAVE_XATTR_HANDLER_NAME
 | 
			
		||||
	if (strcmp(name, "") == 0)
 | 
			
		||||
		return (-EINVAL);
 | 
			
		||||
#endif
 | 
			
		||||
	xattr_name = kmem_asprintf("%s%s", XATTR_TRUSTED_PREFIX, name);
 | 
			
		||||
	error = zpl_xattr_set(ip, xattr_name, value, size, flags);
 | 
			
		||||
	kmem_strfree(xattr_name);
 | 
			
		||||
@ -905,10 +889,6 @@ __zpl_xattr_security_get(struct inode *ip, const char *name,
 | 
			
		||||
	char *xattr_name;
 | 
			
		||||
	int error;
 | 
			
		||||
	/* xattr_resolve_name will do this for us if this is defined */
 | 
			
		||||
#ifndef HAVE_XATTR_HANDLER_NAME
 | 
			
		||||
	if (strcmp(name, "") == 0)
 | 
			
		||||
		return (-EINVAL);
 | 
			
		||||
#endif
 | 
			
		||||
	xattr_name = kmem_asprintf("%s%s", XATTR_SECURITY_PREFIX, name);
 | 
			
		||||
	error = zpl_xattr_get(ip, xattr_name, value, size);
 | 
			
		||||
	kmem_strfree(xattr_name);
 | 
			
		||||
@ -926,10 +906,6 @@ __zpl_xattr_security_set(zidmap_t *user_ns,
 | 
			
		||||
	char *xattr_name;
 | 
			
		||||
	int error;
 | 
			
		||||
	/* xattr_resolve_name will do this for us if this is defined */
 | 
			
		||||
#ifndef HAVE_XATTR_HANDLER_NAME
 | 
			
		||||
	if (strcmp(name, "") == 0)
 | 
			
		||||
		return (-EINVAL);
 | 
			
		||||
#endif
 | 
			
		||||
	xattr_name = kmem_asprintf("%s%s", XATTR_SECURITY_PREFIX, name);
 | 
			
		||||
	error = zpl_xattr_set(ip, xattr_name, value, size, flags);
 | 
			
		||||
	kmem_strfree(xattr_name);
 | 
			
		||||
@ -1251,10 +1227,6 @@ __zpl_xattr_acl_get_access(struct inode *ip, const char *name,
 | 
			
		||||
	int type = ACL_TYPE_ACCESS;
 | 
			
		||||
	int error;
 | 
			
		||||
	/* xattr_resolve_name will do this for us if this is defined */
 | 
			
		||||
#ifndef HAVE_XATTR_HANDLER_NAME
 | 
			
		||||
	if (strcmp(name, "") != 0)
 | 
			
		||||
		return (-EINVAL);
 | 
			
		||||
#endif
 | 
			
		||||
	if (ITOZSB(ip)->z_acl_type != ZFS_ACLTYPE_POSIX)
 | 
			
		||||
		return (-EOPNOTSUPP);
 | 
			
		||||
 | 
			
		||||
@ -1279,10 +1251,6 @@ __zpl_xattr_acl_get_default(struct inode *ip, const char *name,
 | 
			
		||||
	int type = ACL_TYPE_DEFAULT;
 | 
			
		||||
	int error;
 | 
			
		||||
	/* xattr_resolve_name will do this for us if this is defined */
 | 
			
		||||
#ifndef HAVE_XATTR_HANDLER_NAME
 | 
			
		||||
	if (strcmp(name, "") != 0)
 | 
			
		||||
		return (-EINVAL);
 | 
			
		||||
#endif
 | 
			
		||||
	if (ITOZSB(ip)->z_acl_type != ZFS_ACLTYPE_POSIX)
 | 
			
		||||
		return (-EOPNOTSUPP);
 | 
			
		||||
 | 
			
		||||
@ -1308,10 +1276,6 @@ __zpl_xattr_acl_set_access(zidmap_t *mnt_ns,
 | 
			
		||||
	int type = ACL_TYPE_ACCESS;
 | 
			
		||||
	int error = 0;
 | 
			
		||||
	/* xattr_resolve_name will do this for us if this is defined */
 | 
			
		||||
#ifndef HAVE_XATTR_HANDLER_NAME
 | 
			
		||||
	if (strcmp(name, "") != 0)
 | 
			
		||||
		return (-EINVAL);
 | 
			
		||||
#endif
 | 
			
		||||
	if (ITOZSB(ip)->z_acl_type != ZFS_ACLTYPE_POSIX)
 | 
			
		||||
		return (-EOPNOTSUPP);
 | 
			
		||||
 | 
			
		||||
@ -1354,10 +1318,6 @@ __zpl_xattr_acl_set_default(zidmap_t *mnt_ns,
 | 
			
		||||
	int type = ACL_TYPE_DEFAULT;
 | 
			
		||||
	int error = 0;
 | 
			
		||||
	/* xattr_resolve_name will do this for us if this is defined */
 | 
			
		||||
#ifndef HAVE_XATTR_HANDLER_NAME
 | 
			
		||||
	if (strcmp(name, "") != 0)
 | 
			
		||||
		return (-EINVAL);
 | 
			
		||||
#endif
 | 
			
		||||
	if (ITOZSB(ip)->z_acl_type != ZFS_ACLTYPE_POSIX)
 | 
			
		||||
		return (-EOPNOTSUPP);
 | 
			
		||||
 | 
			
		||||
@ -1399,11 +1359,7 @@ ZPL_XATTR_SET_WRAPPER(zpl_xattr_acl_set_default);
 | 
			
		||||
 * whole name and reject anything that has .name only as prefix.
 | 
			
		||||
 */
 | 
			
		||||
static xattr_handler_t zpl_xattr_acl_access_handler = {
 | 
			
		||||
#ifdef HAVE_XATTR_HANDLER_NAME
 | 
			
		||||
	.name	= XATTR_NAME_POSIX_ACL_ACCESS,
 | 
			
		||||
#else
 | 
			
		||||
	.prefix	= XATTR_NAME_POSIX_ACL_ACCESS,
 | 
			
		||||
#endif
 | 
			
		||||
	.list	= zpl_xattr_acl_list_access,
 | 
			
		||||
	.get	= zpl_xattr_acl_get_access,
 | 
			
		||||
	.set	= zpl_xattr_acl_set_access,
 | 
			
		||||
@ -1416,15 +1372,11 @@ static xattr_handler_t zpl_xattr_acl_access_handler = {
 | 
			
		||||
/*
 | 
			
		||||
 * ACL default xattr namespace handlers.
 | 
			
		||||
 *
 | 
			
		||||
 * Use .name instead of .prefix when available. xattr_resolve_name will match
 | 
			
		||||
 * whole name and reject anything that has .name only as prefix.
 | 
			
		||||
 * Use .name instead of .prefix. xattr_resolve_name will match whole name and
 | 
			
		||||
 * reject anything that has .name only as prefix.
 | 
			
		||||
 */
 | 
			
		||||
static xattr_handler_t zpl_xattr_acl_default_handler = {
 | 
			
		||||
#ifdef HAVE_XATTR_HANDLER_NAME
 | 
			
		||||
	.name	= XATTR_NAME_POSIX_ACL_DEFAULT,
 | 
			
		||||
#else
 | 
			
		||||
	.prefix	= XATTR_NAME_POSIX_ACL_DEFAULT,
 | 
			
		||||
#endif
 | 
			
		||||
	.list	= zpl_xattr_acl_list_default,
 | 
			
		||||
	.get	= zpl_xattr_acl_get_default,
 | 
			
		||||
	.set	= zpl_xattr_acl_set_default,
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user