qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] w32: Fix compilation of new code
@ 2011-03-31 20:58 Stefan Weil
  2011-04-01  7:04 ` [Qemu-devel] " Paolo Bonzini
  2011-04-03  9:10 ` Blue Swirl
  0 siblings, 2 replies; 7+ messages in thread
From: Stefan Weil @ 2011-03-31 20:58 UTC (permalink / raw)
  To: Blue Swirl; +Cc: Anthony Liguori, QEMU Developers, Paolo Bonzini

Some recently added new code did not compile for w32 targets.

The functions qemu_iohandler_fill and qemu_iohandler_poll need
data type fd_set which is declared in winsock2.h for w32 targets.

Moving the functions from qemu-common.h to qemu_socket.h fixes
compilations for w32 without adding a new include file to qemu-common.h.

Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
---
 iohandler.c   |    1 +
 qemu-common.h |    3 ---
 qemu_socket.h |    4 ++++
 3 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/iohandler.c b/iohandler.c
index 2b82421..bf1ba5c 100644
--- a/iohandler.c
+++ b/iohandler.c
@@ -26,6 +26,7 @@
 #include "qemu-common.h"
 #include "qemu-char.h"
 #include "qemu-queue.h"
+#include "qemu_socket.h"
 
 #ifndef _WIN32
 #include <sys/wait.h>
diff --git a/qemu-common.h b/qemu-common.h
index 8ecb488..eb2c96a 100644
--- a/qemu-common.h
+++ b/qemu-common.h
@@ -228,9 +228,6 @@ typedef void IOReadHandler(void *opaque, const uint8_t *buf, int size);
 typedef int IOCanReadHandler(void *opaque);
 typedef void IOHandler(void *opaque);
 
