[WIP] [PATCH 7/5] erofs-utils: fuse: move feature_incompat to sbi

Gao Xiang hsiangkao at aol.com
Sun Oct 25 02:27:19 AEDT 2020


In preparation to move decompress.c to lib/,
move feature_incompat to sbi only.

Laterly, sbk needs to be completely dropped.

[ will be folded to the original patch. ]
Signed-off-by: Gao Xiang <hsiangkao at aol.com>
---
 fuse/decompress.c |  2 +-
 fuse/init.c       | 12 +++++++-----
 fuse/init.h       |  2 --
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/fuse/decompress.c b/fuse/decompress.c
index e32a27017a45..766e6639aa68 100644
--- a/fuse/decompress.c
+++ b/fuse/decompress.c
@@ -22,7 +22,7 @@ static int z_erofs_decompress_generic(struct z_erofs_decompress_req *rq)
 	bool support_0padding = false;
 	unsigned int inputmargin = 0;
 
-	if (sbk->feature_incompat & EROFS_FEATURE_INCOMPAT_LZ4_0PADDING) {
+	if (erofs_sb_has_lz4_0padding()) {
 		support_0padding = true;
 
 		while (!src[inputmargin & ~PAGE_MASK])
diff --git a/fuse/init.c b/fuse/init.c
index 867f4bf90e9a..c6a3af697532 100644
--- a/fuse/init.c
+++ b/fuse/init.c
@@ -18,14 +18,16 @@
 
 
 struct erofs_super_block super;
-struct erofs_super_block *sbk = &super;
+/* XXX: sbk needs to be replaced with sbi */
+static struct erofs_super_block *sbk = &super;
+struct erofs_sb_info sbi;
 
-static bool check_layout_compatibility(struct erofs_super_block *sb,
+static bool check_layout_compatibility(struct erofs_sb_info *sbi,
 				       struct erofs_super_block *dsb)
 {
 	const unsigned int feature = le32_to_cpu(dsb->feature_incompat);
 
-	sb->feature_incompat = feature;
+	sbi->feature_incompat = feature;
 
 	/* check if current kernel meets all mandatory requirements */
 	if (feature & (~EROFS_ALL_FEATURE_INCOMPAT)) {
@@ -57,7 +59,7 @@ int erofs_init_super(void)
 		return -EINVAL;
 	}
 
-	if (!check_layout_compatibility(sbk, sb))
+	if (!check_layout_compatibility(&sbi, sb))
 		return -EINVAL;
 
 	sbk->checksum = le32_to_cpu(sb->checksum);
@@ -75,7 +77,7 @@ int erofs_init_super(void)
 	sbk->root_nid = le16_to_cpu(sb->root_nid);
 
 	erofs_dump("%-15s:0x%X\n", STR(magic), SUPER_MEM(magic));
-	erofs_dump("%-15s:0x%X\n", STR(feature_incompat), SUPER_MEM(feature_incompat));
+	erofs_dump("%-15s:0x%X\n", STR(feature_incompat), sbi.feature_incompat);
 	erofs_dump("%-15s:0x%X\n", STR(feature_compat), SUPER_MEM(feature_compat));
 	erofs_dump("%-15s:%u\n",   STR(blkszbits), SUPER_MEM(blkszbits));
 	erofs_dump("%-15s:%u\n",   STR(root_nid), SUPER_MEM(root_nid));
diff --git a/fuse/init.h b/fuse/init.h
index 405a92913b4a..34085f2b548d 100644
--- a/fuse/init.h
+++ b/fuse/init.h
@@ -13,8 +13,6 @@
 
 #define BOOT_SECTOR_SIZE	0x400
 
-extern struct erofs_super_block *sbk;
-
 int erofs_init_super(void);
 erofs_nid_t erofs_get_root_nid(void);
 erofs_off_t nid2addr(erofs_nid_t nid);
-- 
2.24.0



More information about the Linux-erofs mailing list