qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 10/14] qemu-char:pty insert poll call into read one


From: Juan Quintela
Subject: [Qemu-devel] [PATCH 10/14] qemu-char:pty insert poll call into read one
Date: Wed, 10 Mar 2010 11:03:24 +0100

This way we can remove the poll test

Signed-off-by: Juan Quintela <address@hidden>
---
 qemu-char.c |   16 +++++-----------
 1 files changed, 5 insertions(+), 11 deletions(-)

diff --git a/qemu-char.c b/qemu-char.c
index 875f254..bc294af 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -833,15 +833,6 @@ static int pty_chr_write(CharDriverState *chr, const 
uint8_t *buf, int len)
     return send_all(s->fd, buf, len);
 }

-static int pty_chr_read_poll(void *opaque)
-{
-    CharDriverState *chr = opaque;
-    PtyCharDriver *s = chr->opaque;
-
-    s->read_bytes = qemu_chr_can_read(chr);
-    return s->read_bytes;
-}
-
 static void pty_chr_read(void *opaque)
 {
     CharDriverState *chr = opaque;
@@ -849,6 +840,10 @@ static void pty_chr_read(void *opaque)
     int size, len;
     uint8_t buf[READ_BUF_LEN];

+    s->read_bytes = qemu_chr_can_read(chr);
+
+    if (s->read_bytes <= 0)
+        return;
     len = sizeof(buf);
     if (len > s->read_bytes)
         len = s->read_bytes;
@@ -870,8 +865,7 @@ static void pty_chr_update_read_handler(CharDriverState 
*chr)
 {
     PtyCharDriver *s = chr->opaque;

-    qemu_set_fd_handler2(s->fd, pty_chr_read_poll,
-                         pty_chr_read, NULL, chr);
+    qemu_set_fd_handler(s->fd, pty_chr_read, NULL, chr);
     s->polling = 1;
     /*
      * Short timeout here: just need wait long enougth that qemu makes
-- 
1.6.6.1





reply via email to

[Prev in Thread] Current Thread [Next in Thread]