All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christian Brauner <brauner@kernel.org>
To: linux-fsdevel@vger.kernel.org, Christoph Hellwig <hch@lst.de>
Cc: Al Viro <viro@zeniv.linux.org.uk>,
	Seth Forshee <sforshee@kernel.org>,
	"Christian Brauner (Microsoft)" <brauner@kernel.org>
Subject: [PATCH 03/12] xattr: remove unused argument
Date: Wed, 25 Jan 2023 12:28:48 +0100	[thread overview]
Message-ID: <20230125-fs-acl-remove-generic-xattr-handlers-v1-3-6cf155b492b6@kernel.org> (raw)
In-Reply-To: <20230125-fs-acl-remove-generic-xattr-handlers-v1-0-6cf155b492b6@kernel.org>

his helpers is really just used to check for user.* xattr support so
don't make it pointlessly generic.

Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>
---
 fs/nfsd/nfs4xdr.c     |  3 +--
 fs/xattr.c            | 10 ++++------
 include/linux/xattr.h |  2 +-
 3 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index 2b4ae858c89b..d78a73c732a3 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -3442,8 +3442,7 @@ nfsd4_encode_fattr(struct xdr_stream *xdr, struct svc_fh *fhp,
 		p = xdr_reserve_space(xdr, 4);
 		if (!p)
 			goto out_resource;
-		err = xattr_supported_namespace(d_inode(dentry),
-						XATTR_USER_PREFIX);
+		err = xattr_supports_user_prefix(d_inode(dentry));
 		*p++ = cpu_to_be32(err == 0);
 	}
 
