Re: [PATCH RFC v2 1/4] fs: add helper to use mount option as path or fd

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Oct 12, 2024 at 9:21 AM Amir Goldstein <amir73il@xxxxxxxxx> wrote:
>
> On Fri, Oct 11, 2024 at 11:46 PM Christian Brauner <brauner@xxxxxxxxxx> wrote:
> >
> > Allow filesystems to use a mount option either as a
> > path or a file descriptor.
> >
> > Signed-off-by: Christian Brauner <brauner@xxxxxxxxxx>
>
> Looks sane
>
> Reviewed-by: Amir Goldstein <amir73il@xxxxxxxxx>
>
> > ---
> >  fs/fs_parser.c            | 19 +++++++++++++++++++
> >  include/linux/fs_parser.h |  5 ++++-
> >  2 files changed, 23 insertions(+), 1 deletion(-)
> >
> > diff --git a/fs/fs_parser.c b/fs/fs_parser.c
> > index 24727ec34e5aa434364e87879cccf9fe1ec19d37..a017415d8d6bc91608ece5d42fa4bea26e47456b 100644
> > --- a/fs/fs_parser.c
> > +++ b/fs/fs_parser.c
> > @@ -308,6 +308,25 @@ int fs_param_is_fd(struct p_log *log, const struct fs_parameter_spec *p,
> >  }
> >  EXPORT_SYMBOL(fs_param_is_fd);
> >
> > +int fs_param_is_fd_or_path(struct p_log *log, const struct fs_parameter_spec *p,
> > +                          struct fs_parameter *param,
> > +                          struct fs_parse_result *result)
> > +{
> > +       switch (param->type) {
> > +       case fs_value_is_string:
> > +               return fs_param_is_string(log, p, param, result);
> > +       case fs_value_is_file:
> > +               result->uint_32 = param->dirfd;
> > +               if (result->uint_32 <= INT_MAX)
> > +                       return 0;
> > +               break;
> > +       default:
> > +               break;
> > +       }
> > +       return fs_param_bad_value(log, param);
> > +}
> > +EXPORT_SYMBOL(fs_param_is_fd_or_path);
> > +

I just noticed that it is a little weird that fsparam_is_fd() accepts a numeric
string while fsparam_is_fd_or_path() does not.
Not to mention that fsparam_is_fd_or_path does not accept type filename.

Obviously a helper name fs_param_is_file_or_string() wouldn't have
raised those questions.
I will let you decide if this is something to worry about.

Thanks,
Amir.





[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux