From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:38074) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TBdhX-0006hk-4d for qemu-devel@nongnu.org; Tue, 11 Sep 2012 23:33:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TBdhW-0004KA-5h for qemu-devel@nongnu.org; Tue, 11 Sep 2012 23:33:19 -0400 Received: from e28smtp03.in.ibm.com ([122.248.162.3]:58076) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TBdhV-0004Jx-IE for qemu-devel@nongnu.org; Tue, 11 Sep 2012 23:33:18 -0400 Received: from /spool/local by e28smtp03.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 12 Sep 2012 09:03:11 +0530 Received: from d28av03.in.ibm.com (d28av03.in.ibm.com [9.184.220.65]) by d28relay02.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q8C3X8wm10027008 for ; Wed, 12 Sep 2012 09:03:09 +0530 Received: from d28av03.in.ibm.com (loopback [127.0.0.1]) by d28av03.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q8C3X7Ux028749 for ; Wed, 12 Sep 2012 13:33:08 +1000 Date: Wed, 12 Sep 2012 09:05:01 +0530 From: Bharata B Rao Message-ID: <20120912033501.GB13500@in.ibm.com> References: <20120911082824.GA24816@in.ibm.com> <87k3w0pwla.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87k3w0pwla.fsf@blackfin.pond.sub.org> Subject: Re: [Qemu-devel] [PATCH v1] Make inet_parse() non-static Reply-To: bharata@linux.vnet.ibm.com List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: Kevin Wolf , Stefan Hajnoczi , qemu-devel@nongnu.org, Gerd Hoffmann On Tue, Sep 11, 2012 at 02:34:09PM +0200, Markus Armbruster wrote: > Bharata B Rao writes: > > > From: Bharata B Rao > > > > Make inet_parse() non static. > > > > - Make inet_parse() non-static so that other subsystems like gluster > > can use it to parse inet addresses. As a pre-requisite, define and > > globalize the qemu_inet_opts. > > Please repost this as part of a series that needs non-static > inet_parse(). Sure, will post it as part of next version of gluster patches. > I'm worried parameter "block" will cause trouble, but I > can't see that without the users. I don't see how that could affect the users. FYI I am not using "block" parameter, pls wait for my next post to check this. > > > - Extend inet_parse() to parse just 'address' also in addition to > > 'address:port'. > > Separate patch, please. Hmm ok. > > > Signed-off-by: Bharata B Rao > > --- > > Ideally I needn't use sscanf twice once for parsing host:port (checking > > return value of 2) and if that fails for parsing host w/o port (checking > > return value of 1). I could just check if sscanf returned 2 or 1 and decide > > if addr:port or just addr was provided, but in the latter case the > > pointer to the bytes consumed (&pos) doesn't get updated. > > You can use two of them, like this: > > a_end = b_end = -1; > sscanf(str, "%d%n:%d%n", &a, &a_end, &b, &b_end); > if (b_end >= 0) ... Thanks. Bharata.