qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v1] Make inet_parse() non-static


From: Bharata B Rao
Subject: Re: [Qemu-devel] [PATCH v1] Make inet_parse() non-static
Date: Wed, 12 Sep 2012 09:05:01 +0530
User-agent: Mutt/1.5.21 (2010-09-15)

On Tue, Sep 11, 2012 at 02:34:09PM +0200, Markus Armbruster wrote:
> Bharata B Rao <address@hidden> writes:
> 
> > From: Bharata B Rao <address@hidden>
> >
> > 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 <address@hidden>
> > ---
> > 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.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]