[Libguestfs] [PATCH 06/10] Rearrange and tidy up code in guestfsd.c

Richard W.M. Jones rjones at redhat.com
Tue Sep 22 09:02:05 UTC 2009


On Mon, Sep 21, 2009 at 09:08:37PM +0200, Jim Meyering wrote:
> Richard W.M. Jones wrote:
> > From: Richard Jones <rjones at trick.home.annexia.org>
> >
> > This just tidies up the main() function in the daemon.  There is
> > no longer a huge fixed-sized buffer used for the kernel command
> > line.  Variables are moved closer to where they are used.  Some
> > local variables turned out to be unused - these are removed.  Finally
> > the part that reads the kernel command line is moved into a separate
> > function.
> >
> > There is only minimal functional change here (it now prints out
> > the kernel command line).
> ...
> 
> Nicely improved readability.
> ACK
> 
> > +  char lenbuf[4];
> > +  XDR xdr;
> > +  uint32_t len = GUESTFS_LAUNCH_FLAG;
> > +  xdrmem_create (&xdr, lenbuf, sizeof lenbuf, XDR_ENCODE);
> > +  xdr_uint32_t (&xdr, &len);
> >
> > -  if (xwrite (sock, buf, xdr_getpos (&xdr)) == -1)
> > +  if (xwrite (sock, lenbuf, 4) == -1)
> 
> Can you replace that literal 4 ?
> maybe with "sizeof lenbuf"

Thanks - I pushed this with the change you suggested.

Rich.

-- 
Richard Jones, Emerging Technologies, Red Hat  http://et.redhat.com/~rjones
libguestfs lets you edit virtual machines.  Supports shell scripting,
bindings from many languages.  http://et.redhat.com/~rjones/libguestfs/
See what it can do: http://et.redhat.com/~rjones/libguestfs/recipes.html




More information about the Libguestfs mailing list