]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
erofs: unexport erofs_xattr_prefix()
authorGao Xiang <hsiangkao@linux.alibaba.com>
Wed, 31 Dec 2025 04:57:36 +0000 (12:57 +0800)
committerGao Xiang <hsiangkao@linux.alibaba.com>
Thu, 22 Jan 2026 16:04:22 +0000 (00:04 +0800)
It can be simply in xattr.c due to no external users.

Reviewed-by: Hongbo Li <lihongbo22@huawei.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
fs/erofs/xattr.c
fs/erofs/xattr.h

index 972941ecb71ce6c3e73813fc7fbfa0c22a6943ad..f8668157162f7674d2d3cc54116171042e207506 100644 (file)
@@ -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);
index ee1d8c310d9703b9176a13a3c0f896624a43e462..36f2667afc2df455e1ab41709182b6d4fc15e72e 100644 (file)
 #include <linux/xattr.h>
 
 #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);