[PATCH 9/9] nfs: parse nfsport and mount port from file system options

Jean-Christophe PLAGNIOL-VILLARD plagnioj at jcrosoft.com
Fri Feb 7 03:45:10 EST 2014


On 09:22 Fri 07 Feb     , Uwe Kleine-K??nig wrote:
> Hello Jean-Christophe,
> 
> 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

Best Regards,
J.
> 
> Uwe
> 
> -- 
> Pengutronix e.K.                           | Uwe Kleine-König            |
> Industrial Linux Solutions                 | http://www.pengutronix.de/  |



More information about the barebox mailing list