From bf9298b90eee0b95cab11fc74790dcbddca4252e Mon Sep 17 00:00:00 2001 From: aliguori Date: Fri, 5 Dec 2008 20:05:26 +0000 Subject: [PATCH] Make struct iovec universally available Vectored IO APIs will require some sort of vector argument. It makes sense to use struct iovec and just define it globally for Windows. Signed-off-by: Anthony Liguori git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5889 c046a42c-6fe2-441c-8c8c-71466251a162 --- configure | 14 ++++++++++++++ hw/virtio.h | 9 --------- qemu-common.h | 10 +++++++++- slirp/socket.c | 1 + slirp/socket.h | 8 -------- 5 files changed, 24 insertions(+), 18 deletions(-) diff --git a/configure b/configure index 7f82786..938a53f 100755 --- a/configure +++ b/configure @@ -1017,6 +1017,17 @@ EOF fi fi +########################################## +# iovec probe +cat > $TMPC < +int main(void) { struct iovec iov; return 0; } +EOF +iovec=no +if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then + iovec=yes +fi + # Check if tools are available to build documentation. if [ -x "`which texi2html 2>/dev/null`" ] && \ [ -x "`which pod2man 2>/dev/null`" ]; then @@ -1376,6 +1387,9 @@ fi if test "$blobs" = "yes" ; then echo "INSTALL_BLOBS=yes" >> $config_mak fi +if test "$iovec" = "yes" ; then + echo "#define HAVE_IOVEC 1" >> $config_h +fi # XXX: suppress that if [ "$bsd" = "yes" ] ; then diff --git a/hw/virtio.h b/hw/virtio.h index 0aa3b09..83511e2 100644 --- a/hw/virtio.h +++ b/hw/virtio.h @@ -17,15 +17,6 @@ #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. */ diff --git a/qemu-common.h b/qemu-common.h index 308847a..e1546c6 100644 --- a/qemu-common.h +++ b/qemu-common.h @@ -16,6 +16,7 @@ #include #include #include +#include "config-host.h" #ifndef O_LARGEFILE #define O_LARGEFILE 0 @@ -28,6 +29,14 @@ #define ENOMEDIUM ENODEV #endif +#ifndef HAVE_IOVEC +#define HAVE_IOVEC +struct iovec { + void *iov_base; + size_t iov_len; +}; +#endif + #ifdef _WIN32 #define WIN32_LEAN_AND_MEAN #define WINVER 0x0501 /* needed for ipv6 bits */ @@ -54,7 +63,6 @@ static inline char *realpath(const char *path, char *resolved_path) /* FIXME: Remove NEED_CPU_H. */ #ifndef NEED_CPU_H -#include "config-host.h" #include #include "osdep.h" #include "bswap.h" diff --git a/slirp/socket.c b/slirp/socket.c index 7bc0dc5..75f98fd 100644 --- a/slirp/socket.c +++ b/slirp/socket.c @@ -11,6 +11,7 @@ #ifdef __sun__ #include #endif +#include "qemu-common.h" static void sofcantrcvmore(struct socket *so); static void sofcantsendmore(struct socket *so); diff --git a/slirp/socket.h b/slirp/socket.h index 94fb8d8..5edea90 100644 --- a/slirp/socket.h +++ b/slirp/socket.h @@ -73,14 +73,6 @@ struct socket { extern struct socket tcb; - -#if defined(DECLARE_IOVEC) && !defined(HAVE_READV) -struct iovec { - char *iov_base; - size_t iov_len; -}; -#endif - struct socket * solookup _P((struct socket *, struct in_addr, u_int, struct in_addr, u_int)); struct socket * socreate _P((void)); void sofree _P((struct socket *)); -- 1.7.9.5