diff options
author | aliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162> | 2008-12-04 21:28:28 +0000 |
---|---|---|
committer | aliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162> | 2008-12-04 21:28:28 +0000 |
commit | bb6834cfae238e342da966557d7d24423efe18ab (patch) | |
tree | 1b93a79d3f218f9d7d67ca47f074c4db2078804a /hw | |
parent | d34ca5901630dca45f105bbe1a80b51fbb8c4284 (diff) | |
download | qemu-bb6834cfae238e342da966557d7d24423efe18ab.zip |
Fix windows build after virtio changes
Windows does not have sys/uio.h and does not have err.h.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5877 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'hw')
-rw-r--r-- | hw/virtio.c | 39 | ||||
-rw-r--r-- | hw/virtio.h | 10 |
2 files changed, 34 insertions, 15 deletions
diff --git a/hw/virtio.c b/hw/virtio.c index 4135a97fdc..bfa6a40ac8 100644 --- a/hw/virtio.c +++ b/hw/virtio.c @@ -12,7 +12,6 @@ */ #include <inttypes.h> -#include <err.h> #include "virtio.h" #include "sysemu.h" @@ -331,9 +330,11 @@ static int virtqueue_num_heads(VirtQueue *vq, unsigned int idx) uint16_t num_heads = vring_avail_idx(vq) - idx; /* Check it isn't doing very strange things with descriptor numbers. */ - if (num_heads > vq->vring.num) - errx(1, "Guest moved used index from %u to %u", - idx, vring_avail_idx(vq)); + if (num_heads > vq->vring.num) { + fprintf(stderr, "Guest moved used index from %u to %u", + idx, vring_avail_idx(vq)); + exit(1); + } return num_heads; } @@ -347,8 +348,10 @@ static unsigned int virtqueue_get_head(VirtQueue *vq, unsigned int idx) head = vring_avail_ring(vq, idx % vq->vring.num); /* If their number is silly, that's a fatal mistake. */ - if (head >= vq->vring.num) - errx(1, "Guest says index %u is available", head); + if (head >= vq->vring.num) { + fprintf(stderr, "Guest says index %u is available", head); + exit(1); + } return head; } @@ -366,8 +369,10 @@ static unsigned virtqueue_next_desc(VirtQueue *vq, unsigned int i) /* Make sure compiler knows to grab that: we don't want it changing! */ wmb(); - if (next >= vq->vring.num) - errx(1, "Desc next is %u", next); + if (next >= vq->vring.num) { + fprintf(stderr, "Desc next is %u", next); + exit(1); + } return next; } @@ -386,8 +391,10 @@ int virtqueue_avail_bytes(VirtQueue *vq, int in_bytes, int out_bytes) i = virtqueue_get_head(vq, idx++); do { /* If we've got too many, that implies a descriptor loop. */ - if (++num_bufs > vq->vring.num) - errx(1, "Looped descriptor"); + if (++num_bufs > vq->vring.num) { + fprintf(stderr, "Looped descriptor"); + exit(1); + } if (vring_desc_flags(vq, i) & VRING_DESC_F_WRITE) { if (in_bytes > 0 && @@ -447,12 +454,16 @@ int virtqueue_pop(VirtQueue *vq, VirtQueueElement *elem) sg->iov_len); } #endif - if (sg->iov_base == NULL) - errx(1, "Invalid mapping\n"); + if (sg->iov_base == NULL) { + fprintf(stderr, "Invalid mapping\n"); + exit(1); + } /* If we've got too many, that implies a descriptor loop. */ - if ((elem->in_num + elem->out_num) > vq->vring.num) - errx(1, "Looped descriptor"); + if ((elem->in_num + elem->out_num) > vq->vring.num) { + fprintf(stderr, "Looped descriptor"); + exit(1); + } } while ((i = virtqueue_next_desc(vq, i)) != vq->vring.num); elem->index = head; diff --git a/hw/virtio.h b/hw/virtio.h index 8c9cbaf63e..0aa3b09c4f 100644 --- a/hw/virtio.h +++ b/hw/virtio.h @@ -14,10 +14,18 @@ #ifndef _QEMU_VIRTIO_H #define _QEMU_VIRTIO_H -#include <sys/uio.h> #include "hw.h" #include "pci.h" +#ifdef _WIN32 +struct iovec { + void *iov_base; + size_t iov_len; +}; +#else +#include <sys/uio.h> +#endif + /* from Linux's linux/virtio_config.h */ /* Status byte for guest to report progress, and synchronize features. */ |