-void qemu_iohandler_fill(int *pnfds, fd_set *readfds, fd_set *writefds, fd_set *xfds);
-void qemu_iohandler_poll(fd_set *readfds, fd_set *writefds, fd_set *xfds, int rc);
-
 struct ParallelIOArg {
     void *buffer;
     int count;
diff --git a/qemu_socket.h b/qemu_socket.h
index 180e4db..4a6ef82 100644
--- a/qemu_socket.h
+++ b/qemu_socket.h
@@ -32,6 +32,10 @@ int inet_aton(const char *cp, struct in_addr *ia);
 
 #include "qemu-option.h"
 
+/* Functions from iohandler.c. */
+void qemu_iohandler_fill(int *pnfds, fd_set *readfds, fd_set *writefds, fd_set *xfds);
+void qemu_iohandler_poll(fd_set *readfds, fd_set *writefds, fd_set *xfds, int rc);
+
 /* misc helpers */
 int qemu_socket(int domain, int type, int protocol);
 int qemu_accept(int s, struct sockaddr *addr, socklen_t *addrlen);
-- 
1.7.2.5

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [Qemu-devel] Re: [PATCH] w32: Fix compilation of new code
  2011-03-31 20:58 [Qemu-devel] [PATCH] w32: Fix compilation of new code Stefan Weil
@ 2011-04-01  7:04 ` Paolo Bonzini
  2011-04-03  9:10 ` Blue Swirl
  1 sibling, 0 replies; 7+ messages in thread
From: Paolo Bonzini @ 2011-04-01  7:04 UTC (permalink / raw)
  To: Stefan Weil; +Cc: Blue Swirl, Anthony Liguori, QEMU Developers

On 03/31/2011 10:58 PM, Stefan Weil wrote:
> Some recently added new code did not compile for w32 targets.
>
> The functions qemu_iohandler_fill and qemu_iohandler_poll need
> data type fd_set which is declared in winsock2.h for w32 targets.
>
> Moving the functions from qemu-common.h to qemu_socket.h fixes
> compilations for w32 without adding a new include file to qemu-common.h.
>
> Cc: Paolo Bonzini<pbonzini@redhat.com>
> Cc: Anthony Liguori<aliguori@us.ibm.com>
> Signed-off-by: Stefan Weil<weil@mail.berlios.de>
> ---
>   iohandler.c   |    1 +
>   qemu-common.h |    3 ---
>   qemu_socket.h |    4 ++++
>   3 files changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/iohandler.c b/iohandler.c
> index 2b82421..bf1ba5c 100644
> --- a/iohandler.c
> +++ b/iohandler.c
> @@ -26,6 +26,7 @@
>   #include "qemu-common.h"
>   #include "qemu-char.h"
>   #include "qemu-queue.h"
> +#include "qemu_socket.h"
>
>   #ifndef _WIN32
>   #include<sys/wait.h>
> diff --git a/qemu-common.h b/qemu-common.h
> index 8ecb488..eb2c96a 100644
> --- a/qemu-common.h
> +++ b/qemu-common.h
> @@ -228,9 +228,6 @@ typedef void IOReadHandler(void *opaque, const uint8_t *buf, int size);
>   typedef int IOCanReadHandler(void *opaque);
>   typedef void IOHandler(void *opaque);
>
> -void qemu_iohandler_fill(int *pnfds, fd_set *readfds, fd_set *writefds, fd_set *xfds);
> -void qemu_iohandler_poll(fd_set *readfds, fd_set *writefds, fd_set *xfds, int rc);
> -
>   struct ParallelIOArg {
>       void *buffer;
>       int count;
> diff --git a/qemu_socket.h b/qemu_socket.h
> index 180e4db..4a6ef82 100644
> --- a/qemu_socket.h
> +++ b/qemu_socket.h
> @@ -32,6 +32,10 @@ int inet_aton(const char *cp, struct in_addr *ia);
>
>   #include "qemu-option.h"
>
> +/* Functions from iohandler.c. */
> +void qemu_iohandler_fill(int *pnfds, fd_set *readfds, fd_set *writefds, fd_set *xfds);
> +void qemu_iohandler_poll(fd_set *readfds, fd_set *writefds, fd_set *xfds, int rc);
> +
>   /* misc helpers */
>   int qemu_socket(int domain, int type, int protocol);
>   int qemu_accept(int s, struct sockaddr *addr, socklen_t *addrlen);

Acked-by: Paolo Bonzini <pbonzini@redhat.com>

Paolo

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Qemu-devel] Re: [PATCH] w32: Fix compilation of new code
  2011-03-31 20:58 [Qemu-devel] [PATCH] w32: Fix compilation of new code Stefan Weil
  2011-04-01  7:04 ` [Qemu-devel] " Paolo Bonzini
@ 2011-04-03  9:10 ` Blue Swirl
  2011-04-03  9:41   ` Stefan Weil
  2011-04-08 19:49   ` Stefan Weil
  1 sibling, 2 replies; 7+ messages in thread
From: Blue Swirl @ 2011-04-03  9:10 UTC (permalink / raw)
  To: Stefan Weil; +Cc: Paolo Bonzini, Anthony Liguori, QEMU Developers

On Thu, Mar 31, 2011 at 11:58 PM, Stefan Weil <weil@mail.berlios.de> wrote:
> Some recently added new code did not compile for w32 targets.
>
> The functions qemu_iohandler_fill and qemu_iohandler_poll need
> data type fd_set which is declared in winsock2.h for w32 targets.
>
> Moving the functions from qemu-common.h to qemu_socket.h fixes
> compilations for w32 without adding a new include file to qemu-common.h.

There's nothing socket specific in qemu_iohandler_fill and
qemu_iohandler_poll, so I'd rather fix qemu-common.h. But I have a
patch in my working queue to move OS specific stuff to qemu-common.h,
I'll fix this there.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Qemu-devel] Re: [PATCH] w32: Fix compilation of new code
  2011-04-03  9:10 ` Blue Swirl
@ 2011-04-03  9:41   ` Stefan Weil
  2011-04-03 10:05     ` Blue Swirl
  2011-04-08 19:49   ` Stefan Weil
  1 sibling, 1 reply; 7+ messages in thread
From: Stefan Weil @ 2011-04-03  9:41 UTC (permalink / raw)
  To: Blue Swirl; +Cc: Paolo Bonzini, QEMU Developers

Am 03.04.2011 11:10, schrieb Blue Swirl:
> On Thu, Mar 31, 2011 at 11:58 PM, Stefan Weil <weil@mail.berlios.de> 
> wrote:
>> Some recently added new code did not compile for w32 targets.
>>
>> The functions qemu_iohandler_fill and qemu_iohandler_poll need
>> data type fd_set which is declared in winsock2.h for w32 targets.
>>
>> Moving the functions from qemu-common.h to qemu_socket.h fixes
>> compilations for w32 without adding a new include file to qemu-common.h.
>
> There's nothing socket specific in qemu_iohandler_fill and
> qemu_iohandler_poll, so I'd rather fix qemu-common.h. But I have a
> patch in my working queue to move OS specific stuff to qemu-common.h,
> I'll fix this there.


Adding a new file iohandler.h for these functions would also solve the 
problem.
Or maybe there is an include file which is better suited than qemu_socket.h.

I think that functions which are only used in one file and declared
in another file should not be in qemu-common.h. In this special case,
all code which uses qemu-common.h would also require winsock2.h
just because of fd_set!

By the way: there is one file qemu_*.h, and there are 25 files qemu-*.h.
What about renaming qemu_socket.h to qemu-socket.h?

Kind regards,
Stefan

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Qemu-devel] Re: [PATCH] w32: Fix compilation of new code
  2011-04-03  9:41   ` Stefan Weil
@ 2011-04-03 10:05     ` Blue Swirl
  0 siblings, 0 replies; 7+ messages in thread
From: Blue Swirl @ 2011-04-03 10:05 UTC (permalink / raw)
  To: Stefan Weil; +Cc: Paolo Bonzini, QEMU Developers

