[Libguestfs] [PATCH 09/10] Implement "null vmchannel" - no vmchannel needed!

Jim Meyering jim at meyering.net
Tue Sep 22 09:34:33 UTC 2009


Richard W.M. Jones wrote:

> From: Richard Jones <rjones at trick.home.annexia.org>
>
> This commit removes the requirement for vmchannel, although retaining
> support for it.
...

Looks fine.  ACK.
One suggestion:

> diff --git a/src/guestfs.c b/src/guestfs.c
> index ec7473e..60be453 100644
> --- a/src/guestfs.c
> +++ b/src/guestfs.c
> @@ -56,6 +56,14 @@
>  #include <sys/un.h>
>  #endif
>
> +#ifdef HAVE_NETINET_IN_H
> +#include <netinet/in.h>
> +#endif
> +
> +#ifdef HAVE_ARPA_INET_H
> +#include <arpa/inet.h>
> +#endif
...
> +static int
> +accept_from_daemon (guestfs_h *g)
> +{
> +  fd_set rset, rset2;
> +
> +  if (g->verbose)
> +    fprintf (stderr,
> +             "accept_from_daemon: %p g->state = %d\n", g, g->state);
> +
> +  FD_ZERO (&rset);
> +
> +  FD_SET (g->fd[1], &rset);     /* Read qemu stdout for log messages & EOF. */
> +  FD_SET (g->sock, &rset);      /* Read socket for accept. */
> +
> +  int max_fd = g->sock > g->fd[1] ? g->sock : g->fd[1];

easier to read like this:

     int max_fd = MAX (g->sock, g->fd[1]);

> +  int sock = -1;
> +
> +  while (sock == -1) {
> +    rset2 = rset;
> +    int r = select (max_fd+1, &rset2, NULL, NULL, NULL);
...




More information about the Libguestfs mailing list