Patchwork [11/14] qemu-char:udp insert poll call into read one

login
register
mail settings
Submitter Juan Quintela
Date March 10, 2010, 10:03 a.m.
Message ID <ed89d23354e7c0b4f512f82f783f80179038ade3.1268214633.git.quintela@redhat.com>
Download mbox | patch
Permalink /patch/47223/
State New
Headers show

Comments

Juan Quintela - March 10, 2010, 10:03 a.m.
This way we can remove the poll test

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 qemu-char.c |   13 ++-----------
 1 files changed, 2 insertions(+), 11 deletions(-)

Patch

diff --git a/qemu-char.c b/qemu-char.c
index bc294af..9098d79 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -1767,7 +1767,7 @@  static int udp_chr_write(CharDriverState *chr, const uint8_t *buf, int len)
     return send(s->fd, (const void *)buf, len, 0);
 }

-static int udp_chr_read_poll(void *opaque)
+static void udp_chr_read(void *opaque)
 {
     CharDriverState *chr = opaque;
     NetCharDriver *s = chr->opaque;
@@ -1782,14 +1782,6 @@  static int udp_chr_read_poll(void *opaque)
         s->bufptr++;
         s->max_size = qemu_chr_can_read(chr);
     }
-    return s->max_size;
-}
-
-static void udp_chr_read(void *opaque)
-{
-    CharDriverState *chr = opaque;
-    NetCharDriver *s = chr->opaque;
-
     if (s->max_size == 0)
         return;
     s->bufcnt = recv(s->fd, (void *)s->buf, sizeof(s->buf), 0);
@@ -1810,8 +1802,7 @@  static void udp_chr_update_read_handler(CharDriverState *chr)
     NetCharDriver *s = chr->opaque;

     if (s->fd >= 0) {
-        qemu_set_fd_handler2(s->fd, udp_chr_read_poll,
-                             udp_chr_read, NULL, chr);
+        qemu_set_fd_handler(s->fd, udp_chr_read, NULL, chr);
     }
 }