[PATCH v2] AOSP: erofs-utils: fix sub-directory prefix for canned fs_config

Gao Xiang hsiangkao at redhat.com
Fri Jan 1 03:50:22 AEDT 2021


Hi Guifu,

On Fri, Jan 01, 2021 at 12:31:22AM +0800, Li GuiFu wrote:
> Thank for your works, Yue Hu, Jianan, Gao Xiang
> 
> On 2020/12/28 18:51, Gao Xiang wrote:

...

> > diff --git a/lib/inode.c b/lib/inode.c
> > index 0c4839d..e6159c9 100644
> > --- a/lib/inode.c
> > +++ b/lib/inode.c
> > @@ -696,32 +696,43 @@ int erofs_droid_inode_fsconfig(struct erofs_inode *inode,
> >  	/* filesystem_config does not preserve file type bits */
> >  	mode_t stat_file_type_mask = st->st_mode & S_IFMT;
> >  	unsigned int uid = 0, gid = 0, mode = 0;
> > -	char *fspath;
> > +	const char *fspath;
> > +	char *decorated = NULL;
> >  
> >  	inode->capabilities = 0;
> > +	if (!cfg.fs_config_file && !cfg.mount_point)
> > +		return 0;
> > +
> > +	if (!cfg.mount_point ||
> > +	/* have to drop the mountpoint for rootdir of canned fsconfig */
> > +	    (cfg.fs_config_file && erofs_fspath(path)[0] == '\0')) {
> > +		fspath = erofs_fspath(path);
> > +	} else {
> > +		if (asprintf(&decorated, "%s/%s", cfg.mount_point,
> > +			     erofs_fspath(path)) <= 0)
> > +			return -ENOMEM;
> > +		fspath = decorated;
> > +	}
> > +
> erofs_fspath has been written for three times, and called always.
> What do you think refact it ? Do it with
> fspath = erofs_fspath(path);
> if need decorated:
>    fspath = decorated

Yeah, it sounds reasonable. Let's refine this as a improvement of
an individual patch (if needed) since I have to rebuild AOSP again
(that is a bit complex for me now to open my PC...)

Thanks,
Gao Xiang

> 



More information about the Linux-erofs mailing list