[PATCH] erofs-utils: lib: add erofs_get_configure

Hongzhen Luo hongzhen at linux.alibaba.com
Thu Jun 27 12:10:05 AEST 2024


This introduces the `erofs_get_configure` function to obtain the
global configuration `cfg`. This allows external entities to get
and change the `cfg` value through this function, thereby controlling
the filesystem creation process.

This is a temporary solution for liberofs to configure the
filesystem creation, and it will be deprecated in the future.

Signed-off-by: Hongzhen Luo <hongzhen at linux.alibaba.com>
---
 include/erofs/config.h | 1 +
 lib/config.c           | 6 ++++++
 2 files changed, 7 insertions(+)

diff --git a/include/erofs/config.h b/include/erofs/config.h
index 3ce8c59..aa6870d 100644
--- a/include/erofs/config.h
+++ b/include/erofs/config.h
@@ -99,6 +99,7 @@ extern struct erofs_configure cfg;
 void erofs_init_configure(void);
 void erofs_show_config(void);
 void erofs_exit_configure(void);
+struct erofs_configure *erofs_get_configure();
 
 void erofs_set_fs_root(const char *rootdir);
 const char *erofs_fspath(const char *fullpath);
diff --git a/lib/config.c b/lib/config.c
index 26f1c35..3f93cdb 100644
--- a/lib/config.c
+++ b/lib/config.c
@@ -66,6 +66,12 @@ void erofs_exit_configure(void)
 		free(cfg.c_compr_opts[i].alg);
 }
 
+/* a temporary solution for liberofs to make configuration */
+struct erofs_configure *erofs_get_configure()
+{
+	return &cfg;
+}
+
 static unsigned int fullpath_prefix;	/* root directory prefix length */
 
 void erofs_set_fs_root(const char *rootdir)
-- 
2.39.3



More information about the Linux-erofs mailing list