All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Roth <mdroth@linux.vnet.ibm.com>
To: Stefan Hajnoczi <stefanha@redhat.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 2/4] qga: drop unnecessary GA_CHANNEL_UNIX_LISTEN checks
Date: Fri, 07 Oct 2016 11:04:09 -0500	[thread overview]
Message-ID: <20161007160409.9563.97704@loki> (raw)
In-Reply-To: <1475772018-27484-3-git-send-email-stefanha@redhat.com>

Quoting Stefan Hajnoczi (2016-10-06 11:40:16)
> Throughout the code there are c->listen_channel checks which manage the
> listen socket file descriptor (waiting for accept(2), closing the file
> descriptor, etc).  These checks are currently preceded by explicit
> c->method == GA_CHANNEL_UNIX_LISTEN checks.
> 
> Explicit GA_CHANNEL_UNIX_LISTEN checks are not necessary since serial
> channel types do not create the listen channel (c->listen_channel).
> 
> As more listen channel types are added, explicitly checking all of them
> becomes messy.  Rely on c->listen_channel to determine whether or not a
> listen socket file descriptor is used.
> 
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>

Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com>

> ---
>  qga/channel-posix.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/qga/channel-posix.c b/qga/channel-posix.c
> index bf32158..579891d 100644
> --- a/qga/channel-posix.c
> +++ b/qga/channel-posix.c
> @@ -61,7 +61,6 @@ static void ga_channel_listen_add(GAChannel *c, int listen_fd, bool create)
> 
>  static void ga_channel_listen_close(GAChannel *c)
>  {
> -    g_assert(c->method == GA_CHANNEL_UNIX_LISTEN);
>      g_assert(c->listen_channel);
>      g_io_channel_shutdown(c->listen_channel, true, NULL);
>      g_io_channel_unref(c->listen_channel);
> @@ -77,7 +76,7 @@ static void ga_channel_client_close(GAChannel *c)
>      g_io_channel_shutdown(c->client_channel, true, NULL);
>      g_io_channel_unref(c->client_channel);
>      c->client_channel = NULL;
> -    if (c->method == GA_CHANNEL_UNIX_LISTEN && c->listen_channel) {
> +    if (c->listen_channel) {
>          ga_channel_listen_add(c, 0, false);
>      }
>  }
> @@ -255,8 +254,7 @@ GAChannel *ga_channel_new(GAChannelMethod method, const gchar *path,
> 
>  void ga_channel_free(GAChannel *c)
>  {
> -    if (c->method == GA_CHANNEL_UNIX_LISTEN
> -        && c->listen_channel) {
> +    if (c->listen_channel) {
>          ga_channel_listen_close(c);
>      }
>      if (c->client_channel) {
> -- 
> 2.7.4
> 

  reply	other threads:[~2016-10-07 16:44 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-06 16:40 [Qemu-devel] [PATCH 0/4] qga: add vsock-listen Stefan Hajnoczi
2016-10-06 16:40 ` [Qemu-devel] [PATCH 1/4] qga: drop unused sockaddr in accept(2) call Stefan Hajnoczi
2016-10-07 16:01   ` Michael Roth
2016-10-06 16:40 ` [Qemu-devel] [PATCH 2/4] qga: drop unnecessary GA_CHANNEL_UNIX_LISTEN checks Stefan Hajnoczi
2016-10-07 16:04   ` Michael Roth [this message]
2016-10-06 16:40 ` [Qemu-devel] [PATCH 3/4] sockets: add AF_VSOCK support Stefan Hajnoczi
2016-10-06 18:14   ` Eric Blake
2016-10-07 12:21     ` Stefan Hajnoczi
2016-10-07 16:42   ` Michael Roth
2016-10-12 15:06     ` Stefan Hajnoczi
2016-10-13 20:20       ` Michael Roth
2016-10-06 16:40 ` [Qemu-devel] [PATCH 4/4] qga: add vsock-listen method Stefan Hajnoczi
2016-10-07 17:07   ` Michael Roth
2016-10-12 15:07     ` Stefan Hajnoczi
2016-10-13 20:29       ` Michael Roth

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161007160409.9563.97704@loki \
    --to=mdroth@linux.vnet.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.