Skip to contentSkip to conversation

staging: erofs: fix undeclared symbols

PATCH In review Thomas Weißschuh 2 participants 2 messages Sep 20, 2018 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: erofs: fix undeclared symbols

Move all internal symbols to the internal header file and add a missing "static" declaration.
This fixes the sparse warnings like the following:

drivers/staging/erofs/unzip_lz4.c:230:5: warning: symbol 'z_erofs_unzip_lz4' was not declared. Should it be static?

Signed-off-by Thomas Wei?schuh <linux at weissschuh.net>
---
 drivers/staging/erofs/data.c          |  5 -----
 drivers/staging/erofs/internal.h      | 14 ++++++++++++++
 drivers/staging/erofs/super.c         |  5 -----
 drivers/staging/erofs/unzip_vle.c     |  2 +-
 drivers/staging/erofs/unzip_vle_lz4.c |  2 --
 drivers/staging/erofs/utils.c         |  2 --
 6 files changed, 15 insertions(+), 15 deletions(-)
drivers/staging/erofs/data.c +0 -5
index ac263a180253..9bfcc549bbf0 100644
@@ -137,11 +137,6 @@ static int erofs_map_blocks_flatmode(struct inode *inode,
 	return 0;
 }
 
-#ifdef CONFIG_EROFS_FS_ZIP
-extern int z_erofs_map_blocks_iter(struct inode *,
-	struct erofs_map_blocks *, struct page **, int);
-#endif
-
 int erofs_map_blocks_iter(struct inode *inode,
 	struct erofs_map_blocks *map,
 	struct page **mpage_ret, int flags)
drivers/staging/erofs/internal.h +14 -0
index 367b39fe46e5..d4c4c87bcd35 100644
@@ -547,6 +547,20 @@ extern unsigned long erofs_shrink_count(struct shrinker *shrink,
 	struct shrink_control *sc);
 extern unsigned long erofs_shrink_scan(struct shrinker *shrink,
 	struct shrink_control *sc);
+extern void erofs_workgroup_free_rcu(struct erofs_workgroup *grp);
+
+#ifdef CONFIG_EROFS_FS_ZIP
+/* super.c */
+extern int z_erofs_init_zip_subsystem(void);
+extern void z_erofs_exit_zip_subsystem(void);
+
+/* unzip_vle.c */
+extern int z_erofs_map_blocks_iter(struct inode *,
+	struct erofs_map_blocks *, struct page **, int);
+
+/* unzip_lz4.c */
+extern int z_erofs_unzip_lz4(void *in, void *out, size_t inlen, size_t outlen);
+#endif
 
 #ifndef lru_to_page
 #define lru_to_page(head) (list_entry((head)->prev, struct page, lru))
drivers/staging/erofs/super.c +0 -5
index 2df9768edac9..c41d92e0cb3c 100644
@@ -521,11 +521,6 @@ static struct file_system_type erofs_fs_type = {
 };
 MODULE_ALIAS_FS("erofs");
 
