[PATCH] erofs-utils: lib: chagne function definition of erofs_blocklist_open()

Gao Xiang hsiangkao at linux.alibaba.com
Tue Jul 2 22:02:10 AEST 2024



On 2024/7/2 19:56, Hongzhen Luo wrote:
> Modified the definition of the function `erofs_blocklist_open` to accept
> a file pointer rather than a string, for external use in liberofs.
> 
> Signed-off-by: Hongzhen Luo <hongzhen at linux.alibaba.com>
> ---
>   include/erofs/block_list.h |  2 +-
>   lib/block_list.c           |  9 ++++-----
>   mkfs/main.c                | 21 ++++++++++++++-------
>   3 files changed, 19 insertions(+), 13 deletions(-)
> 
> diff --git a/include/erofs/block_list.h b/include/erofs/block_list.h
> index 9f9975e..00da82c 100644
> --- a/include/erofs/block_list.h
> +++ b/include/erofs/block_list.h
> @@ -13,7 +13,7 @@ extern "C"
>   
>   #include "internal.h"
>   
> -int erofs_blocklist_open(char *filename, bool srcmap);
> +int erofs_blocklist_open(FILE *fp, bool srcmap);
>   void erofs_blocklist_close(void);


In that case, should we don't `fclose(block_list_fp);`
but return `FILE *` instead? As,

FILE *erofs_blocklist_close(void);

And makes the caller to close the FILE *.

Thanks,
Gao Xiang


More information about the Linux-erofs mailing list