[PATCH 9/9] nfs: parse nfsport and mount port from file system options
Uwe Kleine-König
u.kleine-koenig at pengutronix.de
Fri Feb 7 05:06:26 EST 2014
Hello Jean-Christophe,
On Fri, Feb 07, 2014 at 09:45:10AM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> On 09:22 Fri 07 Feb , Uwe Kleine-K??nig wrote:
> > On Fri, Feb 07, 2014 at 07:50:32AM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > > > +static void parseopt_hu(const char *options, const char *opt,
> > > > + unsigned short *val)
> > > > +{
> > > > + const char *start;
> > > > + size_t optlen = strlen(opt);
> > > > + ulong v;
> > > > + char *endp;
> > > > +
> > > > +again:
> > > > + start = strstr(options, opt);
> > > > +
> > > > + if (!start)
> > > > + return;
> > > > +
> > > > + if (start > options && start[-1] != ',') {
> > > > + options = start;
> > > > + goto again;
> > > > + }
> > > > +
> > > > + if (start[optlen] != '=') {
> > > > + options = start;
> > > > + goto again;
> > > > + }
> > > > +
> > > > + v = simple_strtoul(start + optlen + 1, &endp, 0);
> > > > + if (v > USHORT_MAX)
> > > > + return;
> > > > +
> > > > + if (*endp == ',' || *endp == '\0')
> > > > + *val = v;
> > > > +}
> > >
> > > this should be global
> > Yeah, do you have a suggestion where to put it? fs/parseopt.c?
>
> why not
>
> but IIRC the cmdline parser should be the same too
"the cmdline parser"? AFAIK there is no cmdline parser for the kernel
command line(?) in barebox. And if it were, the latter is ' '-separated
while the mount options are ','-separated. This could be abstracted, but
I think for now and until we need a linux kernel commandline parser it's
fine to hardcode ',' and let it live in fs/.
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | http://www.pengutronix.de/ |
More information about the barebox
mailing list