[PATCH] erofs-utils: fix multiple definition of `sbi'

Gao Xiang hsiangkao at aol.com
Tue Dec 8 21:57:41 AEDT 2020


As nl6720 reported [1], lib/inode.o (mkfs) and lib/super.o (erofsfuse)
could be compiled together by some options. Fix it now.

[1] https://lore.kernel.org/r/10789285.Na0ui7I3VY@walnut
Reported-by: nl6720 <nl6720 at gmail.com>
Signed-off-by: Gao Xiang <hsiangkao at aol.com>
---
Hi nl6720,
could you verify this patch? Thanks in advance!

Thanks,
Gao Xiang

 lib/config.c | 1 +
 lib/inode.c  | 2 --
 lib/super.c  | 2 --
 3 files changed, 1 insertion(+), 4 deletions(-)

diff --git a/lib/config.c b/lib/config.c
index 315511284871..3ecd48140cfd 100644
--- a/lib/config.c
+++ b/lib/config.c
@@ -11,6 +11,7 @@
 #include "erofs/internal.h"
 
 struct erofs_configure cfg;
+struct erofs_sb_info sbi;
 
 void erofs_init_configure(void)
 {
diff --git a/lib/inode.c b/lib/inode.c
index 3d634fc92852..0c4839dc7152 100644
--- a/lib/inode.c
+++ b/lib/inode.c
@@ -22,8 +22,6 @@
 #include "erofs/xattr.h"
 #include "erofs/exclude.h"
 
-struct erofs_sb_info sbi;
-
 #define S_SHIFT                 12
 static unsigned char erofs_ftype_by_mode[S_IFMT >> S_SHIFT] = {
 	[S_IFREG >> S_SHIFT]  = EROFS_FT_REG_FILE,
diff --git a/lib/super.c b/lib/super.c
index 2d366928e12b..025cefee3aac 100644
--- a/lib/super.c
+++ b/lib/super.c
@@ -11,8 +11,6 @@
 #include "erofs/io.h"
 #include "erofs/print.h"
 
-struct erofs_sb_info sbi;
-
 static bool check_layout_compatibility(struct erofs_sb_info *sbi,
 				       struct erofs_super_block *dsb)
 {
-- 
2.24.0



More information about the Linux-erofs mailing list