mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jingbo Xu <jefflexu@linux.alibaba.com>
To: xiang@kernel.org, chao@kernel.org, huyue2@coolpad.com,
	linux-erofs@lists.ozlabs.org
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH 3/8] erofs: simplify erofs_xattr_generic_get()
Date: Thu, 23 Mar 2023 08:09:44 +0800	[thread overview]
Message-ID: <20230323000949.57608-4-jefflexu@linux.alibaba.com> (raw)
In-Reply-To: <20230323000949.57608-1-jefflexu@linux.alibaba.com>

erofs_xattr_generic_get() won't be called from xattr handlers other than
user/trusted/security xattr handler, and thus there's no need of extra
checking.

Signed-off-by: Jingbo Xu <jefflexu@linux.alibaba.com>
---
 fs/erofs/xattr.c | 17 +++--------------
 1 file changed, 3 insertions(+), 14 deletions(-)

diff --git a/fs/erofs/xattr.c b/fs/erofs/xattr.c
index ab4517e5ec84..b83331a694f3 100644
--- a/fs/erofs/xattr.c
+++ b/fs/erofs/xattr.c
@@ -431,20 +431,9 @@ static int erofs_xattr_generic_get(const struct xattr_handler *handler,
 				   struct dentry *unused, struct inode *inode,
 				   const char *name, void *buffer, size_t size)
 {
-	struct erofs_sb_info *const sbi = EROFS_I_SB(inode);
-
-	switch (handler->flags) {
-	case EROFS_XATTR_INDEX_USER:
-		if (!test_opt(&sbi->opt, XATTR_USER))
-			return -EOPNOTSUPP;
-		break;
-	case EROFS_XATTR_INDEX_TRUSTED:
-		break;
-	case EROFS_XATTR_INDEX_SECURITY:
-		break;
-	default:
-		return -EINVAL;
-	}
+	if (handler->flags == EROFS_XATTR_INDEX_USER &&
+	    !test_opt(&EROFS_I_SB(inode)->opt, XATTR_USER))
+		return -EOPNOTSUPP;
 
 	return erofs_getxattr(inode, handler->flags, name, buffer, size);
 }
-- 
2.19.1.6.gb485710b


  parent reply	other threads:[~2023-03-23  0:10 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-23  0:09 [PATCH 0/8] erofs: cleanup of xattr handling Jingbo Xu
2023-03-23  0:09 ` [PATCH 1/8] erofs: move several xattr helpers into xattr.c Jingbo Xu
2023-03-28  8:23   ` Gao Xiang
2023-03-23  0:09 ` [PATCH 2/8] erofs: rename init_inode_xattrs with erofs_ prefix Jingbo Xu
2023-03-28  8:23   ` Gao Xiang
2023-03-23  0:09 ` Jingbo Xu [this message]
2023-03-28  8:57   ` [PATCH 3/8] erofs: simplify erofs_xattr_generic_get() Gao Xiang
2023-03-23  0:09 ` [PATCH 4/8] erofs: introduce erofs_xattr_iter_fixup_aligned() helper Jingbo Xu
2023-03-23  0:09 ` [PATCH 5/8] erofs: unify xattr_iter structures Jingbo Xu
2023-03-23  0:09 ` [PATCH 6/8] erofs: make the size of read data stored in buffer_ofs Jingbo Xu
2023-03-23  0:09 ` [PATCH 7/8] erofs: unify inline/share xattr iterators for listxattr/getxattr Jingbo Xu
2023-03-23  0:09 ` [PATCH 8/8] erofs: use separate xattr parsers " Jingbo Xu

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=20230323000949.57608-4-jefflexu@linux.alibaba.com \
    --to=jefflexu@linux.alibaba.com \
    --cc=chao@kernel.org \
    --cc=huyue2@coolpad.com \
    --cc=linux-erofs@lists.ozlabs.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=xiang@kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®