qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v3 14/25] virtio-serial: Let VirtIOSerialPortCla


From: Marc-André Lureau
Subject: Re: [Qemu-devel] [PATCH v3 14/25] virtio-serial: Let VirtIOSerialPortClass::have_data() use size_t
Date: Wed, 20 Feb 2019 12:21:32 +0100

On Wed, Feb 20, 2019 at 2:06 AM Philippe Mathieu-Daudé
<address@hidden> wrote:
>
> 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é <address@hidden>


Reviewed-by: Marc-André Lureau <address@hidden>

> ---
> 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.

have_data() return value? yes, the code may have change and the
comment doesn't seem to reflect accurately what's going on.

> ---
>  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, 
> GIOCondition cond,
>
>  /* 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 = 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;
>
>  /*
> --
> 2.20.1
>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]