From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59318) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bsYFl-0007CA-5n for qemu-devel@nongnu.org; Fri, 07 Oct 2016 12:44:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bsYFg-00017N-5d for qemu-devel@nongnu.org; Fri, 07 Oct 2016 12:44:08 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:51263) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bsYFf-00016b-Sk for qemu-devel@nongnu.org; Fri, 07 Oct 2016 12:44:04 -0400 Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id u97Ghmlp044567 for ; Fri, 7 Oct 2016 12:44:03 -0400 Received: from e36.co.us.ibm.com (e36.co.us.ibm.com [32.97.110.154]) by mx0a-001b2d01.pphosted.com with ESMTP id 25xbu69r8h-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Fri, 07 Oct 2016 12:44:02 -0400 Received: from localhost by e36.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 7 Oct 2016 10:44:02 -0600 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Michael Roth In-Reply-To: <1475772018-27484-3-git-send-email-stefanha@redhat.com> References: <1475772018-27484-1-git-send-email-stefanha@redhat.com> <1475772018-27484-3-git-send-email-stefanha@redhat.com> Date: Fri, 07 Oct 2016 11:04:09 -0500 Message-Id: <20161007160409.9563.97704@loki> Subject: Re: [Qemu-devel] [PATCH 2/4] qga: drop unnecessary GA_CHANNEL_UNIX_LISTEN checks List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi , qemu-devel@nongnu.org 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 =3D=3D 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 Reviewed-by: Michael Roth > --- > 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 lis= ten_fd, bool create) > = > static void ga_channel_listen_close(GAChannel *c) > { > - g_assert(c->method =3D=3D 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 =3D NULL; > - if (c->method =3D=3D 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, con= st gchar *path, > = > void ga_channel_free(GAChannel *c) > { > - if (c->method =3D=3D GA_CHANNEL_UNIX_LISTEN > - && c->listen_channel) { > + if (c->listen_channel) { > ga_channel_listen_close(c); > } > if (c->client_channel) { > -- = > 2.7.4 >=20