Skip to contentSkip to conversation

char: Flush read buffer in mux_chr_can_read

PATCH RESEND New Jan Kiszka 1 participant 1 message Jun 2, 2010

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

PATCH RESEND 1/1 char: Flush read buffer in mux_chr_can_read

From: Jan Kiszka <[email protected]>

Move the buffer flush from mux_chr_read to mux_chr_can_read. While the latter is called periodically, the former will only be invoked when new characters arrive at the back-end. This caused problems to front-end drivers whenever they were unable to read data immediately, e.g. virtio-console attached to stdio.

---

While this may not solve all problems on s390, it does improve the muxed virtio console for x86 guest and still looks correct to me.

 qemu-char.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
qemu-char.c +2 -2
index faaf624..00ded76 100644
@@ -404,6 +404,8 @@ static int mux_chr_can_read(void *opaque)
     MuxDriver *d = chr->opaque;
     int m = d->focus;
 
+    mux_chr_accept_input(opaque);
+
     if ((d->prod[m] - d->cons[m]) < MUX_BUFFER_SIZE)
         return 1;
     if (d->chr_can_read[m])
@@ -418,8 +420,6 @@ static void mux_chr_read(void *opaque, const uint8_t *buf, int size)
     int m = d->focus;
     int i;
 
-    mux_chr_accept_input (opaque);
-
     for(i = 0; i < size; i++)
         if (mux_proc_byte(chr, d, buf[i])) {
             if (d->prod[m] == d->cons[m] &&
Signature · 1 line
1.6.0.2