Skip to contentSkip to conversation

erofs-utils: lib: add erofs_get_configure

PATCH Superseded Hongzhen Luo 2 participants 2 messages Jun 27, 2024 Library code

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

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

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.

---
 include/erofs/config.h | 1 +
 lib/config.c           | 6 ++++++
 2 files changed, 7 insertions(+)
include/erofs/config.h +1 -0
index 3ce8c59..aa6870d 100644
@@ -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);
lib/config.c +6 -0
index 26f1c35..3f93cdb 100644
@@ -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)
Signature · 1 line
2.39.3
#1 lore raw
Quoted 4 lines · Hongzhen Luo

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 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.

Quoted 3 lines

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

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

Quoted 12 lines
---
  include/erofs/config.h | 1 +
  lib/config.c           | 6 ++++++
  2 files changed, 7 insertions(+)
include/erofs/config.h +0 -0
index 3ce8c59..aa6870d 100644

include/erofs/config.h extern struct erofs_configure cfg; · line 101

Quoted 3 lines
include/erofs/config.h +0 -0
@@ -99,6 +99,7 @@ extern struct erofs_configure cfg;
  void erofs_init_configure(void);
  void erofs_show_config(void);
  void erofs_exit_configure(void);

/* a temporary helper for updating global configuration */

lib/config.c void erofs_exit_configure(void) · line 69

Quoted 12 lines
include/erofs/config.h +1 -0
+struct erofs_configure *erofs_get_configure();
 >   void erofs_set_fs_root(const char *rootdir);
  const char *erofs_fspath(const char *fullpath);
lib/config.c +1 -0
index 26f1c35..3f93cdb 100644
@@ -66,6 +66,12 @@ void erofs_exit_configure(void)
  		free(cfg.c_compr_opts[i].alg);
  }
 
+/* a temporary solution for liberofs to make configuration */

Drop this one.

Thanks,
Gao Xiang

Quoted 8 lines
lib/config.c +5 -0
+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)