diff --git a/fs/xattr.c b/fs/xattr.c
index ed7fcaab8e1a..b79f202c5857 100644
--- a/fs/xattr.c
+++ b/fs/xattr.c
@@ -159,11 +159,10 @@ xattr_permission(struct user_namespace *mnt_userns, struct inode *inode,
  * Look for any handler that deals with the specified namespace.
  */
 int
-xattr_supported_namespace(struct inode *inode, const char *prefix)
+xattr_supports_user_prefix(struct inode *inode)
 {
 	const struct xattr_handler **handlers = inode->i_sb->s_xattr;
 	const struct xattr_handler *handler;
-	size_t preflen;
 
 	if (!(inode->i_opflags & IOP_XATTR)) {
 		if (unlikely(is_bad_inode(inode)))
@@ -171,16 +170,15 @@ xattr_supported_namespace(struct inode *inode, const char *prefix)
 		return -EOPNOTSUPP;
 	}
 
-	preflen = strlen(prefix);
-
 	for_each_xattr_handler(handlers, handler) {
-		if (!strncmp(xattr_prefix(handler), prefix, preflen))
+		if (!strncmp(xattr_prefix(handler), XATTR_USER_PREFIX,
+			     XATTR_USER_PREFIX_LEN))
 			return 0;
 	}
 
 	return -EOPNOTSUPP;
 }
-EXPORT_SYMBOL(xattr_supported_namespace);
+EXPORT_SYMBOL(xattr_supports_user_prefix);
 
 int
 __vfs_setxattr(struct user_namespace *mnt_userns, struct dentry *dentry,
diff --git a/include/linux/xattr.h b/include/linux/xattr.h
index d1150b7ba8d0..391ade703782 100644
--- a/include/linux/xattr.h
+++ b/include/linux/xattr.h
@@ -84,7 +84,7 @@ int vfs_getxattr_alloc(struct user_namespace *mnt_userns,
 		       struct dentry *dentry, const char *name,
 		       char **xattr_value, size_t size, gfp_t flags);
 
-int xattr_supported_namespace(struct inode *inode, const char *prefix);
+int xattr_supports_user_prefix(struct inode *inode);
 
 static inline const char *xattr_prefix(const struct xattr_handler *handler)
 {

-- 
2.34.1


  parent reply	other threads:[~2023-01-25 11:30 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-25 11:28 [f2fs-dev] [PATCH 00/12] acl: remove remaining posix acl handlers Christian Brauner
2023-01-25 11:28 ` Christian Brauner
2023-01-25 11:28 ` [Ocfs2-devel] " Christian Brauner via Ocfs2-devel
2023-01-25 11:28 ` Christian Brauner
2023-01-25 11:28 ` Christian Brauner
2023-01-25 11:28 ` Christian Brauner
2023-01-25 11:28 ` [PATCH 01/12] xattr: simplify listxattr helpers Christian Brauner
2023-01-30  6:35   ` Christoph Hellwig
2023-01-25 11:28 ` [PATCH 02/12] xattr, posix acl: add " Christian Brauner
2023-01-30  6:37   ` Christoph Hellwig
2023-01-25 11:28 ` Christian Brauner [this message]
2023-01-30  6:37   ` [PATCH 03/12] xattr: remove unused argument Christoph Hellwig
2023-01-25 11:28 ` [PATCH 04/12] fs: drop unused posix acl handlers Christian Brauner
2023-01-30  6:38   ` Christoph Hellwig
2023-01-25 11:28 ` [PATCH 05/12] erofs: drop " Christian Brauner
2023-01-25 11:28   ` Christian Brauner
2023-01-30  6:43   ` Christoph Hellwig
2023-01-30  6:43     ` Christoph Hellwig
2023-01-30  9:00     ` Christian Brauner
2023-01-30  9:00       ` Christian Brauner
2023-01-30  9:11       ` Christoph Hellwig
2023-01-30  9:11         ` Christoph Hellwig
2023-01-25 11:28 ` [PATCH 06/12] ext2: " Christian Brauner
2023-01-25 13:03   ` Jan Kara
2023-01-25 11:28 ` [PATCH 07/12] ext4: " Christian Brauner
2023-01-25 11:28 ` [f2fs-dev] [PATCH 08/12] f2fs: " Christian Brauner
2023-01-25 11:28   ` Christian Brauner
2023-01-25 11:28 ` [PATCH 09/12] jffs2: " Christian Brauner
2023-01-25 11:28   ` Christian Brauner
2023-01-25 11:28 ` [PATCH 10/12] ocfs2: " Christian Brauner
2023-01-25 11:28   ` [Ocfs2-devel] " Christian Brauner via Ocfs2-devel
2023-01-25 11:28 ` [PATCH 11/12] reiserfs: " Christian Brauner
2023-01-25 11:28 ` [PATCH 12/12] acl: remove " Christian Brauner
2023-01-31 12:04   ` kernel test robot
2023-01-30  9:10 ` [PATCH 00/12] acl: remove remaining " Christian Brauner
2023-01-30  9:10   ` Christian Brauner
2023-01-30  9:10   ` [f2fs-dev] " Christian Brauner
2023-01-30  9:10   ` Christian Brauner
2023-01-30  9:10   ` [Ocfs2-devel] " Christian Brauner via Ocfs2-devel
2023-01-30  9:16   ` Christoph Hellwig
2023-01-30  9:16     ` Christoph Hellwig
2023-01-30  9:16     ` Christoph Hellwig
2023-01-30  9:16     ` [f2fs-dev] " Christoph Hellwig
2023-01-30  9:16     ` [Ocfs2-devel] " Christoph Hellwig via Ocfs2-devel
2023-01-30 10:23     ` Christian Brauner
2023-01-30 10:23       ` Christian Brauner
2023-01-30 10:23       ` Christian Brauner
2023-01-30 10:23       ` [f2fs-dev] " Christian Brauner
2023-01-30 10:23       ` [Ocfs2-devel] " Christian Brauner via Ocfs2-devel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230125-fs-acl-remove-generic-xattr-handlers-v1-3-6cf155b492b6@kernel.org \
    --to=brauner@kernel.org \
    --cc=hch@lst.de \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=sforshee@kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.