[WIP] [PATCH v3 09/12] erofs-utils: fuse: move superblock logic into lib/
Gao Xiang
hsiangkao at aol.com
Tue Nov 3 02:55:55 AEDT 2020
(will fold into the original patch.)
Signed-off-by: Gao Xiang <hsiangkao at aol.com>
---
fuse/Makefile.am | 2 +-
fuse/init.h | 19 -------------------
fuse/main.c | 1 -
fuse/namei.c | 1 -
fuse/read.c | 1 -
fuse/readir.c | 1 -
fuse/zmap.c | 1 -
include/erofs/internal.h | 3 +++
lib/Makefile.am | 2 +-
fuse/init.c => lib/super.c | 8 +-------
10 files changed, 6 insertions(+), 33 deletions(-)
delete mode 100644 fuse/init.h
rename fuse/init.c => lib/super.c (94%)
diff --git a/fuse/Makefile.am b/fuse/Makefile.am
index 2b2608f57b03..f54def7a1526 100644
--- a/fuse/Makefile.am
+++ b/fuse/Makefile.am
@@ -3,7 +3,7 @@
AUTOMAKE_OPTIONS = foreign
bin_PROGRAMS = erofsfuse
-erofsfuse_SOURCES = main.c dentry.c getattr.c namei.c read.c init.c open.c readir.c zmap.c
+erofsfuse_SOURCES = main.c dentry.c getattr.c namei.c read.c open.c readir.c zmap.c
erofsfuse_CFLAGS = -Wall -Werror \
-I$(top_srcdir)/include \
$(shell pkg-config fuse --cflags) \
diff --git a/fuse/init.h b/fuse/init.h
deleted file mode 100644
index f0211707b5ff..000000000000
--- a/fuse/init.h
+++ /dev/null
@@ -1,19 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0+ */
-/*
- * erofs-utils/fuse/init.h
- *
- * Created by Li Guifu <blucerlee at gmail.com>
- */
-#ifndef __EROFS_INIT_H
-#define __EROFS_INIT_H
-
-#include <fuse.h>
-#include <fuse_opt.h>
-#include "erofs/internal.h"
-
-#define BOOT_SECTOR_SIZE 0x400
-
-int erofs_read_superblock(void);
-void *erofs_init(struct fuse_conn_info *info);
-
-#endif
diff --git a/fuse/main.c b/fuse/main.c
index 30e4839bdcb4..21f8b0451732 100644
--- a/fuse/main.c
+++ b/fuse/main.c
@@ -12,7 +12,6 @@
#include <stddef.h>
#include "erofs/print.h"
-#include "init.h"
#include "namei.h"
#include "read.h"
#include "getattr.h"
diff --git a/fuse/namei.c b/fuse/namei.c
index c3766f9a9f02..4c428dbc59f6 100644
--- a/fuse/namei.c
+++ b/fuse/namei.c
@@ -17,7 +17,6 @@
#include "erofs/print.h"
#include "erofs/io.h"
#include "dentry.h"
-#include "init.h"
#define IS_PATH_SEPARATOR(__c) ((__c) == '/')
#define MINORBITS 20
diff --git a/fuse/read.c b/fuse/read.c
index dc88b24eaae3..10a26d84c37c 100644
--- a/fuse/read.c
+++ b/fuse/read.c
@@ -16,7 +16,6 @@
#include "erofs/print.h"
#include "namei.h"
#include "erofs/io.h"
-#include "init.h"
#include "erofs/decompress.h"
size_t erofs_read_data_wrapper(struct erofs_vnode *vnode, char *buffer,
diff --git a/fuse/readir.c b/fuse/readir.c
index 496f4e73a9c2..5281c8b80e59 100644
--- a/fuse/readir.c
+++ b/fuse/readir.c
@@ -15,7 +15,6 @@
#include "namei.h"
#include "erofs/io.h"
#include "erofs/print.h"
-#include "init.h"
erofs_nid_t split_entry(char *entry, off_t ofs, char *end, char *name,
uint32_t dirend)
diff --git a/fuse/zmap.c b/fuse/zmap.c
index cb667da4e0c8..ba5c457278a8 100644
--- a/fuse/zmap.c
+++ b/fuse/zmap.c
@@ -9,7 +9,6 @@
* Created by Gao Xiang <gaoxiang25 at huawei.com>
* Modified by Huang Jianan <huangjianan at oppo.com>
*/
-#include "init.h"
#include "erofs/io.h"
#include "erofs/print.h"
diff --git a/include/erofs/internal.h b/include/erofs/internal.h
index 306005dea2a7..e56fd1898f3e 100644
--- a/include/erofs/internal.h
+++ b/include/erofs/internal.h
@@ -259,6 +259,9 @@ struct erofs_map_blocks {
erofs_blk_t index;
};
+/* super.c */
+int erofs_read_superblock(void);
+
/* data.h */
int erofs_read_raw_data(struct erofs_inode *inode, char *buffer,
erofs_off_t offset, erofs_off_t size);
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 54c43897aa49..487c4944479d 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -2,7 +2,7 @@
# Makefile.am
noinst_LTLIBRARIES = liberofs.la
-liberofs_la_SOURCES = config.c io.c cache.c inode.c xattr.c exclude.c \
+liberofs_la_SOURCES = config.c io.c cache.c super.c inode.c xattr.c exclude.c \
data.c compress.c compressor.c decompress.c
liberofs_la_CFLAGS = -Wall -Werror -I$(top_srcdir)/include
if ENABLE_LZ4
diff --git a/fuse/init.c b/lib/super.c
similarity index 94%
rename from fuse/init.c
rename to lib/super.c
index a5694beaf519..6213585c085d 100644
--- a/fuse/init.c
+++ b/lib/super.c
@@ -1,22 +1,16 @@
// SPDX-License-Identifier: GPL-2.0+
/*
- * erofs-utils/fuse/init.c
+ * erofs-utils/lib/super.c
*
* Created by Li Guifu <blucerlee at gmail.com>
*/
-#include "init.h"
#include <string.h>
#include <stdlib.h>
#include <asm-generic/errno-base.h>
-#include "namei.h"
#include "erofs/io.h"
#include "erofs/print.h"
-#define STR(_X) (#_X)
-#define SUPER_MEM(_X) (super._X)
-
-
struct erofs_super_block super;
struct erofs_sb_info sbi;
--
2.24.0
More information about the Linux-erofs
mailing list