From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from metis.ext.pengutronix.de ([2001:6f8:1178:4:290:27ff:fe1d:cc33]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WBiKf-0001ux-0Z for barebox@lists.infradead.org; Fri, 07 Feb 2014 10:06:53 +0000 Date: Fri, 7 Feb 2014 11:06:26 +0100 From: Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= Message-ID: <20140207100626.GH17045@pengutronix.de> References: <1391704854-3141-1-git-send-email-u.kleine-koenig@pengutronix.de> <1391704854-3141-10-git-send-email-u.kleine-koenig@pengutronix.de> <20140207065032.GG9671@ns203013.ovh.net> <20140207082221.GD17045@pengutronix.de> <20140207084510.GI9671@ns203013.ovh.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20140207084510.GI9671@ns203013.ovh.net> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Sender: "barebox" Errors-To: barebox-bounces+u.kleine-koenig=pengutronix.de@lists.infradead.org Subject: Re: [PATCH 9/9] nfs: parse nfsport and mount port from file system options To: Jean-Christophe PLAGNIOL-VILLARD Cc: barebox@lists.infradead.org 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-VILL= ARD wrote: > > > > +static void parseopt_hu(const char *options, const char *opt, > > > > + unsigned short *val) > > > > +{ > > > > + const char *start; > > > > + size_t optlen =3D strlen(opt); > > > > + ulong v; > > > > + char *endp; > > > > + > > > > +again: > > > > + start =3D strstr(options, opt); > > > > + > > > > + if (!start) > > > > + return; > > > > + > > > > + if (start > options && start[-1] !=3D ',') { > > > > + options =3D start; > > > > + goto again; > > > > + } > > > > + > > > > + if (start[optlen] !=3D '=3D') { > > > > + options =3D start; > > > > + goto again; > > > > + } > > > > + > > > > + v =3D simple_strtoul(start + optlen + 1, &endp, 0); > > > > + if (v > USHORT_MAX) > > > > + return; > > > > + > > > > + if (*endp =3D=3D ',' || *endp =3D=3D '\0') > > > > + *val =3D 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=F6nig | Industrial Linux Solutions | http://www.pengutronix.de/ | _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox