[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 03:22:22 EST 2014


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?

Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |



More information about the barebox mailing list