From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:41178) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R7Aps-0006bi-0d for qemu-devel@nongnu.org; Fri, 23 Sep 2011 14:50:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R7Apq-0000NP-S2 for qemu-devel@nongnu.org; Fri, 23 Sep 2011 14:50:55 -0400 Received: from e3.ny.us.ibm.com ([32.97.182.143]:39788) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R7Apq-0000NE-PV for qemu-devel@nongnu.org; Fri, 23 Sep 2011 14:50:54 -0400 Received: from /spool/local by us.ibm.com with XMail ESMTP for from ; Fri, 23 Sep 2011 14:50:53 -0400 Received: from d01av03.pok.ibm.com (d01av03.pok.ibm.com [9.56.224.217]) by d01relay07.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p8NIopsB3191016 for ; Fri, 23 Sep 2011 14:50:51 -0400 Received: from d01av03.pok.ibm.com (loopback [127.0.0.1]) by d01av03.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p8NIoo9N019508 for ; Fri, 23 Sep 2011 15:50:50 -0300 Message-ID: <4E7CD509.4020009@us.ibm.com> Date: Fri, 23 Sep 2011 13:50:49 -0500 From: Anthony Liguori MIME-Version: 1.0 References: <20110916211955.GA13940@amt.cnet> In-Reply-To: <20110916211955.GA13940@amt.cnet> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] qemu-char: use qemu_set_fd_handler/2 consistently List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Marcelo Tosatti Cc: qemu-devel@nongnu.org On 09/16/2011 04:19 PM, Marcelo Tosatti wrote: > > Now that qemu_set_fd_handler and qemu_set_fd_handler2 have different > implementations, one using qemu iohandlers and the other glib, it is not > safe to mix the two when inserting/deleting handlers. > > Fixes kvm-autotest. > > Signed-off-by: Marcelo Tosatti Applied. Thanks. Regards, Anthony Liguori > > diff --git a/qemu-char.c b/qemu-char.c > index c9e5c41..09d2309 100644 > --- a/qemu-char.c > +++ b/qemu-char.c > @@ -1881,7 +1881,7 @@ static void udp_chr_close(CharDriverState *chr) > { > NetCharDriver *s = chr->opaque; > if (s->fd>= 0) { > - qemu_set_fd_handler(s->fd, NULL, NULL, NULL); > + qemu_set_fd_handler2(s->fd, NULL, NULL, NULL, NULL); > closesocket(s->fd); > } > g_free(s); > @@ -2093,9 +2093,9 @@ static void tcp_chr_read(void *opaque) > /* connection closed */ > s->connected = 0; > if (s->listen_fd>= 0) { > - qemu_set_fd_handler(s->listen_fd, tcp_chr_accept, NULL, chr); > + qemu_set_fd_handler2(s->listen_fd, NULL, tcp_chr_accept, NULL, chr); > } > - qemu_set_fd_handler(s->fd, NULL, NULL, NULL); > + qemu_set_fd_handler2(s->fd, NULL, NULL, NULL, NULL); > closesocket(s->fd); > s->fd = -1; > qemu_chr_event(chr, CHR_EVENT_CLOSED); > @@ -2156,7 +2156,7 @@ static int tcp_chr_add_client(CharDriverState *chr, int fd) > if (s->do_nodelay) > socket_set_nodelay(fd); > s->fd = fd; > - qemu_set_fd_handler(s->listen_fd, NULL, NULL, NULL); > + qemu_set_fd_handler2(s->listen_fd, NULL, NULL, NULL, NULL); > tcp_chr_connect(chr); > > return 0; > @@ -2202,11 +2202,11 @@ static void tcp_chr_close(CharDriverState *chr) > { > TCPCharDriver *s = chr->opaque; > if (s->fd>= 0) { > - qemu_set_fd_handler(s->fd, NULL, NULL, NULL); > + qemu_set_fd_handler2(s->fd, NULL, NULL, NULL, NULL); > closesocket(s->fd); > } > if (s->listen_fd>= 0) { > - qemu_set_fd_handler(s->listen_fd, NULL, NULL, NULL); > + qemu_set_fd_handler2(s->listen_fd, NULL, NULL, NULL, NULL); > closesocket(s->listen_fd); > } > g_free(s); > @@ -2272,7 +2272,7 @@ static int qemu_chr_open_socket(QemuOpts *opts, CharDriverState **_chr) > > if (is_listen) { > s->listen_fd = fd; > - qemu_set_fd_handler(s->listen_fd, tcp_chr_accept, NULL, chr); > + qemu_set_fd_handler2(s->listen_fd, NULL, tcp_chr_accept, NULL, chr); > if (is_telnet) > s->do_telnetopt = 1; > > >