From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out30-131.freemail.mail.aliyun.com (out30-131.freemail.mail.aliyun.com [115.124.30.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 92A9C30FC24 for ; Wed, 31 Dec 2025 04:57:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767157073; cv=none; b=YcjkoLvoM2kXLNMP9MBX4UXzohzzAKGDPRQdQ14HoPeaVNlG1iS/ju6IfcUIuFuEu1Q5+z5enIXcldkLIgeHD1ZDk4Xo9/RHKO/Iq3jwYQLpmEu6h2mjj1FyPX8F2BiizqYkNrKidqdz0LFX9WihX7/eaexsHKCX5j8tLBdh5Gs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767157073; c=relaxed/simple; bh=sgvDUZ4gS+o4cMIsYtRpaKF9m7+yDyCTQonNGay4XPQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZqKUtW0YL+MykwwktIXSQTMVG3aQ3yzi7n1xDJl1gy9EFBD+bIYL0TWSuaN1SSfRsXEmPTxG6L7UwSfITdK51YQJ61diLV+LztfjiIxG8YSMCMdSdaMj6UAcejLPle6xAHrEcLxTLhk2tpwG/OG70JNqsCzW7fzS7NouSzeszQU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com; spf=pass smtp.mailfrom=linux.alibaba.com; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b=exoEzSwC; arc=none smtp.client-ip=115.124.30.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b="exoEzSwC" DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1767157061; h=From:To:Subject:Date:Message-ID:MIME-Version; bh=mv2IZ5fzK6kHpN8pu8lDd8Jbw4Yx0JwvlW/ztt+xKbg=; b=exoEzSwCdoW+wyh7XTH5EWLeiWct9CNt42AbQeWT66IYyFqIFZHHQZaUzLVddye0gNo8KFmFSdrIWlffbO8sdtf6xiag7V9XzgyV0ViUAiS9rPjoW+rFuJj2I24vjESRLFQQ1iGqaIO4si60ZtR5/du9/beRfdHXxe7TOwbNsRU= Received: from x31i01179.sqa.na131.tbsite.net(mailfrom:hsiangkao@linux.alibaba.com fp:SMTPD_---0Ww.tb1Q_1767157056 cluster:ay36) by smtp.aliyun-inc.com; Wed, 31 Dec 2025 12:57:40 +0800 From: Gao Xiang To: linux-erofs@lists.ozlabs.org Cc: LKML , Gao Xiang , Hongbo Li Subject: [PATCH v2 4/4] erofs: unexport erofs_xattr_prefix() Date: Wed, 31 Dec 2025 12:57:36 +0800 Message-ID: <20251231045736.1552300-1-hsiangkao@linux.alibaba.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20251229092949.2316075-4-hsiangkao@linux.alibaba.com> References: <20251229092949.2316075-4-hsiangkao@linux.alibaba.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit It can be simply in xattr.c due to no external users. Reviewed-by: Hongbo Li Signed-off-by: Gao Xiang --- v2: - fix sparse warnings: https://lore.kernel.org/r/202512311021.L0IMtTOh-lkp@intel.com fs/erofs/xattr.c | 31 ++++++++++++++++++++++++++++--- fs/erofs/xattr.h | 30 ------------------------------ 2 files changed, 28 insertions(+), 33 deletions(-) diff --git a/fs/erofs/xattr.c b/fs/erofs/xattr.c index 972941ecb71c..f8668157162f 100644 --- a/fs/erofs/xattr.c +++ b/fs/erofs/xattr.c @@ -25,6 +25,8 @@ struct erofs_xattr_iter { struct dentry *dentry; }; +static const char *erofs_xattr_prefix(unsigned int idx, struct dentry *dentry); + static int erofs_init_inode_xattrs(struct inode *inode) { struct erofs_inode *const vi = EROFS_I(inode); @@ -431,14 +433,14 @@ static int erofs_xattr_generic_get(const struct xattr_handler *handler, return erofs_getxattr(inode, handler->flags, name, buffer, size); } -const struct xattr_handler erofs_xattr_user_handler = { +static const struct xattr_handler erofs_xattr_user_handler = { .prefix = XATTR_USER_PREFIX, .flags = EROFS_XATTR_INDEX_USER, .list = erofs_xattr_user_list, .get = erofs_xattr_generic_get, }; -const struct xattr_handler erofs_xattr_trusted_handler = { +static const struct xattr_handler erofs_xattr_trusted_handler = { .prefix = XATTR_TRUSTED_PREFIX, .flags = EROFS_XATTR_INDEX_TRUSTED, .list = erofs_xattr_trusted_list, @@ -446,7 +448,7 @@ const struct xattr_handler erofs_xattr_trusted_handler = { }; #ifdef CONFIG_EROFS_FS_SECURITY -const struct xattr_handler __maybe_unused erofs_xattr_security_handler = { +static const struct xattr_handler erofs_xattr_security_handler = { .prefix = XATTR_SECURITY_PREFIX, .flags = EROFS_XATTR_INDEX_SECURITY, .get = erofs_xattr_generic_get, @@ -462,6 +464,29 @@ const struct xattr_handler * const erofs_xattr_handlers[] = { NULL, }; +static const char *erofs_xattr_prefix(unsigned int idx, struct dentry *dentry) +{ + static const struct xattr_handler * const xattr_handler_map[] = { + [EROFS_XATTR_INDEX_USER] = &erofs_xattr_user_handler, +#ifdef CONFIG_EROFS_FS_POSIX_ACL + [EROFS_XATTR_INDEX_POSIX_ACL_ACCESS] = &nop_posix_acl_access, + [EROFS_XATTR_INDEX_POSIX_ACL_DEFAULT] = &nop_posix_acl_default, +#endif + [EROFS_XATTR_INDEX_TRUSTED] = &erofs_xattr_trusted_handler, +#ifdef CONFIG_EROFS_FS_SECURITY + [EROFS_XATTR_INDEX_SECURITY] = &erofs_xattr_security_handler, +#endif + }; + const struct xattr_handler *handler = NULL; + + if (idx && idx < ARRAY_SIZE(xattr_handler_map)) { + handler = xattr_handler_map[idx]; + if (xattr_handler_can_list(handler, dentry)) + return xattr_prefix(handler); + } + return NULL; +} + void erofs_xattr_prefixes_cleanup(struct super_block *sb) { struct erofs_sb_info *sbi = EROFS_SB(sb); diff --git a/fs/erofs/xattr.h b/fs/erofs/xattr.h index ee1d8c310d97..36f2667afc2d 100644 --- a/fs/erofs/xattr.h +++ b/fs/erofs/xattr.h @@ -11,36 +11,6 @@ #include #ifdef CONFIG_EROFS_FS_XATTR -extern const struct xattr_handler erofs_xattr_user_handler; -extern const struct xattr_handler erofs_xattr_trusted_handler; -extern const struct xattr_handler erofs_xattr_security_handler; - -static inline const char *erofs_xattr_prefix(unsigned int idx, - struct dentry *dentry) -{ - const struct xattr_handler *handler = NULL; - - static const struct xattr_handler * const xattr_handler_map[] = { - [EROFS_XATTR_INDEX_USER] = &erofs_xattr_user_handler, -#ifdef CONFIG_EROFS_FS_POSIX_ACL - [EROFS_XATTR_INDEX_POSIX_ACL_ACCESS] = &nop_posix_acl_access, - [EROFS_XATTR_INDEX_POSIX_ACL_DEFAULT] = &nop_posix_acl_default, -#endif - [EROFS_XATTR_INDEX_TRUSTED] = &erofs_xattr_trusted_handler, -#ifdef CONFIG_EROFS_FS_SECURITY - [EROFS_XATTR_INDEX_SECURITY] = &erofs_xattr_security_handler, -#endif - }; - - if (idx && idx < ARRAY_SIZE(xattr_handler_map)) - handler = xattr_handler_map[idx]; - - if (!xattr_handler_can_list(handler, dentry)) - return NULL; - - return xattr_prefix(handler); -} - extern const struct xattr_handler * const erofs_xattr_handlers[]; int erofs_xattr_prefixes_init(struct super_block *sb); -- 2.43.5