On Sun, Apr 3, 2011 at 12:41 PM, Stefan Weil <weil@mail.berlios.de> wrote:
> Am 03.04.2011 11:10, schrieb Blue Swirl:
>>
>> On Thu, Mar 31, 2011 at 11:58 PM, Stefan Weil <weil@mail.berlios.de>
>> wrote:
>>>
>>> Some recently added new code did not compile for w32 targets.
>>>
>>> The functions qemu_iohandler_fill and qemu_iohandler_poll need
>>> data type fd_set which is declared in winsock2.h for w32 targets.
>>>
>>> Moving the functions from qemu-common.h to qemu_socket.h fixes
>>> compilations for w32 without adding a new include file to qemu-common.h.
>>
>> There's nothing socket specific in qemu_iohandler_fill and
>> qemu_iohandler_poll, so I'd rather fix qemu-common.h. But I have a
>> patch in my working queue to move OS specific stuff to qemu-common.h,
>> I'll fix this there.
>
>
> Adding a new file iohandler.h for these functions would also solve the
> problem.
> Or maybe there is an include file which is better suited than qemu_socket.h.
>
> I think that functions which are only used in one file and declared
> in another file should not be in qemu-common.h. In this special case,
> all code which uses qemu-common.h would also require winsock2.h
> just because of fd_set!

There are a lot of include directives already in qemu-common.h. I see
qemu-common.h as a library of useful stuff that may be used anywhere
in QEMU. The opposite approach is to sprinkle all .c files with
specific set of include directives for just that file.

> By the way: there is one file qemu_*.h, and there are 25 files qemu-*.h.
> What about renaming qemu_socket.h to qemu-socket.h?

There are a lot of files in both conventions.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Qemu-devel] Re: [PATCH] w32: Fix compilation of new code
  2011-04-03  9:10 ` Blue Swirl
  2011-04-03  9:41   ` Stefan Weil
@ 2011-04-08 19:49   ` Stefan Weil
  2011-04-08 20:18     ` Blue Swirl
  1 sibling, 1 reply; 7+ messages in thread
From: Stefan Weil @ 2011-04-08 19:49 UTC (permalink / raw)
  To: Blue Swirl; +Cc: Paolo Bonzini, Anthony Liguori, QEMU Developers

Am 03.04.2011 11:10, schrieb Blue Swirl:
> On Thu, Mar 31, 2011 at 11:58 PM, Stefan Weil <weil@mail.berlios.de> 
> wrote:
>> Some recently added new code did not compile for w32 targets.
>>
>> The functions qemu_iohandler_fill and qemu_iohandler_poll need
>> data type fd_set which is declared in winsock2.h for w32 targets.
>>
>> Moving the functions from qemu-common.h to qemu_socket.h fixes
>> compilations for w32 without adding a new include file to qemu-common.h.
>
> There's nothing socket specific in qemu_iohandler_fill and
> qemu_iohandler_poll, so I'd rather fix qemu-common.h. But I have a
> patch in my working queue to move OS specific stuff to qemu-common.h,
> I'll fix this there.


Should I send a patch for qemu-common.h? This would need inclusion
of winsock2.h for windows and fixing a conflict with json-lexer.c
(which uses an enum value named ERROR)?

w32 builds are now broken for more than a week (since 2011-03-29,
commit 0298141998ea3e19fd86b5a7122aab2fd1ebad51).

Best regards,
Stefan

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Qemu-devel] Re: [PATCH] w32: Fix compilation of new code
  2011-04-08 19:49   ` Stefan Weil
@ 2011-04-08 20:18     ` Blue Swirl
  0 siblings, 0 replies; 7+ messages in thread
From: Blue Swirl @ 2011-04-08 20:18 UTC (permalink / raw)
  To: Stefan Weil; +Cc: Paolo Bonzini, Anthony Liguori, QEMU Developers

On Fri, Apr 8, 2011 at 10:49 PM, Stefan Weil <weil@mail.berlios.de> wrote:
> Am 03.04.2011 11:10, schrieb Blue Swirl:
>>
>> On Thu, Mar 31, 2011 at 11:58 PM, Stefan Weil <weil@mail.berlios.de>
>> wrote:
>>>
>>> Some recently added new code did not compile for w32 targets.
>>>
>>> The functions qemu_iohandler_fill and qemu_iohandler_poll need
>>> data type fd_set which is declared in winsock2.h for w32 targets.
>>>
>>> Moving the functions from qemu-common.h to qemu_socket.h fixes
>>> compilations for w32 without adding a new include file to qemu-common.h.
>>
>> There's nothing socket specific in qemu_iohandler_fill and
>> qemu_iohandler_poll, so I'd rather fix qemu-common.h. But I have a
>> patch in my working queue to move OS specific stuff to qemu-common.h,
>> I'll fix this there.
>
>
> Should I send a patch for qemu-common.h? This would need inclusion
> of winsock2.h for windows and fixing a conflict with json-lexer.c
> (which uses an enum value named ERROR)?

I have a fix for that also in my tree. I'll send a new set of patches,
the first trivial ones should be OK to commit.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-04-08 20:19 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-31 20:58 [Qemu-devel] [PATCH] w32: Fix compilation of new code Stefan Weil
2011-04-01  7:04 ` [Qemu-devel] " Paolo Bonzini
2011-04-03  9:10 ` Blue Swirl
2011-04-03  9:41   ` Stefan Weil
2011-04-03 10:05     ` Blue Swirl
2011-04-08 19:49   ` Stefan Weil
2011-04-08 20:18     ` 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).