* [Qemu-devel] [5889] Make struct iovec universally available
@ 2008-12-05 20:05 Anthony Liguori
2008-12-06 10:30 ` Andreas Färber
0 siblings, 1 reply; 7+ messages in thread
From: Anthony Liguori @ 2008-12-05 20:05 UTC (permalink / raw)
To: qemu-devel
Revision: 5889
http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5889
Author: aliguori
Date: 2008-12-05 20:05:26 +0000 (Fri, 05 Dec 2008)
Log Message:
-----------
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>
Modified Paths:
--------------
trunk/configure
trunk/hw/virtio.h
trunk/qemu-common.h
trunk/slirp/socket.c
trunk/slirp/socket.h
Modified: trunk/configure
===================================================================
--- trunk/configure 2008-12-05 17:56:40 UTC (rev 5888)
+++ trunk/configure 2008-12-05 20:05:26 UTC (rev 5889)
@@ -1017,6 +1017,17 @@
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 @@
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
Modified: trunk/hw/virtio.h
===================================================================
--- trunk/hw/virtio.h 2008-12-05 17:56:40 UTC (rev 5888)
+++ trunk/hw/virtio.h 2008-12-05 20:05:26 UTC (rev 5889)
@@ -17,15 +17,6 @@
#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. */
Modified: trunk/qemu-common.h
===================================================================
--- trunk/qemu-common.h 2008-12-05 17:56:40 UTC (rev 5888)
+++ trunk/qemu-common.h 2008-12-05 20:05:26 UTC (rev 5889)
@@ -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
@@ -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 @@
/* FIXME: Remove NEED_CPU_H. */
#ifndef NEED_CPU_H
-#include "config-host.h"
#include <setjmp.h>
#include "osdep.h"
#include "bswap.h"
Modified: trunk/slirp/socket.c
===================================================================
--- trunk/slirp/socket.c 2008-12-05 17:56:40 UTC (rev 5888)
+++ trunk/slirp/socket.c 2008-12-05 20:05:26 UTC (rev 5889)
@@ -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);
Modified: trunk/slirp/socket.h
===================================================================
--- trunk/slirp/socket.h 2008-12-05 17:56:40 UTC (rev 5888)
+++ trunk/slirp/socket.h 2008-12-05 20:05:26 UTC (rev 5889)
@@ -73,14 +73,6 @@
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 *));
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [5889] Make struct iovec universally available
2008-12-05 20:05 [Qemu-devel] [5889] Make struct iovec universally available Anthony Liguori
@ 2008-12-06 10:30 ` Andreas Färber
2008-12-06 10:39 ` Andreas Färber
0 siblings, 1 reply; 7+ messages in thread
From: Andreas Färber @ 2008-12-06 10:30 UTC (permalink / raw)
To: qemu-devel
Am 05.12.2008 um 21:05 schrieb Anthony Liguori:
> Revision: 5889
> http://svn.sv.gnu.org/viewvc/?
> view=rev&root=qemu&revision=5889
> Author: aliguori
> Date: 2008-12-05 20:05:26 +0000 (Fri, 05 Dec 2008)
>
> Log Message:
> -----------
> 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>
> Modified: trunk/configure
> ===================================================================
> --- trunk/configure 2008-12-05 17:56:40 UTC (rev 5888)
> +++ trunk/configure 2008-12-05 20:05:26 UTC (rev 5889)
> @@ -1017,6 +1017,17 @@
> 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 @@
> 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
On Mac OS X v10.5 this test results in HAVE_IOVEC 1, but I get the
following compilation failure:
gcc -I. -I.. -I/Users/andreas/Q/qemu/target-i386 -I/Users/andreas/Q/
qemu -MMD -MT pc.o -MP -DNEED_CPU_H -D__powerpc__ -D_GNU_SOURCE -
D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -I/Users/andreas/Q/qemu/tcg -
I/Users/andreas/Q/qemu/tcg/ppc -I/Users/andreas/Q/qemu/fpu -DHAS_AUDIO
-DHAS_AUDIO_CHOICE -I/Users/andreas/Q/qemu/slirp -O2 -g -fno-strict-
aliasing -Wall -Wundef -Wendif-labels -Wwrite-strings -mdynamic-no-
pic -c -o pc.o /Users/andreas/Q/qemu/hw/pc.c
In file included from /Users/andreas/Q/qemu/hw/virtio-blk.h:17,
from /Users/andreas/Q/qemu/hw/pc.c:36:
/Users/andreas/Q/qemu/hw/virtio.h:67: error: array type has incomplete
element type
/Users/andreas/Q/qemu/hw/virtio.h:68: error: array type has incomplete
element type
/Users/andreas/Q/qemu/hw/pc.c: In function ‘pc_init1’:
/Users/andreas/Q/qemu/hw/pc.c:830: warning: large integer implicitly
truncated to unsigned type
make[1]: *** [pc.o] Error 1
make: *** [subdir-i386-softmmu] Error 2
It does not go away even if I #define HAVE_IOVEC 0 in config-host.h.
Any ideas?
Andreas
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [5889] Make struct iovec universally available
2008-12-06 10:30 ` Andreas Färber
@ 2008-12-06 10:39 ` Andreas Färber
2008-12-06 11:12 ` [Qemu-devel] [PATCH] struct iovec compilation fix Andreas Färber
0 siblings, 1 reply; 7+ messages in thread
From: Andreas Färber @ 2008-12-06 10:39 UTC (permalink / raw)
To: qemu-devel
Am 06.12.2008 um 11:30 schrieb Andreas Färber:
> On Mac OS X v10.5 this test results in HAVE_IOVEC 1, but I get the
> following compilation failure:
>
> gcc -I. -I.. -I/Users/andreas/Q/qemu/target-i386 -I/Users/andreas/Q/
> qemu -MMD -MT pc.o -MP -DNEED_CPU_H -D__powerpc__ -D_GNU_SOURCE -
> D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -I/Users/andreas/Q/qemu/
> tcg -I/Users/andreas/Q/qemu/tcg/ppc -I/Users/andreas/Q/qemu/fpu -
> DHAS_AUDIO -DHAS_AUDIO_CHOICE -I/Users/andreas/Q/qemu/slirp -O2 -g -
> fno-strict-aliasing -Wall -Wundef -Wendif-labels -Wwrite-strings -
> mdynamic-no-pic -c -o pc.o /Users/andreas/Q/qemu/hw/pc.c
> In file included from /Users/andreas/Q/qemu/hw/virtio-blk.h:17,
> from /Users/andreas/Q/qemu/hw/pc.c:36:
> /Users/andreas/Q/qemu/hw/virtio.h:67: error: array type has
> incomplete element type
> /Users/andreas/Q/qemu/hw/virtio.h:68: error: array type has
> incomplete element type
> /Users/andreas/Q/qemu/hw/pc.c: In function ‘pc_init1’:
> /Users/andreas/Q/qemu/hw/pc.c:830: warning: large integer implicitly
> truncated to unsigned type
> make[1]: *** [pc.o] Error 1
> make: *** [subdir-i386-softmmu] Error 2
>
> It does not go away even if I #define HAVE_IOVEC 0 in config-host.h.
Some more info:
Commenting the #define out leads to:
gcc -O2 -g -fno-strict-aliasing -Wall -Wundef -Wendif-labels -Wwrite-
strings -mdynamic-no-pic -I. -I/Users/andreas/Q/qemu -MMD -MP -MT
osdep.o -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -I/
Users/andreas/Q/qemu/slirp -c -o osdep.o osdep.c
In file included from qemu_socket.h:22,
from osdep.c:48:
/usr/include/sys/socket.h:128: error: redefinition of ‘struct iovec’
make: *** [osdep.o] Error 1
If I don't touch config-host.h (i.e., #define HAVE_IOVEC 1) and add
#include <sys/socket.h> in virtio.h, then it compiles okay.
Maybe include qemu-socket.h somewhere?
Andreas
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Qemu-devel] [PATCH] struct iovec compilation fix
2008-12-06 10:39 ` Andreas Färber
@ 2008-12-06 11:12 ` Andreas Färber
2008-12-06 19:53 ` Blue Swirl
0 siblings, 1 reply; 7+ messages in thread
From: Andreas Färber @ 2008-12-06 11:12 UTC (permalink / raw)
To: qemu-devel
The configure test for struct iovec #includes <sys/uio.h> but qemu-
common.h did not.
This fixes compilation of hw/virtio.h on Mac OS X.
Signed-off-by: Andreas Faerber <andreas.faerber@web.de>
---
diff --git a/qemu-common.h b/qemu-common.h
index e1546c6..cb5d465 100644
--- a/qemu-common.h
+++ b/qemu-common.h
@@ -35,6 +35,8 @@ struct iovec {
void *iov_base;
size_t iov_len;
};
+#else
+#include <sys/uio.h>
#endif
#ifdef _WIN32
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH] struct iovec compilation fix
2008-12-06 11:12 ` [Qemu-devel] [PATCH] struct iovec compilation fix Andreas Färber
@ 2008-12-06 19:53 ` Blue Swirl
2008-12-06 20:07 ` Andreas Färber
0 siblings, 1 reply; 7+ messages in thread
From: Blue Swirl @ 2008-12-06 19:53 UTC (permalink / raw)
To: qemu-devel
On 12/6/08, Andreas Färber <andreas.faerber@web.de> wrote:
> The configure test for struct iovec #includes <sys/uio.h> but qemu-common.h
> did not.
>
> This fixes compilation of hw/virtio.h on Mac OS X.
>
> Signed-off-by: Andreas Faerber <andreas.faerber@web.de>
Thanks, applied.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH] struct iovec compilation fix
2008-12-06 19:53 ` Blue Swirl
@ 2008-12-06 20:07 ` Andreas Färber
2008-12-06 20:20 ` Blue Swirl
0 siblings, 1 reply; 7+ messages in thread
From: Andreas Färber @ 2008-12-06 20:07 UTC (permalink / raw)
To: Blue Swirl; +Cc: qemu-devel
Am 06.12.2008 um 20:53 schrieb Blue Swirl:
> On 12/6/08, Andreas Färber <andreas.faerber@web.de> wrote:
>> The configure test for struct iovec #includes <sys/uio.h> but qemu-
>> common.h
>> did not.
>>
>> This fixes compilation of hw/virtio.h on Mac OS X.
>>
>> Signed-off-by: Andreas Faerber <andreas.faerber@web.de>
>
> Thanks, applied.
Thanks, Blue.
You're making me wonder, isn't actually the subject line (following
"[PATCH]") of a Git-style patch supposed to be part of (i.e., the
first line of) the SVN commit message? Or is that a misunderstanding
on my part? Noticed that for r5885ff as well.
Andreas
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH] struct iovec compilation fix
2008-12-06 20:07 ` Andreas Färber
@ 2008-12-06 20:20 ` Blue Swirl
0 siblings, 0 replies; 7+ messages in thread
From: Blue Swirl @ 2008-12-06 20:20 UTC (permalink / raw)
To: Andreas Färber; +Cc: qemu-devel
On 12/6/08, Andreas Färber <andreas.faerber@web.de> wrote:
>
> Am 06.12.2008 um 20:53 schrieb Blue Swirl:
>
>
>
> > On 12/6/08, Andreas Färber <andreas.faerber@web.de> wrote:
> >
> > > The configure test for struct iovec #includes <sys/uio.h> but
> qemu-common.h
> > > did not.
> > >
> > > This fixes compilation of hw/virtio.h on Mac OS X.
> > >
> > > Signed-off-by: Andreas Faerber <andreas.faerber@web.de>
> > >
> >
> > Thanks, applied.
> >
>
> Thanks, Blue.
>
> You're making me wonder, isn't actually the subject line (following
> "[PATCH]") of a Git-style patch supposed to be part of (i.e., the first line
> of) the SVN commit message? Or is that a misunderstanding on my part?
> Noticed that for r5885ff as well.
I don't know. Sometimes the subject does not tell much or there is a
lot of extra garbage. Not in this case, though.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2008-12-06 20:20 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-05 20:05 [Qemu-devel] [5889] Make struct iovec universally available Anthony Liguori
2008-12-06 10:30 ` Andreas Färber
2008-12-06 10:39 ` Andreas Färber
2008-12-06 11:12 ` [Qemu-devel] [PATCH] struct iovec compilation fix Andreas Färber
2008-12-06 19:53 ` Blue Swirl
2008-12-06 20:07 ` Andreas Färber
2008-12-06 20:20 ` Blue Swirl
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).