-#ifdef CONFIG_EROFS_FS_ZIP
-extern int z_erofs_init_zip_subsystem(void);
-extern void z_erofs_exit_zip_subsystem(void);
-#endif
-
 static int __init erofs_module_init(void)
 {
 	int err;
drivers/staging/erofs/unzip_vle.c +1 -1
index 8721f0a41d15..a0d6c620051f 100644
@@ -517,7 +517,7 @@ static void __z_erofs_vle_work_release(struct z_erofs_vle_workgroup *grp,
 	erofs_workgroup_put(&grp->obj);
 }
 
-void z_erofs_vle_work_release(struct z_erofs_vle_work *work)
+static void z_erofs_vle_work_release(struct z_erofs_vle_work *work)
 {
 	struct z_erofs_vle_workgroup *grp =
 		z_erofs_vle_work_workgroup(work, true);
drivers/staging/erofs/unzip_vle_lz4.c +0 -2
index f5b665f15be5..e30e6e2ef05b 100644
@@ -99,8 +99,6 @@ int z_erofs_vle_plain_copy(struct page **compressed_pages,
 	return 0;
 }
 
-extern int z_erofs_unzip_lz4(void *in, void *out, size_t inlen, size_t outlen);
-
 int z_erofs_vle_unzip_fast_percpu(struct page **compressed_pages,
 				  unsigned clusterpages,
 				  struct page **pages,
drivers/staging/erofs/utils.c +0 -2
index 595cf90af9bb..26b9f97f258a 100644
@@ -99,8 +99,6 @@ int erofs_register_workgroup(struct super_block *sb,
 	return err;
 }
 
-extern void erofs_workgroup_free_rcu(struct erofs_workgroup *grp);
-
 int erofs_workgroup_put(struct erofs_workgroup *grp)
 {
 	int count = atomic_dec_return(&grp->refcount);
Signature · 1 line
2.19.0
#1 lore raw

Hi Thomas,

Quoted 43 lines · Thomas Wei?schuh

Move all internal symbols to the internal header file and add a missing "static" declaration.
This fixes the sparse warnings like the following:

drivers/staging/erofs/unzip_lz4.c:230:5: warning: symbol 'z_erofs_unzip_lz4' was not declared. Should it be static?

Signed-off-by Thomas Wei?schuh <linux at weissschuh.net>
---
 drivers/staging/erofs/data.c          |  5 -----
 drivers/staging/erofs/internal.h      | 14 ++++++++++++++
 drivers/staging/erofs/super.c         |  5 -----
 drivers/staging/erofs/unzip_vle.c     |  2 +-
 drivers/staging/erofs/unzip_vle_lz4.c |  2 --
 drivers/staging/erofs/utils.c         |  2 --
 6 files changed, 15 insertions(+), 15 deletions(-)
drivers/staging/erofs/data.c +0 -5
index ac263a180253..9bfcc549bbf0 100644
@@ -137,11 +137,6 @@ static int erofs_map_blocks_flatmode(struct inode *inode,
 	return 0;
 }
 
-#ifdef CONFIG_EROFS_FS_ZIP
-extern int z_erofs_map_blocks_iter(struct inode *,
-	struct erofs_map_blocks *, struct page **, int);
-#endif
-
 int erofs_map_blocks_iter(struct inode *inode,
 	struct erofs_map_blocks *map,
 	struct page **mpage_ret, int flags)
drivers/staging/erofs/internal.h +3 -0
index 367b39fe46e5..d4c4c87bcd35 100644
@@ -547,6 +547,20 @@ extern unsigned long erofs_shrink_count(struct shrinker *shrink,
 	struct shrink_control *sc);
 extern unsigned long erofs_shrink_scan(struct shrinker *shrink,
 	struct shrink_control *sc);
+extern void erofs_workgroup_free_rcu(struct erofs_workgroup *grp);
+
+#ifdef CONFIG_EROFS_FS_ZIP

drivers/staging/erofs/internal.h extern unsigned long erofs_shrink_count(struct shrinker *shrink, · line 562

Quoted 10 lines
drivers/staging/erofs/internal.h +10 -0
+/* super.c */
+extern int z_erofs_init_zip_subsystem(void);
+extern void z_erofs_exit_zip_subsystem(void);
+
+/* unzip_vle.c */
+extern int z_erofs_map_blocks_iter(struct inode *,
+	struct erofs_map_blocks *, struct page **, int);
+
+/* unzip_lz4.c */
+extern int z_erofs_unzip_lz4(void *in, void *out, size_t inlen, size_t outlen);

Thanks for your patch.

Here z_erofs_unzip_lz4 couldn't be directly declared in internal.h
--- internal.h means the file system internal but not for the decompression algorithms.

Some declarations in *.c are for temporary use.
z_erofs_unzip_lz4 has no related with the file system itself and I planned to cleanup later after we have more decompression algorithm support such as zstd....

If you want to cleanup now, prefer to introduce "decompressor wrappers" and a new .h rather than cleanup as simple as what is done in this commit.

Quoted 25 lines
drivers/staging/erofs/internal.h +1 -0
+#endif
 
 #ifndef lru_to_page
 #define lru_to_page(head) (list_entry((head)->prev, struct page, lru))
drivers/staging/erofs/super.c +0 -5
index 2df9768edac9..c41d92e0cb3c 100644
@@ -521,11 +521,6 @@ static struct file_system_type erofs_fs_type = {
 };
 MODULE_ALIAS_FS("erofs");
 
-#ifdef CONFIG_EROFS_FS_ZIP
-extern int z_erofs_init_zip_subsystem(void);
-extern void z_erofs_exit_zip_subsystem(void);
-#endif
-
 static int __init erofs_module_init(void)
 {
 	int err;
drivers/staging/erofs/unzip_vle.c +0 -0
index 8721f0a41d15..a0d6c620051f 100644

drivers/staging/erofs/unzip_vle.c static void __z_erofs_vle_work_release(struct z_erofs_vle_workgroup *grp, · line 523

Quoted 8 lines
drivers/staging/erofs/unzip_vle.c +1 -1
@@ -517,7 +517,7 @@ static void __z_erofs_vle_work_release(struct z_erofs_vle_workgroup *grp,
 	erofs_workgroup_put(&grp->obj);
 }
 
-void z_erofs_vle_work_release(struct z_erofs_vle_work *work)
+static void z_erofs_vle_work_release(struct z_erofs_vle_work *work)
 {
 	struct z_erofs_vle_workgroup *grp =
 		z_erofs_vle_work_workgroup(work, true);

How about making a separate patch to fix all the missing static's? Or How about changing your patch title "staging: erofs: fix undeclared symbols" to indicate you also add some missing static's ?

Thanks,
Gao Xiang

Quoted 27 lines
drivers/staging/erofs/unzip_vle_lz4.c +0 -2
index f5b665f15be5..e30e6e2ef05b 100644
@@ -99,8 +99,6 @@ int z_erofs_vle_plain_copy(struct page **compressed_pages,
 	return 0;
 }
 
-extern int z_erofs_unzip_lz4(void *in, void *out, size_t inlen, size_t outlen);
-
 int z_erofs_vle_unzip_fast_percpu(struct page **compressed_pages,
 				  unsigned clusterpages,
 				  struct page **pages,
drivers/staging/erofs/utils.c +0 -2
index 595cf90af9bb..26b9f97f258a 100644
@@ -99,8 +99,6 @@ int erofs_register_workgroup(struct super_block *sb,
 	return err;
 }
 
-extern void erofs_workgroup_free_rcu(struct erofs_workgroup *grp);
-
 int erofs_workgroup_put(struct erofs_workgroup *grp)
 {
 	int count = atomic_dec_return(&grp->refcount);