diff options
author | Anthony Liguori <aliguori@us.ibm.com> | 2011-02-01 15:20:56 -0600 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2011-02-01 15:20:56 -0600 |
commit | e54b7f5256659dddaf6b5c021847859829d7ebd7 (patch) | |
tree | 057500b5289eee6a538374547321e1977650240b /hw/virtio-serial.h | |
parent | 1cd20f8bf0ecb9d1d1bd5e2ffab3b88835380c9b (diff) | |
parent | 37f95bf3d063fcfcb3b05f82203629dc50f18615 (diff) |
Merge remote branch 'amit/for-anthony' into staging
Diffstat (limited to 'hw/virtio-serial.h')
-rw-r--r-- | hw/virtio-serial.h | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/hw/virtio-serial.h b/hw/virtio-serial.h index ff08c40681..a308196786 100644 --- a/hw/virtio-serial.h +++ b/hw/virtio-serial.h @@ -102,6 +102,23 @@ struct VirtIOSerialPort { */ uint32_t id; + /* + * This is the elem that we pop from the virtqueue. A slow + * backend that consumes guest data (e.g. the file backend for + * qemu chardevs) can cause the guest to block till all the output + * is flushed. This isn't desired, so we keep a note of the last + * element popped and continue consuming it once the backend + * becomes writable again. + */ + VirtQueueElement elem; + + /* + * The index and the offset into the iov buffer that was popped in + * elem above. + */ + uint32_t iov_idx; + uint64_t iov_offset; + /* Identify if this is a port that binds with hvc in the guest */ uint8_t is_console; @@ -137,10 +154,11 @@ struct VirtIOSerialPortInfo { /* * Guest wrote some data to the port. This data is handed over to - * the app via this callback. The app is supposed to consume all - * the data that is presented to it. + * the app via this callback. The app can return a size less than + * 'len'. In this case, throttling will be enabled for this port. */ - void (*have_data)(VirtIOSerialPort *port, const uint8_t *buf, size_t len); + ssize_t (*have_data)(VirtIOSerialPort *port, const uint8_t *buf, + size_t len); }; /* Interface to the virtio-serial bus */ |