From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43875) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WrrkO-00016M-Kw for qemu-devel@nongnu.org; Tue, 03 Jun 2014 12:39:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WrrkB-0007ZP-0B for qemu-devel@nongnu.org; Tue, 03 Jun 2014 12:39:36 -0400 Received: from mail-we0-x230.google.com ([2a00:1450:400c:c03::230]:58635) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WrrkA-0007Xs-Pr for qemu-devel@nongnu.org; Tue, 03 Jun 2014 12:39:22 -0400 Received: by mail-we0-f176.google.com with SMTP id q59so7193189wes.35 for ; Tue, 03 Jun 2014 09:39:22 -0700 (PDT) Sender: Paolo Bonzini From: Paolo Bonzini Date: Tue, 3 Jun 2014 18:39:08 +0200 Message-Id: <1401813551-6667-4-git-send-email-pbonzini@redhat.com> In-Reply-To: <1401813551-6667-1-git-send-email-pbonzini@redhat.com> References: <1401813551-6667-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PATCH 3/6] 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: kwolf@redhat.com, famz@redhat.com, kraxel@redhat.com, stefanha@redhat.com, lcapitulino@redhat.com 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 2bda2fb..b478a3d 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.8.3.1