From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([209.51.188.92]:41085) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gwGQZ-00052t-90 for qemu-devel@nongnu.org; Tue, 19 Feb 2019 20:12:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gwGN0-0003ps-4C for qemu-devel@nongnu.org; Tue, 19 Feb 2019 20:08:22 -0500 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Wed, 20 Feb 2019 02:02:21 +0100 Message-Id: <20190220010232.18731-15-philmd@redhat.com> In-Reply-To: <20190220010232.18731-1-philmd@redhat.com> References: <20190220010232.18731-1-philmd@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH v3 14/25] virtio-serial: Let VirtIOSerialPortClass::have_data() use size_t List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, Prasad J Pandit , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini Cc: Jason Wang , Anthony Perard , qemu-ppc@nongnu.org, Stefan Berger , David Gibson , Gerd Hoffmann , Zhang Chen , xen-devel@lists.xenproject.org, Cornelia Huck , Samuel Thibault , Christian Borntraeger , Amit Shah , Li Zhijian , Corey Minyard , "Michael S. Tsirkin" , Paul Durrant , Halil Pasic , Stefano Stabellini , qemu-s390x@nongnu.org, Pavel Dovgalyuk , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Both callers in hw/char/virtio-serial-bus.c provide unsigned values, even the trace event display an unsigned value. Convert the have_data() handler to take an unsigned value. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- It is funny/scary that there are big comments about how to treat errors to set the return value, then the return value is simply ignored by the caller. --- hw/char/virtio-console.c | 2 +- include/hw/virtio/virtio-serial.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/char/virtio-console.c b/hw/char/virtio-console.c index 2cbe1d4ed5..19639dca3b 100644 --- a/hw/char/virtio-console.c +++ b/hw/char/virtio-console.c @@ -45,7 +45,7 @@ static gboolean chr_write_unblocked(GIOChannel *chan, G= IOCondition cond, =20 /* Callback function that's called when the guest sends us data */ static ssize_t flush_buf(VirtIOSerialPort *port, - const uint8_t *buf, ssize_t len) + const uint8_t *buf, size_t len) { VirtConsole *vcon =3D VIRTIO_CONSOLE(port); ssize_t ret; diff --git a/include/hw/virtio/virtio-serial.h b/include/hw/virtio/virtio= -serial.h index 12657a9f39..f1a5ccf4f7 100644 --- a/include/hw/virtio/virtio-serial.h +++ b/include/hw/virtio/virtio-serial.h @@ -81,7 +81,7 @@ typedef struct VirtIOSerialPortClass { * 'len'. In this case, throttling will be enabled for this port. */ ssize_t (*have_data)(VirtIOSerialPort *port, const uint8_t *buf, - ssize_t len); + size_t len); } VirtIOSerialPortClass; =20 /* --=20 2.20.1