]> git.proxmox.com Git - mirror_qemu.git/commitdiff
hw/char/spapr_vty: Return amount of free buffer entries in vty_can_receive()
authorThomas Huth <thuth@redhat.com>
Fri, 18 Nov 2016 09:09:37 +0000 (10:09 +0100)
committerDavid Gibson <david@gibson.dropbear.id.au>
Wed, 23 Nov 2016 01:00:48 +0000 (12:00 +1100)
The can_receive() callbacks of the character devices should return
the amount of characters that can be accepted at once, not just a
boolean value (which rather means only one character at a time).

Signed-off-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
hw/char/spapr_vty.c

index 06b9b3917f6ff8ba34f112f15f8f5fbfb124e1da..7c22b8bd0e905f9f35189c7b1d2ad08a3b068193 100644 (file)
@@ -25,7 +25,7 @@ static int vty_can_receive(void *opaque)
 {
     VIOsPAPRVTYDevice *dev = VIO_SPAPR_VTY_DEVICE(opaque);
 
-    return (dev->in - dev->out) < VTERM_BUFSIZE;
+    return VTERM_BUFSIZE - (dev->in - dev->out);
 }
 
 static void vty_receive(void *opaque, const uint8_t *buf, int size)