[PATCH] erofs-utils: fuse: introduce xattr support

Gao Xiang hsiangkao at linux.alibaba.com
Tue Jul 19 20:21:30 AEST 2022


Hi Jianan,

On Fri, Jul 15, 2022 at 05:53:59PM +0800, Huang Jianan wrote:
> This implements xattr functionalities for erofsfuse. A large amount
> of code was adapted from Linux kernel.
> 
> Signed-off-by: Huang Jianan <jnhuang at linux.alibaba.com>
> ---
>  fuse/main.c              |  32 +++
>  include/erofs/internal.h |   8 +
>  include/erofs/xattr.h    |  21 ++
>  lib/xattr.c              | 508 +++++++++++++++++++++++++++++++++++++++
>  4 files changed, 569 insertions(+)
> 
> diff --git a/fuse/main.c b/fuse/main.c
> index f4c2476..30a0bed 100644
> --- a/fuse/main.c
> +++ b/fuse/main.c
> @@ -139,7 +139,39 @@ static int erofsfuse_readlink(const char *path, char *buffer, size_t size)
>  	return 0;
>  }
>  
> +static int erofsfuse_getxattr(const char *path, const char *name, char *value,
> +			size_t size)
> +{
> +	int ret;
> +	struct erofs_inode vi;
> +
> +	erofs_dbg("getxattr(%s): name=%s size=%llu", path, name, size);
> +
> +	ret = erofs_ilookup(path, &vi);
> +	if (ret)
> +		return ret;
> +
> +	return erofs_getxattr(&vi, name, value, size);
> +}
> +
> +static int erofsfuse_listxattr(const char *path, char *list, size_t size)
> +{
> +	int ret;
> +	struct erofs_inode vi;
> +	int i;

As we discussed offline, this line should be unneeded.

Thanks,
Gao Xiang


More information about the Linux-erofs mailing list