Message ID | 20190220010232.18731-15-philmd@redhat.com |
---|---|
State | New |
Headers | show |
Series | chardev: Convert qemu_chr_write() to take a size_t argument | expand |
On Wed, Feb 20, 2019 at 2:06 AM Philippe Mathieu-Daudé <philmd@redhat.com> 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é <philmd@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> > --- > 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 >
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; /*
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é <philmd@redhat.com> --- 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(-)