diff options
author | Amit Shah <amit.shah@redhat.com> | 2012-09-25 00:05:15 +0530 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2012-09-28 12:16:27 +0200 |
commit | 0d8d7690850eb0cf2b2b60933cf47669a6b6f18f (patch) | |
tree | ab991cfc0a7b72f27ad4e2e927605e240d353114 /hw/virtio.h | |
parent | 385ce95d9d060f20870402c8b2b503d0b6ab8af0 (diff) | |
download | hqemu-0d8d7690850eb0cf2b2b60933cf47669a6b6f18f.zip hqemu-0d8d7690850eb0cf2b2b60933cf47669a6b6f18f.tar.gz |
virtio: Introduce virtqueue_get_avail_bytes()
The current virtqueue_avail_bytes() is oddly named, and checks if a
particular number of bytes are available in a vq. A better API is to
fetch the number of bytes available in the vq, and let the caller do
what's interesting with the numbers.
Introduce virtqueue_get_avail_bytes(), which returns the number of bytes
for buffers marked for both, in as well as out. virtqueue_avail_bytes()
is made a wrapper over this new function.
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw/virtio.h')
-rw-r--r-- | hw/virtio.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/hw/virtio.h b/hw/virtio.h index 7a4f564..80de375 100644 --- a/hw/virtio.h +++ b/hw/virtio.h @@ -147,7 +147,10 @@ void virtqueue_fill(VirtQueue *vq, const VirtQueueElement *elem, void virtqueue_map_sg(struct iovec *sg, target_phys_addr_t *addr, size_t num_sg, int is_write); int virtqueue_pop(VirtQueue *vq, VirtQueueElement *elem); -int virtqueue_avail_bytes(VirtQueue *vq, int in_bytes, int out_bytes); +int virtqueue_avail_bytes(VirtQueue *vq, unsigned int in_bytes, + unsigned int out_bytes); +void virtqueue_get_avail_bytes(VirtQueue *vq, unsigned int *in_bytes, + unsigned int *out_bytes); void virtio_notify(VirtIODevice *vdev, VirtQueue *vq); |