Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1L8LkN-0000bl-9J for qemu-devel@nongnu.org; Thu, 04 Dec 2008 16:28:31 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1L8LkM-0000bO-JJ for qemu-devel@nongnu.org; Thu, 04 Dec 2008 16:28:31 -0500 Received: from [199.232.76.173] (port=59354 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L8LkM-0000bC-CS for qemu-devel@nongnu.org; Thu, 04 Dec 2008 16:28:30 -0500 Received: from savannah.gnu.org ([199.232.41.3]:47749 helo=sv.gnu.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1L8LkL-0004rY-Qv for qemu-devel@nongnu.org; Thu, 04 Dec 2008 16:28:30 -0500 Received: from cvs.savannah.gnu.org ([199.232.41.69]) by sv.gnu.org with esmtp (Exim 4.63) (envelope-from ) id 1L8LkL-0002ZN-6I for qemu-devel@nongnu.org; Thu, 04 Dec 2008 21:28:29 +0000 Received: from aliguori by cvs.savannah.gnu.org with local (Exim 4.63) (envelope-from ) id 1L8LkK-0002ZI-T6 for qemu-devel@nongnu.org; Thu, 04 Dec 2008 21:28:29 +0000 MIME-Version: 1.0 Errors-To: aliguori Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Anthony Liguori Message-Id: Date: Thu, 04 Dec 2008 21:28:28 +0000 Subject: [Qemu-devel] [5877] Fix windows build after virtio changes Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Revision: 5877 http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5877 Author: aliguori Date: 2008-12-04 21:28:28 +0000 (Thu, 04 Dec 2008) Log Message: ----------- Fix windows build after virtio changes Windows does not have sys/uio.h and does not have err.h. Signed-off-by: Anthony Liguori Modified Paths: -------------- trunk/hw/virtio.c trunk/hw/virtio.h Modified: trunk/hw/virtio.c =================================================================== --- trunk/hw/virtio.c 2008-12-04 20:57:02 UTC (rev 5876) +++ trunk/hw/virtio.c 2008-12-04 21:28:28 UTC (rev 5877) @@ -12,7 +12,6 @@ */ #include -#include #include "virtio.h" #include "sysemu.h" @@ -331,9 +330,11 @@ 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 @@ 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 @@ /* 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 @@ 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 @@ 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; Modified: trunk/hw/virtio.h =================================================================== --- trunk/hw/virtio.h 2008-12-04 20:57:02 UTC (rev 5876) +++ trunk/hw/virtio.h 2008-12-04 21:28:28 UTC (rev 5877) @@ -14,10 +14,18 @@ #ifndef _QEMU_VIRTIO_H #define _QEMU_VIRTIO_H -#include #include "hw.h" #include "pci.h" +#ifdef _WIN32 +struct iovec { + void *iov_base; + size_t iov_len; +}; +#else +#include +#endif + /* from Linux's linux/virtio_config.h */ /* Status byte for guest to report progress, and synchronize features. */