Hi Yue,

On Mon, Dec 28, 2020 at 07:20:48PM +0800, Yue Hu wrote:
> On Mon, 28 Dec 2020 18:51:46 +0800
> Gao Xiang <hsiang...@redhat.com> wrote:

...

> > @@ -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;
> > +   }
> > +
> >     if (cfg.fs_config_file)
> 
> Whether we can use the first "cfg.fs_config_file" when loading canned
> fs-config to reduce/simplify these duplicated calling?

Not sure what you mean... If you mean why not using some "fs_config_func"
as squashfs did, that is I'd like to 1) avoid such unneeded indirect
function pointers, and 2) no need to introduce such function prototype (I
don't want to maintain such function pointer type) since fs_config and
canned_fs_config implement differently (and it seems they also behave
differently so no need to mix them at all).

Thanks,
Gao Xiang

Reply via email to