erofs-utils: lib: add erofs_get_configure()
authorHongzhen Luo <hongzhen@linux.alibaba.com>
Thu, 27 Jun 2024 02:27:41 +0000 (10:27 +0800)
committerGao Xiang <hsiangkao@linux.alibaba.com>
Thu, 27 Jun 2024 02:45:36 +0000 (10:45 +0800)
This adds `erofs_get_configure()` to get the global configuration
`cfg`.  It 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.  Don't rely on it too much.

Signed-off-by: Hongzhen Luo <hongzhen@linux.alibaba.com>
Link: https://lore.kernel.org/r/20240627022741.3912785-1-hongzhen@linux.alibaba.com
[ Gao Xiang: minor commit message update. ]
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
include/erofs/config.h
lib/config.c

index 3ce8c597b56e89230af4b5aafd8ed4100aef5dcd..f8726b5ef4c952af9d1890701ea9fe08391033b0 100644 (file)
@@ -100,6 +100,9 @@ void erofs_init_configure(void);
 void erofs_show_config(void);
 void erofs_exit_configure(void);
 
+/* (will be deprecated) temporary helper for updating global the cfg */
+struct erofs_configure *erofs_get_configure();
+
 void erofs_set_fs_root(const char *rootdir);
 const char *erofs_fspath(const char *fullpath);
 
index 26f1c355701490abfe07419532e0d2c2086ae846..44f0606b3cf8ba9a4efd4ab7d38bfbeb2dcd8133 100644 (file)
@@ -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)