[PATCH] erofs-utils: lib: add erofs_get_configure

Gao Xiang hsiangkao at linux.alibaba.com
Thu Jun 27 12:17:33 AEST 2024



On 2024/6/27 10:10, Hongzhen Luo wrote:
> 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.

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

> 
> 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);

/* 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);
> 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 */

Drop this one.

Thanks,
Gao Xiang

> +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)


More information about the Linux-erofs mailing list