Commit bf9298b90eee0b95cab11fc74790dcbddca4252e

Authored by aliguori
1 parent a38131b6

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 <aliguori@us.ibm.com>



git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5889 c046a42c-6fe2-441c-8c8c-71466251a162
configure
@@ -1017,6 +1017,17 @@ EOF @@ -1017,6 +1017,17 @@ EOF
1017 fi 1017 fi
1018 fi 1018 fi
1019 1019
  1020 +##########################################
  1021 +# iovec probe
  1022 +cat > $TMPC <<EOF
  1023 +#include <sys/uio.h>
  1024 +int main(void) { struct iovec iov; return 0; }
  1025 +EOF
  1026 +iovec=no
  1027 +if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
  1028 + iovec=yes
  1029 +fi
  1030 +
1020 # Check if tools are available to build documentation. 1031 # Check if tools are available to build documentation.
1021 if [ -x "`which texi2html 2>/dev/null`" ] && \ 1032 if [ -x "`which texi2html 2>/dev/null`" ] && \
1022 [ -x "`which pod2man 2>/dev/null`" ]; then 1033 [ -x "`which pod2man 2>/dev/null`" ]; then
@@ -1376,6 +1387,9 @@ fi @@ -1376,6 +1387,9 @@ fi
1376 if test "$blobs" = "yes" ; then 1387 if test "$blobs" = "yes" ; then
1377 echo "INSTALL_BLOBS=yes" >> $config_mak 1388 echo "INSTALL_BLOBS=yes" >> $config_mak
1378 fi 1389 fi
  1390 +if test "$iovec" = "yes" ; then
  1391 + echo "#define HAVE_IOVEC 1" >> $config_h
  1392 +fi
1379 1393
1380 # XXX: suppress that 1394 # XXX: suppress that
1381 if [ "$bsd" = "yes" ] ; then 1395 if [ "$bsd" = "yes" ] ; then
hw/virtio.h
@@ -17,15 +17,6 @@ @@ -17,15 +17,6 @@
17 #include "hw.h" 17 #include "hw.h"
18 #include "pci.h" 18 #include "pci.h"
19 19
20 -#ifdef _WIN32  
21 -struct iovec {  
22 - void *iov_base;  
23 - size_t iov_len;  
24 -};  
25 -#else  
26 -#include <sys/uio.h>  
27 -#endif  
28 -  
29 /* from Linux's linux/virtio_config.h */ 20 /* from Linux's linux/virtio_config.h */
30 21
31 /* Status byte for guest to report progress, and synchronize features. */ 22 /* Status byte for guest to report progress, and synchronize features. */
qemu-common.h
@@ -16,6 +16,7 @@ @@ -16,6 +16,7 @@
16 #include <unistd.h> 16 #include <unistd.h>
17 #include <fcntl.h> 17 #include <fcntl.h>
18 #include <sys/stat.h> 18 #include <sys/stat.h>
  19 +#include "config-host.h"
19 20
20 #ifndef O_LARGEFILE 21 #ifndef O_LARGEFILE
21 #define O_LARGEFILE 0 22 #define O_LARGEFILE 0
@@ -28,6 +29,14 @@ @@ -28,6 +29,14 @@
28 #define ENOMEDIUM ENODEV 29 #define ENOMEDIUM ENODEV
29 #endif 30 #endif
30 31
  32 +#ifndef HAVE_IOVEC
  33 +#define HAVE_IOVEC
  34 +struct iovec {
  35 + void *iov_base;
  36 + size_t iov_len;
  37 +};
  38 +#endif
  39 +
31 #ifdef _WIN32 40 #ifdef _WIN32
32 #define WIN32_LEAN_AND_MEAN 41 #define WIN32_LEAN_AND_MEAN
33 #define WINVER 0x0501 /* needed for ipv6 bits */ 42 #define WINVER 0x0501 /* needed for ipv6 bits */
@@ -54,7 +63,6 @@ static inline char *realpath(const char *path, char *resolved_path) @@ -54,7 +63,6 @@ static inline char *realpath(const char *path, char *resolved_path)
54 /* FIXME: Remove NEED_CPU_H. */ 63 /* FIXME: Remove NEED_CPU_H. */
55 #ifndef NEED_CPU_H 64 #ifndef NEED_CPU_H
56 65
57 -#include "config-host.h"  
58 #include <setjmp.h> 66 #include <setjmp.h>
59 #include "osdep.h" 67 #include "osdep.h"
60 #include "bswap.h" 68 #include "bswap.h"
slirp/socket.c
@@ -11,6 +11,7 @@ @@ -11,6 +11,7 @@
11 #ifdef __sun__ 11 #ifdef __sun__
12 #include <sys/filio.h> 12 #include <sys/filio.h>
13 #endif 13 #endif
  14 +#include "qemu-common.h"
14 15
15 static void sofcantrcvmore(struct socket *so); 16 static void sofcantrcvmore(struct socket *so);
16 static void sofcantsendmore(struct socket *so); 17 static void sofcantsendmore(struct socket *so);
slirp/socket.h
@@ -73,14 +73,6 @@ struct socket { @@ -73,14 +73,6 @@ struct socket {
73 73
74 extern struct socket tcb; 74 extern struct socket tcb;
75 75
76 -  
77 -#if defined(DECLARE_IOVEC) && !defined(HAVE_READV)  
78 -struct iovec {  
79 - char *iov_base;  
80 - size_t iov_len;  
81 -};  
82 -#endif  
83 -  
84 struct socket * solookup _P((struct socket *, struct in_addr, u_int, struct in_addr, u_int)); 76 struct socket * solookup _P((struct socket *, struct in_addr, u_int, struct in_addr, u_int));
85 struct socket * socreate _P((void)); 77 struct socket * socreate _P((void));
86 void sofree _P((struct socket *)); 78 void sofree _P((struct socket *));