[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[qemu-s390x] [PATCH v3 11/25] xen: Let xencons_send() take a 'size' argu
From: |
Philippe Mathieu-Daudé |
Subject: |
[qemu-s390x] [PATCH v3 11/25] xen: Let xencons_send() take a 'size' argument |
Date: |
Wed, 20 Feb 2019 02:02:18 +0100 |
The single caller of xencons_send(), con_event() already use the
difference 'con->buffer.size - con->buffer.consumed'.
Deduplicate by passing the difference as an argument.
Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
---
hw/char/xen_console.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/hw/char/xen_console.c b/hw/char/xen_console.c
index 91f34ef06c..083b2c8e2a 100644
--- a/hw/char/xen_console.c
+++ b/hw/char/xen_console.c
@@ -144,11 +144,10 @@ static void xencons_receive(void *opaque, const uint8_t
*buf, int len)
xen_pv_send_notify(&con->xendev);
}
-static void xencons_send(struct XenConsole *con)
+static void xencons_send(struct XenConsole *con, ssize_t size)
{
- ssize_t len, size;
+ ssize_t len;
- size = con->buffer.size - con->buffer.consumed;
if (qemu_chr_fe_backend_connected(&con->chr)) {
len = qemu_chr_fe_write(&con->chr,
con->buffer.data + con->buffer.consumed,
@@ -280,10 +279,13 @@ static void con_disconnect(struct XenLegacyDevice *xendev)
static void con_event(struct XenLegacyDevice *xendev)
{
struct XenConsole *con = container_of(xendev, struct XenConsole, xendev);
+ ssize_t size;
buffer_append(con);
- if (con->buffer.size - con->buffer.consumed)
- xencons_send(con);
+ size = con->buffer.size - con->buffer.consumed;
+ if (size) {
+ xencons_send(con, size);
+ }
}
/* -------------------------------------------------------------------- */
--
2.20.1
- [qemu-s390x] [PATCH v3 14/25] virtio-serial: Let VirtIOSerialPortClass::have_data() use size_t, (continued)
- [qemu-s390x] [PATCH v3 14/25] virtio-serial: Let VirtIOSerialPortClass::have_data() use size_t, Philippe Mathieu-Daudé, 2019/02/19
- [qemu-s390x] [PATCH v3 09/25] vhost-user: Express sizeof with size_t, Philippe Mathieu-Daudé, 2019/02/19
- [qemu-s390x] [PATCH v3 07/25] gdbstub: Let put_buffer() use size_t, Philippe Mathieu-Daudé, 2019/02/19
- [qemu-s390x] [PATCH v3 06/25] gdbstub: Use size_t to hold GDBState::last_packet_len, Philippe Mathieu-Daudé, 2019/02/19
- [qemu-s390x] [RFC PATCH v3 13/25] xen: Let buffer_append() return a size_t, Philippe Mathieu-Daudé, 2019/02/19
- [qemu-s390x] [PATCH v3 11/25] xen: Let xencons_send() take a 'size' argument,
Philippe Mathieu-Daudé <=
- [qemu-s390x] [PATCH v3 08/25] ui/gtk: Remove pointless cast, Philippe Mathieu-Daudé, 2019/02/19
- [qemu-s390x] [PATCH v3 05/25] gdbstub: Use size_t for strlen() return value, Philippe Mathieu-Daudé, 2019/02/19
- [qemu-s390x] [PATCH v3 03/25] chardev/wctablet: Use unsigned type to hold unsigned value, Philippe Mathieu-Daudé, 2019/02/19
- [qemu-s390x] [PATCH v3 02/25] chardev: Assert IOCanReadHandler can not be negative, Philippe Mathieu-Daudé, 2019/02/19