Commit bf9298b90eee0b95cab11fc74790dcbddca4252e
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
Showing
5 changed files
with
24 additions
and
18 deletions
configure
... | ... | @@ -1017,6 +1017,17 @@ EOF |
1017 | 1017 | fi |
1018 | 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 | 1031 | # Check if tools are available to build documentation. |
1021 | 1032 | if [ -x "`which texi2html 2>/dev/null`" ] && \ |
1022 | 1033 | [ -x "`which pod2man 2>/dev/null`" ]; then |
... | ... | @@ -1376,6 +1387,9 @@ fi |
1376 | 1387 | if test "$blobs" = "yes" ; then |
1377 | 1388 | echo "INSTALL_BLOBS=yes" >> $config_mak |
1378 | 1389 | fi |
1390 | +if test "$iovec" = "yes" ; then | |
1391 | + echo "#define HAVE_IOVEC 1" >> $config_h | |
1392 | +fi | |
1379 | 1393 | |
1380 | 1394 | # XXX: suppress that |
1381 | 1395 | if [ "$bsd" = "yes" ] ; then | ... | ... |
hw/virtio.h
... | ... | @@ -17,15 +17,6 @@ |
17 | 17 | #include "hw.h" |
18 | 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 | 20 | /* from Linux's linux/virtio_config.h */ |
30 | 21 | |
31 | 22 | /* Status byte for guest to report progress, and synchronize features. */ | ... | ... |
qemu-common.h
... | ... | @@ -16,6 +16,7 @@ |
16 | 16 | #include <unistd.h> |
17 | 17 | #include <fcntl.h> |
18 | 18 | #include <sys/stat.h> |
19 | +#include "config-host.h" | |
19 | 20 | |
20 | 21 | #ifndef O_LARGEFILE |
21 | 22 | #define O_LARGEFILE 0 |
... | ... | @@ -28,6 +29,14 @@ |
28 | 29 | #define ENOMEDIUM ENODEV |
29 | 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 | 40 | #ifdef _WIN32 |
32 | 41 | #define WIN32_LEAN_AND_MEAN |
33 | 42 | #define WINVER 0x0501 /* needed for ipv6 bits */ |
... | ... | @@ -54,7 +63,6 @@ static inline char *realpath(const char *path, char *resolved_path) |
54 | 63 | /* FIXME: Remove NEED_CPU_H. */ |
55 | 64 | #ifndef NEED_CPU_H |
56 | 65 | |
57 | -#include "config-host.h" | |
58 | 66 | #include <setjmp.h> |
59 | 67 | #include "osdep.h" |
60 | 68 | #include "bswap.h" | ... | ... |
slirp/socket.c
slirp/socket.h
... | ... | @@ -73,14 +73,6 @@ struct socket { |
73 | 73 | |
74 | 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 | 76 | struct socket * solookup _P((struct socket *, struct in_addr, u_int, struct in_addr, u_int)); |
85 | 77 | struct socket * socreate _P((void)); |
86 | 78 | void sofree _P((struct socket *)); | ... | ... |