From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52476) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wz7FJ-00043W-7i for qemu-devel@nongnu.org; Mon, 23 Jun 2014 12:37:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wz7FB-000450-Oj for qemu-devel@nongnu.org; Mon, 23 Jun 2014 12:37:29 -0400 Received: from mx1.redhat.com ([209.132.183.28]:31038) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wz7FB-00044h-8b for qemu-devel@nongnu.org; Mon, 23 Jun 2014 12:37:21 -0400 From: Luiz Capitulino Date: Mon, 23 Jun 2014 12:36:40 -0400 Message-Id: <1403541403-16468-41-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1403541403-16468-1-git-send-email-lcapitulino@redhat.com> References: <1403541403-16468-1-git-send-email-lcapitulino@redhat.com> Subject: [Qemu-devel] [PULL 40/43] qemu-char: move pty_chr_update_read_handler around List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: peter.maydell@linaro.org Cc: qemu-devel@nongnu.org, anthony@codemonkey.ws From: Paolo Bonzini Reviewed-by: Fam Zheng Signed-off-by: Paolo Bonzini Signed-off-by: Luiz Capitulino --- qemu-char.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/qemu-char.c b/qemu-char.c index 28ea9f2..9961b02 100644 --- a/qemu-char.c +++ b/qemu-char.c @@ -1101,6 +1101,22 @@ static void pty_chr_rearm_timer(CharDriverState *chr, int ms) } } +static void pty_chr_update_read_handler(CharDriverState *chr) +{ + PtyCharDriver *s = chr->opaque; + GPollFD pfd; + + pfd.fd = g_io_channel_unix_get_fd(s->fd); + pfd.events = G_IO_OUT; + pfd.revents = 0; + g_poll(&pfd, 1, 0); + if (pfd.revents & G_IO_HUP) { + pty_chr_state(chr, 0); + } else { + pty_chr_state(chr, 1); + } +} + static int pty_chr_write(CharDriverState *chr, const uint8_t *buf, int len) { PtyCharDriver *s = chr->opaque; @@ -1153,22 +1169,6 @@ static gboolean pty_chr_read(GIOChannel *chan, GIOCondition cond, void *opaque) return TRUE; } -static void pty_chr_update_read_handler(CharDriverState *chr) -{ - PtyCharDriver *s = chr->opaque; - GPollFD pfd; - - pfd.fd = g_io_channel_unix_get_fd(s->fd); - pfd.events = G_IO_OUT; - pfd.revents = 0; - g_poll(&pfd, 1, 0); - if (pfd.revents & G_IO_HUP) { - pty_chr_state(chr, 0); - } else { - pty_chr_state(chr, 1); - } -} - static void pty_chr_state(CharDriverState *chr, int connected) { PtyCharDriver *s = chr->opaque; -- 1.9.3