From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54977) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wx9cS-0001zR-Id for qemu-devel@nongnu.org; Wed, 18 Jun 2014 02:45:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wx9cJ-0003PE-Hz for qemu-devel@nongnu.org; Wed, 18 Jun 2014 02:45:16 -0400 Received: from mail-wi0-x231.google.com ([2a00:1450:400c:c05::231]:50155) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wx9cJ-0003O3-By for qemu-devel@nongnu.org; Wed, 18 Jun 2014 02:45:07 -0400 Received: by mail-wi0-f177.google.com with SMTP id r20so510890wiv.4 for ; Tue, 17 Jun 2014 23:45:06 -0700 (PDT) Sender: Paolo Bonzini From: Paolo Bonzini Date: Wed, 18 Jun 2014 08:43:57 +0200 Message-Id: <1403073840-32603-34-git-send-email-pbonzini@redhat.com> In-Reply-To: <1403073840-32603-1-git-send-email-pbonzini@redhat.com> References: <1403073840-32603-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PATCH 2.1 33/36] qemu-char: move pty_chr_update_read_handler around List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: wenchaoqemu@gmail.com, lcapitulino@redhat.com Reviewed-by: Fam Zheng Signed-off-by: Paolo Bonzini --- qemu-char.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/qemu-char.c b/qemu-char.c index 26994aa..9470ea2 100644 --- a/qemu-char.c +++ b/qemu-char.c @@ -1055,6 +1055,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; @@ -1107,22 +1123,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