[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 3/6] qemu-char: move pty_chr_update_read_handler
From: |
Fam Zheng |
Subject: |
Re: [Qemu-devel] [PATCH 3/6] qemu-char: move pty_chr_update_read_handler around |
Date: |
Wed, 11 Jun 2014 14:32:11 +0800 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
On Tue, 06/03 18:39, Paolo Bonzini wrote:
> Signed-off-by: Paolo Bonzini <address@hidden>
Reviewed-by: Fam Zheng <address@hidden>
> ---
> 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
>
>
- [Qemu-devel] [PATCH 0/5] qemu-char/monitor: make monitor_puts thread safe, Paolo Bonzini, 2014/06/03
- [Qemu-devel] [PATCH 1/6] qemu-char: introduce qemu_chr_alloc, Paolo Bonzini, 2014/06/03
- [Qemu-devel] [PATCH 2/6] qemu-char: do not call chr_write directly, Paolo Bonzini, 2014/06/03
- [Qemu-devel] [PATCH 3/6] qemu-char: move pty_chr_update_read_handler around, Paolo Bonzini, 2014/06/03
- Re: [Qemu-devel] [PATCH 3/6] qemu-char: move pty_chr_update_read_handler around,
Fam Zheng <=
- [Qemu-devel] [PATCH 6/6] monitor: protect event emission, Paolo Bonzini, 2014/06/03
- [Qemu-devel] [PATCH 5/6] monitor: protect outbuf with mutex, Paolo Bonzini, 2014/06/03
- [Qemu-devel] [PATCH 4/6] qemu-char: make writes thread-safe, Paolo Bonzini, 2014/06/03
- Re: [Qemu-devel] [PATCH 0/5] qemu-char/monitor: make monitor_puts thread safe, Stefan Hajnoczi, 2014/06/27