Skip to contentSkip to conversation

erofs-utils: lib: add erofs_get_configure

PATCH New Hongzhen Luo 1 participant 1 message Jun 27, 2024 Library code

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 erofs-utils: lib: add erofs_get_configure

This introduces erofs_get_configure() to get the global configuration cfg. This allows external entities to change the global configuration through this helper, thereby controlling the EROFS mkfs process.

It is just a temporary helper for liberofs and it will be deprecated in the future.

---
v2: Update the commit message.
v1: https://lore.kernel.org/all/[email protected]/

---
 include/erofs/config.h | 3 +++
 lib/config.c           | 5 +++++
 2 files changed, 8 insertions(+)
include/erofs/config.h +3 -0
index 3ce8c59..111f5b0 100644
@@ -100,6 +100,9 @@ void erofs_init_configure(void);
 void erofs_show_config(void);
 void erofs_exit_configure(void);
 
+/* a temporary helper for updating global configuration */
+struct erofs_configure *erofs_get_configure();
+
 void erofs_set_fs_root(const char *rootdir);
 const char *erofs_fspath(const char *fullpath);
 
lib/config.c +5 -0
index 26f1c35..44f0606 100644
@@ -66,6 +66,11 @@ void erofs_exit_configure(void)
 		free(cfg.c_compr_opts[i].alg);
 }
 
+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)
Signature · 1 line
2.39.3