[Libguestfs] [PATCH supermin 3/3] init: Refactor for-loop which waits for root device to show up.

Pino Toscano ptoscano at redhat.com
Thu Apr 20 12:18:51 UTC 2017


On Wednesday, 19 April 2017 12:04:30 CEST Richard W.M. Jones wrote:
> On Wed, Apr 19, 2017 at 10:57:28AM +0100, Richard W.M. Jones wrote:
> > +  struct timespec t;
> > +#define NANOSLEEP(ns) do {                      \
> > +    t.tv_sec = delay_ns / 1000000000;           \
> > +    t.tv_nsec = delay_ns % 1000000000;          \
> > +    nanosleep (&t, NULL);                       \
> > +  } while(0)
> > +
> 
> Defining 't' outside its context is a bit clumsy.  See attached
> version of 3/3 which fixes this.

The other option is making it an inline function, so the overhead
should be really minimal, while avoiding the scoping issues.

-- 
Pino Toscano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <http://listman.redhat.com/archives/libguestfs/attachments/20170420/01ed8c3d/attachment.sig>


More information about the Libguestfs mailing list