]> git.proxmox.com Git - qemu.git/commitdiff
Make struct iovec universally available
authoraliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162>
Fri, 5 Dec 2008 20:05:26 +0000 (20:05 +0000)
committeraliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162>
Fri, 5 Dec 2008 20:05:26 +0000 (20:05 +0000)
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 <aliguori@us.ibm.com>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5889 c046a42c-6fe2-441c-8c8c-71466251a162

configure
hw/virtio.h
qemu-common.h
slirp/socket.c
slirp/socket.h

index 7f827866060ff81f39ffb65dcad3fd1f34a3dfc4..938a53f1def34318638e377e03329681d95a4996 100755 (executable)
--- a/configure
+++ b/configure
@@ -1017,6 +1017,17 @@ EOF
   fi
 fi
 
+##########################################
+# iovec probe
+cat > $TMPC <<EOF
+#include <sys/uio.h>
+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
index 0aa3b09c4fed3fc1cc92114c7820b24d28ab7a3d..83511e2cb0a279f9e65551ed1926c66b18599025 100644 (file)
 #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. */
index 308847a21d08c4627dc4b040dc0a82360a5c59e1..e1546c671b465dbe2cb29e9e07b742a3532dff4f 100644 (file)
@@ -16,6 +16,7 @@
 #include <unistd.h>
 #include <fcntl.h>
 #include <sys/stat.h>
+#include "config-host.h"
 
 #ifndef O_LARGEFILE
 #define O_LARGEFILE 0
 #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 <setjmp.h>
 #include "osdep.h"
 #include "bswap.h"
index 7bc0dc5f325a97aa6f61d3554ec18deff51ec993..75f98fd40b17f3c74a3df3894ba196661397d4b1 100644 (file)
@@ -11,6 +11,7 @@
 #ifdef __sun__
 #include <sys/filio.h>
 #endif
+#include "qemu-common.h"
 
 static void sofcantrcvmore(struct socket *so);
 static void sofcantsendmore(struct socket *so);
index 94fb8d8cf209bca26da696a35c2106624ce6cf59..5edea90c9388c1062a079c4f5b58c51af4edd50e 100644 (file)
@@ -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 *));