All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] qemu-ga: Make guest-network-get-interfaces Linux only
@ 2012-03-20 15:09 Michal Privoznik
  2012-03-20 16:10 ` Michael Roth
  2012-03-21  0:54 ` [Qemu-devel] [PATCH] qemu-ga: stub out guest-suspend* for non-linux Michael Roth
  0 siblings, 2 replies; 14+ messages in thread
From: Michal Privoznik @ 2012-03-20 15:09 UTC (permalink / raw)
  To: qemu-devel

Currently, the implementation of that command is full of
Linux specific code. Before any brave man will step into
and port it to other OSes, make this function Linux only.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
 qga/commands-posix.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/qga/commands-posix.c b/qga/commands-posix.c
index 7b2be2f..89dde92 100644
--- a/qga/commands-posix.c
+++ b/qga/commands-posix.c
@@ -729,6 +729,7 @@ void qmp_guest_suspend_hybrid(Error **err)
     guest_suspend("pm-suspend-hybrid", NULL, err);
 }
 
+#if defined(__linux__)
 static GuestNetworkInterfaceList *
 guest_find_interface(GuestNetworkInterfaceList *head,
                      const char *name)
@@ -904,6 +905,16 @@ error:
     return NULL;
 }
 
+#else /* defined(linux) */
+
+GuestNetworkInterfaceList *qmp_guest_network_get_interfaces(Error **err)
+{
+    error_set(err, QERR_UNSUPPORTED);
+    return NULL;
+}
+
+#endif /* defined(linux) */
+
 /* register init/cleanup routines for stateful command groups */
 void ga_command_state_init(GAState *s, GACommandState *cs)
 {
-- 
1.7.8.5

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

* Re: [Qemu-devel] [PATCH] qemu-ga: Make guest-network-get-interfaces Linux only
  2012-03-20 15:09 [Qemu-devel] [PATCH] qemu-ga: Make guest-network-get-interfaces Linux only Michal Privoznik
@ 2012-03-20 16:10 ` Michael Roth
  2012-03-20 16:16   ` Michal Privoznik
  2012-03-26 16:35   ` Andreas Färber
  2012-03-21  0:54 ` [Qemu-devel] [PATCH] qemu-ga: stub out guest-suspend* for non-linux Michael Roth
  1 sibling, 2 replies; 14+ messages in thread
From: Michael Roth @ 2012-03-20 16:10 UTC (permalink / raw)
  To: Michal Privoznik; +Cc: qemu-devel

On Tue, Mar 20, 2012 at 04:09:53PM +0100, Michal Privoznik wrote:
> Currently, the implementation of that command is full of
> Linux specific code. Before any brave man will step into
> and port it to other OSes, make this function Linux only.
> 
> Signed-off-by: Michal Privoznik <mprivozn@redhat.com>

Which aspect is linux-specific? getifaddrs() and getnameinfo() seem to
be available on BSD and OpenSolaris, and we're already stubbed for w32.
Are you seeing breakage?

> ---
>  qga/commands-posix.c |   11 +++++++++++
>  1 files changed, 11 insertions(+), 0 deletions(-)
> 
> diff --git a/qga/commands-posix.c b/qga/commands-posix.c
> index 7b2be2f..89dde92 100644
> --- a/qga/commands-posix.c
> +++ b/qga/commands-posix.c
> @@ -729,6 +729,7 @@ void qmp_guest_suspend_hybrid(Error **err)
>      guest_suspend("pm-suspend-hybrid", NULL, err);
>  }
> 
> +#if defined(__linux__)
>  static GuestNetworkInterfaceList *
>  guest_find_interface(GuestNetworkInterfaceList *head,
>                       const char *name)
> @@ -904,6 +905,16 @@ error:
>      return NULL;
>  }
> 
> +#else /* defined(linux) */
> +
> +GuestNetworkInterfaceList *qmp_guest_network_get_interfaces(Error **err)
> +{
> +    error_set(err, QERR_UNSUPPORTED);
> +    return NULL;
> +}
> +
> +#endif /* defined(linux) */
> +
>  /* register init/cleanup routines for stateful command groups */
>  void ga_command_state_init(GAState *s, GACommandState *cs)
>  {
> -- 
> 1.7.8.5
> 
> 

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

* Re: [Qemu-devel] [PATCH] qemu-ga: Make guest-network-get-interfaces Linux only
  2012-03-20 16:10 ` Michael Roth
@ 2012-03-20 16:16   ` Michal Privoznik
  2012-03-20 18:19     ` Michael Roth
  2012-03-26 16:35   ` Andreas Färber
  1 sibling, 1 reply; 14+ messages in thread
From: Michal Privoznik @ 2012-03-20 16:16 UTC (permalink / raw)
  To: Michael Roth; +Cc: qemu-devel

On 20.03.2012 17:10, Michael Roth wrote:
> On Tue, Mar 20, 2012 at 04:09:53PM +0100, Michal Privoznik wrote:
>> Currently, the implementation of that command is full of
>> Linux specific code. Before any brave man will step into
>> and port it to other OSes, make this function Linux only.
>>
>> Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
> 
> Which aspect is linux-specific? getifaddrs() and getnameinfo() seem to
> be available on BSD and OpenSolaris, and we're already stubbed for w32.
> Are you seeing breakage?

Personally, I don't; but there has been this report:

http://lists.nongnu.org/archive/html/qemu-devel/2012-03/msg03951.html

which happens on OpenBSD, I suspect.

Michal

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

* Re: [Qemu-devel] [PATCH] qemu-ga: Make guest-network-get-interfaces Linux only
  2012-03-20 16:16   ` Michal Privoznik
@ 2012-03-20 18:19     ` Michael Roth
  2012-03-21  0:47       ` Michael Roth
  0 siblings, 1 reply; 14+ messages in thread
From: Michael Roth @ 2012-03-20 18:19 UTC (permalink / raw)
  To: Michal Privoznik; +Cc: qemu-devel

On Tue, Mar 20, 2012 at 05:16:41PM +0100, Michal Privoznik wrote:
> On 20.03.2012 17:10, Michael Roth wrote:
> > On Tue, Mar 20, 2012 at 04:09:53PM +0100, Michal Privoznik wrote:
> >> Currently, the implementation of that command is full of
> >> Linux specific code. Before any brave man will step into
> >> and port it to other OSes, make this function Linux only.
> >>
> >> Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
> > 
> > Which aspect is linux-specific? getifaddrs() and getnameinfo() seem to
> > be available on BSD and OpenSolaris, and we're already stubbed for w32.
> > Are you seeing breakage?
> 
> Personally, I don't; but there has been this report:
> 
> http://lists.nongnu.org/archive/html/qemu-devel/2012-03/msg03951.html
> 
> which happens on OpenBSD, I suspect.

Ew, okay, well it looks like guest-suspend has a role as well so this
patch wouldn't be sufficient. Let me fire up a FreeBSD image I have
laying around and play around with it a bit.

> 
> Michal
> 

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

* Re: [Qemu-devel] [PATCH] qemu-ga: Make guest-network-get-interfaces Linux only
  2012-03-20 18:19     ` Michael Roth
@ 2012-03-21  0:47       ` Michael Roth
  0 siblings, 0 replies; 14+ messages in thread
From: Michael Roth @ 2012-03-21  0:47 UTC (permalink / raw)
  To: Michal Privoznik; +Cc: qemu-devel

On Tue, Mar 20, 2012 at 01:19:25PM -0500, Michael Roth wrote:
> On Tue, Mar 20, 2012 at 05:16:41PM +0100, Michal Privoznik wrote:
> > On 20.03.2012 17:10, Michael Roth wrote:
> > > On Tue, Mar 20, 2012 at 04:09:53PM +0100, Michal Privoznik wrote:
> > >> Currently, the implementation of that command is full of
> > >> Linux specific code. Before any brave man will step into
> > >> and port it to other OSes, make this function Linux only.
> > >>
> > >> Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
> > > 
> > > Which aspect is linux-specific? getifaddrs() and getnameinfo() seem to
> > > be available on BSD and OpenSolaris, and we're already stubbed for w32.
> > > Are you seeing breakage?
> > 
> > Personally, I don't; but there has been this report:
> > 
> > http://lists.nongnu.org/archive/html/qemu-devel/2012-03/msg03951.html
> > 
> > which happens on OpenBSD, I suspect.
> 
> Ew, okay, well it looks like guest-suspend has a role as well so this
> patch wouldn't be sufficient. Let me fire up a FreeBSD image I have
> laying around and play around with it a bit.
> 

Bleh.. hit a gcc bug on the build then ran out of disk space trying to
upgrade to the latest gcc. Let's stub guest-network* and guest-suspend*
for now. I'll send a patch for the guest-suspend side and to get rid
of the warnings.

> > 
> > Michal
> > 

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

* [Qemu-devel] [PATCH] qemu-ga: stub out guest-suspend* for non-linux
  2012-03-20 15:09 [Qemu-devel] [PATCH] qemu-ga: Make guest-network-get-interfaces Linux only Michal Privoznik
  2012-03-20 16:10 ` Michael Roth
@ 2012-03-21  0:54 ` Michael Roth
  2012-03-23 18:20   ` Luiz Capitulino
  1 sibling, 1 reply; 14+ messages in thread
From: Michael Roth @ 2012-03-21  0:54 UTC (permalink / raw)
  To: qemu-devel; +Cc: mprivozn

This currently breaks the build for BSDs.

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 qga/commands-posix.c |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/qga/commands-posix.c b/qga/commands-posix.c
index 89dde92..16737d7 100644
--- a/qga/commands-posix.c
+++ b/qga/commands-posix.c
@@ -24,10 +24,12 @@
 
 #include <sys/types.h>
 #include <sys/ioctl.h>
+#if defined(__linux__)
 #include <ifaddrs.h>
 #include <arpa/inet.h>
 #include <sys/socket.h>
 #include <net/if.h>
+#endif
 #include <sys/wait.h>
 #include "qga/guest-agent-core.h"
 #include "qga-qmp-commands.h"
@@ -542,6 +544,7 @@ int64_t qmp_guest_fsfreeze_thaw(Error **err)
 #define SUSPEND_SUPPORTED 0
 #define SUSPEND_NOT_SUPPORTED 1
 
+#if defined(__linux__)
 /**
  * This function forks twice and the information about the mode support
  * status is passed to the qemu-ga process via a pipe.
@@ -729,6 +732,25 @@ void qmp_guest_suspend_hybrid(Error **err)
     guest_suspend("pm-suspend-hybrid", NULL, err);
 }
 
+#else /* defined(linux) */
+
+void qmp_guest_suspend_disk(Error **err)
+{
+    error_set(err, QERR_UNSUPPORTED);
+}
+
+void qmp_guest_suspend_ram(Error **err)
+{
+    error_set(err, QERR_UNSUPPORTED);
+}
+
+void qmp_guest_suspend_hybrid(Error **err)
+{
+    error_set(err, QERR_UNSUPPORTED);
+}
+
+#endif
+
 #if defined(__linux__)
 static GuestNetworkInterfaceList *
 guest_find_interface(GuestNetworkInterfaceList *head,
-- 
1.7.4.1

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

* Re: [Qemu-devel] [PATCH] qemu-ga: stub out guest-suspend* for non-linux
  2012-03-21  0:54 ` [Qemu-devel] [PATCH] qemu-ga: stub out guest-suspend* for non-linux Michael Roth
@ 2012-03-23 18:20   ` Luiz Capitulino
  2012-03-23 19:11     ` Michael Roth
  0 siblings, 1 reply; 14+ messages in thread
From: Luiz Capitulino @ 2012-03-23 18:20 UTC (permalink / raw)
  To: Michael Roth; +Cc: mprivozn, qemu-devel

On Tue, 20 Mar 2012 19:54:09 -0500
Michael Roth <mdroth@linux.vnet.ibm.com> wrote:

> This currently breaks the build for BSDs.
> 
> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
> ---
>  qga/commands-posix.c |   22 ++++++++++++++++++++++
>  1 files changed, 22 insertions(+), 0 deletions(-)
> 
> diff --git a/qga/commands-posix.c b/qga/commands-posix.c
> index 89dde92..16737d7 100644
> --- a/qga/commands-posix.c
> +++ b/qga/commands-posix.c
> @@ -24,10 +24,12 @@
>  
>  #include <sys/types.h>
>  #include <sys/ioctl.h>
> +#if defined(__linux__)
>  #include <ifaddrs.h>
>  #include <arpa/inet.h>
>  #include <sys/socket.h>
>  #include <net/if.h>
> +#endif
>  #include <sys/wait.h>
>  #include "qga/guest-agent-core.h"
>  #include "qga-qmp-commands.h"
> @@ -542,6 +544,7 @@ int64_t qmp_guest_fsfreeze_thaw(Error **err)
>  #define SUSPEND_SUPPORTED 0
>  #define SUSPEND_NOT_SUPPORTED 1

Missing the macros and I think reopen_fd_to_null() is missing too, also
doesn't apply to latest master.

>  
> +#if defined(__linux__)
>  /**
>   * This function forks twice and the information about the mode support
>   * status is passed to the qemu-ga process via a pipe.
> @@ -729,6 +732,25 @@ void qmp_guest_suspend_hybrid(Error **err)
>      guest_suspend("pm-suspend-hybrid", NULL, err);
>  }
>  
> +#else /* defined(linux) */
> +
> +void qmp_guest_suspend_disk(Error **err)
> +{
> +    error_set(err, QERR_UNSUPPORTED);
> +}
> +
> +void qmp_guest_suspend_ram(Error **err)
> +{
> +    error_set(err, QERR_UNSUPPORTED);
> +}
> +
> +void qmp_guest_suspend_hybrid(Error **err)
> +{
> +    error_set(err, QERR_UNSUPPORTED);
> +}
> +
> +#endif
> +
>  #if defined(__linux__)

I think it would be nice to reorganize the functions in this file so that
we could have only one #if defined(__linux__) (or even split this into two
files)...

>  static GuestNetworkInterfaceList *
>  guest_find_interface(GuestNetworkInterfaceList *head,

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

* Re: [Qemu-devel] [PATCH] qemu-ga: stub out guest-suspend* for non-linux
  2012-03-23 18:20   ` Luiz Capitulino
@ 2012-03-23 19:11     ` Michael Roth
  2012-03-23 20:37       ` Luiz Capitulino
  0 siblings, 1 reply; 14+ messages in thread
From: Michael Roth @ 2012-03-23 19:11 UTC (permalink / raw)
  To: Luiz Capitulino; +Cc: mprivozn, qemu-devel

On Fri, Mar 23, 2012 at 03:20:22PM -0300, Luiz Capitulino wrote:
> On Tue, 20 Mar 2012 19:54:09 -0500
> Michael Roth <mdroth@linux.vnet.ibm.com> wrote:
> 
> > This currently breaks the build for BSDs.
> > 
> > Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
> > ---
> >  qga/commands-posix.c |   22 ++++++++++++++++++++++
> >  1 files changed, 22 insertions(+), 0 deletions(-)
> > 
> > diff --git a/qga/commands-posix.c b/qga/commands-posix.c
> > index 89dde92..16737d7 100644
> > --- a/qga/commands-posix.c
> > +++ b/qga/commands-posix.c
> > @@ -24,10 +24,12 @@
> >  
> >  #include <sys/types.h>
> >  #include <sys/ioctl.h>
> > +#if defined(__linux__)
> >  #include <ifaddrs.h>
> >  #include <arpa/inet.h>
> >  #include <sys/socket.h>
> >  #include <net/if.h>
> > +#endif
> >  #include <sys/wait.h>
> >  #include "qga/guest-agent-core.h"
> >  #include "qga-qmp-commands.h"
> > @@ -542,6 +544,7 @@ int64_t qmp_guest_fsfreeze_thaw(Error **err)
> >  #define SUSPEND_SUPPORTED 0
> >  #define SUSPEND_NOT_SUPPORTED 1
> 
> Missing the macros and I think reopen_fd_to_null() is missing too, also
> doesn't apply to latest master.
> 

Shouldn't hurt, but yah, leaving them in is a bit sloppy.

Don't see why this wouldn't apply though... are you applying on top of
Michal's patch? This patch was meant to be the guest-suspend counterpart
rather than a standalone fix.

> >  
> > +#if defined(__linux__)
> >  /**
> >   * This function forks twice and the information about the mode support
> >   * status is passed to the qemu-ga process via a pipe.
> > @@ -729,6 +732,25 @@ void qmp_guest_suspend_hybrid(Error **err)
> >      guest_suspend("pm-suspend-hybrid", NULL, err);
> >  }
> >  
> > +#else /* defined(linux) */
> > +
> > +void qmp_guest_suspend_disk(Error **err)
> > +{
> > +    error_set(err, QERR_UNSUPPORTED);
> > +}
> > +
> > +void qmp_guest_suspend_ram(Error **err)
> > +{
> > +    error_set(err, QERR_UNSUPPORTED);
> > +}
> > +
> > +void qmp_guest_suspend_hybrid(Error **err)
> > +{
> > +    error_set(err, QERR_UNSUPPORTED);
> > +}
> > +
> > +#endif
> > +
> >  #if defined(__linux__)
> 
> I think it would be nice to reorganize the functions in this file so that
> we could have only one #if defined(__linux__) (or even split this into two
> files)...
> 

Yah..that's a good idea, since atm we have suspend, network-get-interface, and
fsfreeze. I'll post a standalone patch to move all the linux-only stuff
into a contiguous chunk. Seperate files I think is a bit extreme, since
AFAICT there's no major reason we shouldn't be able to get the first 2 ported,
and I'd prefer that we avoid doing linux-specific implementations in the
future. Script-deployment via guest-file-write/guest-exec is where we wanna go
long-term for stuff like that.

> >  static GuestNetworkInterfaceList *
> >  guest_find_interface(GuestNetworkInterfaceList *head,
> 

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

* Re: [Qemu-devel] [PATCH] qemu-ga: stub out guest-suspend* for non-linux
  2012-03-23 19:11     ` Michael Roth
@ 2012-03-23 20:37       ` Luiz Capitulino
  2012-03-25 19:40         ` [Qemu-devel] [PATCH] qemu-ga: fix bsd build, and re-org linux-specific implementations Michael Roth
  0 siblings, 1 reply; 14+ messages in thread
From: Luiz Capitulino @ 2012-03-23 20:37 UTC (permalink / raw)
  To: Michael Roth; +Cc: mprivozn, qemu-devel

On Fri, 23 Mar 2012 14:11:53 -0500
Michael Roth <mdroth@linux.vnet.ibm.com> wrote:

> On Fri, Mar 23, 2012 at 03:20:22PM -0300, Luiz Capitulino wrote:
> > On Tue, 20 Mar 2012 19:54:09 -0500
> > Michael Roth <mdroth@linux.vnet.ibm.com> wrote:
> > 
> > > This currently breaks the build for BSDs.
> > > 
> > > Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
> > > ---
> > >  qga/commands-posix.c |   22 ++++++++++++++++++++++
> > >  1 files changed, 22 insertions(+), 0 deletions(-)
> > > 
> > > diff --git a/qga/commands-posix.c b/qga/commands-posix.c
> > > index 89dde92..16737d7 100644
> > > --- a/qga/commands-posix.c
> > > +++ b/qga/commands-posix.c
> > > @@ -24,10 +24,12 @@
> > >  
> > >  #include <sys/types.h>
> > >  #include <sys/ioctl.h>
> > > +#if defined(__linux__)
> > >  #include <ifaddrs.h>
> > >  #include <arpa/inet.h>
> > >  #include <sys/socket.h>
> > >  #include <net/if.h>
> > > +#endif
> > >  #include <sys/wait.h>
> > >  #include "qga/guest-agent-core.h"
> > >  #include "qga-qmp-commands.h"
> > > @@ -542,6 +544,7 @@ int64_t qmp_guest_fsfreeze_thaw(Error **err)
> > >  #define SUSPEND_SUPPORTED 0
> > >  #define SUSPEND_NOT_SUPPORTED 1
> > 
> > Missing the macros and I think reopen_fd_to_null() is missing too, also
> > doesn't apply to latest master.
> > 
> 
> Shouldn't hurt, but yah, leaving them in is a bit sloppy.

I think letting reopen_fd_to_null() out won't actually build.

> Don't see why this wouldn't apply though... are you applying on top of
> Michal's patch?

Oh, no, I was trying to apply on master to test it... If Michal's patch
is not applied yet, then I think you should post a version that applies
on master and Michal should rebase on top of your patch.

> This patch was meant to be the guest-suspend counterpart
> rather than a standalone fix.

Yeah, I missed it. I'm sorry for that and thanks for fixing it!

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

* [Qemu-devel] [PATCH] qemu-ga: fix bsd build, and re-org linux-specific implementations
  2012-03-23 20:37       ` Luiz Capitulino
@ 2012-03-25 19:40         ` Michael Roth
  2012-03-26 16:22           ` Luiz Capitulino
  2012-03-26 20:24           ` Brad Smith
  0 siblings, 2 replies; 14+ messages in thread
From: Michael Roth @ 2012-03-25 19:40 UTC (permalink / raw)
  To: qemu-devel; +Cc: mprivozn, brad, lcapitulino


Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 qga/commands-posix.c |  111 +++++++++++++++++++++++++++++--------------------
 1 files changed, 66 insertions(+), 45 deletions(-)

diff --git a/qga/commands-posix.c b/qga/commands-posix.c
index 7b2be2f..faf970d 100644
--- a/qga/commands-posix.c
+++ b/qga/commands-posix.c
@@ -12,29 +12,30 @@
  */
 
 #include <glib.h>
+#include <sys/types.h>
+#include <sys/ioctl.h>
+#include "qga/guest-agent-core.h"
+#include "qga-qmp-commands.h"
+#include "qerror.h"
+#include "qemu-queue.h"
+#include "host-utils.h"
 
 #if defined(__linux__)
 #include <mntent.h>
 #include <linux/fs.h>
-
-#if defined(__linux__) && defined(FIFREEZE)
-#define CONFIG_FSFREEZE
-#endif
-#endif
-
-#include <sys/types.h>
-#include <sys/ioctl.h>
 #include <ifaddrs.h>
 #include <arpa/inet.h>
 #include <sys/socket.h>
 #include <net/if.h>
 #include <sys/wait.h>
-#include "qga/guest-agent-core.h"
-#include "qga-qmp-commands.h"
-#include "qerror.h"
-#include "qemu-queue.h"
-#include "host-utils.h"
 
+#if defined(__linux__) && defined(FIFREEZE)
+#define CONFIG_FSFREEZE
+#endif
+#endif
+
+#if defined(__linux__)
+/* TODO: use this in place of all post-fork() fclose(std*) callers */
 static void reopen_fd_to_null(int fd)
 {
     int nullfd;
@@ -50,6 +51,7 @@ static void reopen_fd_to_null(int fd)
         close(nullfd);
     }
 }
+#endif /* defined(__linux__) */
 
 void qmp_guest_shutdown(bool has_mode, const char *mode, Error **err)
 {
@@ -309,7 +311,11 @@ static void guest_file_init(void)
     QTAILQ_INIT(&guest_file_state.filehandles);
 }
 
+/* linux-specific implementations. avoid this if at all possible. */
+#if defined(__linux__)
+
 #if defined(CONFIG_FSFREEZE)
+
 static void disable_logging(void)
 {
     ga_disable_logging(ga_state);
@@ -505,38 +511,7 @@ static void guest_fsfreeze_cleanup(void)
         }
     }
 }
-#else
-/*
- * Return status of freeze/thaw
- */
-GuestFsfreezeStatus qmp_guest_fsfreeze_status(Error **err)
-{
-    error_set(err, QERR_UNSUPPORTED);
-
-    return 0;
-}
-
-/*
- * Walk list of mounted file systems in the guest, and freeze the ones which
- * are real local file systems.
- */
-int64_t qmp_guest_fsfreeze_freeze(Error **err)
-{
-    error_set(err, QERR_UNSUPPORTED);
-
-    return 0;
-}
-
-/*
- * Walk list of frozen file systems in the guest, and thaw them.
- */
-int64_t qmp_guest_fsfreeze_thaw(Error **err)
-{
-    error_set(err, QERR_UNSUPPORTED);
-
-    return 0;
-}
-#endif
+#endif /* CONFIG_FSFREEZE */
 
 #define LINUX_SYS_STATE_FILE "/sys/power/state"
 #define SUSPEND_SUPPORTED 0
@@ -904,6 +879,52 @@ error:
     return NULL;
 }
 
+#else /* defined(__linux__) */
+
+GuestFsfreezeStatus qmp_guest_fsfreeze_status(Error **err)
+{
+    error_set(err, QERR_UNSUPPORTED);
+
+    return 0;
+}
+
+int64_t qmp_guest_fsfreeze_freeze(Error **err)
+{
+    error_set(err, QERR_UNSUPPORTED);
+
+    return 0;
+}
+
+int64_t qmp_guest_fsfreeze_thaw(Error **err)
+{
+    error_set(err, QERR_UNSUPPORTED);
+
+    return 0;
+}
+
+void qmp_guest_suspend_disk(Error **err)
+{
+    error_set(err, QERR_UNSUPPORTED);
+}
+
+void qmp_guest_suspend_ram(Error **err)
+{
+    error_set(err, QERR_UNSUPPORTED);
+}
+
+void qmp_guest_suspend_hybrid(Error **err)
+{
+    error_set(err, QERR_UNSUPPORTED);
+}
+
+GuestNetworkInterfaceList *qmp_guest_network_get_interfaces(Error **errp)
+{
+    error_set(errp, QERR_UNSUPPORTED);
+    return NULL;
+}
+
+#endif
+
 /* register init/cleanup routines for stateful command groups */
 void ga_command_state_init(GAState *s, GACommandState *cs)
 {
-- 
1.7.4.1

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

* Re: [Qemu-devel] [PATCH] qemu-ga: fix bsd build, and re-org linux-specific implementations
  2012-03-25 19:40         ` [Qemu-devel] [PATCH] qemu-ga: fix bsd build, and re-org linux-specific implementations Michael Roth
@ 2012-03-26 16:22           ` Luiz Capitulino
  2012-03-26 20:24           ` Brad Smith
  1 sibling, 0 replies; 14+ messages in thread
From: Luiz Capitulino @ 2012-03-26 16:22 UTC (permalink / raw)
  To: Michael Roth; +Cc: mprivozn, qemu-devel, brad

On Sun, 25 Mar 2012 14:40:30 -0500
Michael Roth <mdroth@linux.vnet.ibm.com> wrote:

> 
> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
> ---
>  qga/commands-posix.c |  111 +++++++++++++++++++++++++++++--------------------
>  1 files changed, 66 insertions(+), 45 deletions(-)

Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>

> 
> diff --git a/qga/commands-posix.c b/qga/commands-posix.c
> index 7b2be2f..faf970d 100644
> --- a/qga/commands-posix.c
> +++ b/qga/commands-posix.c
> @@ -12,29 +12,30 @@
>   */
>  
>  #include <glib.h>
> +#include <sys/types.h>
> +#include <sys/ioctl.h>
> +#include "qga/guest-agent-core.h"
> +#include "qga-qmp-commands.h"
> +#include "qerror.h"
> +#include "qemu-queue.h"
> +#include "host-utils.h"
>  
>  #if defined(__linux__)
>  #include <mntent.h>
>  #include <linux/fs.h>
> -
> -#if defined(__linux__) && defined(FIFREEZE)
> -#define CONFIG_FSFREEZE
> -#endif
> -#endif
> -
> -#include <sys/types.h>
> -#include <sys/ioctl.h>
>  #include <ifaddrs.h>
>  #include <arpa/inet.h>
>  #include <sys/socket.h>
>  #include <net/if.h>
>  #include <sys/wait.h>
> -#include "qga/guest-agent-core.h"
> -#include "qga-qmp-commands.h"
> -#include "qerror.h"
> -#include "qemu-queue.h"
> -#include "host-utils.h"
>  
> +#if defined(__linux__) && defined(FIFREEZE)
> +#define CONFIG_FSFREEZE
> +#endif
> +#endif
> +
> +#if defined(__linux__)
> +/* TODO: use this in place of all post-fork() fclose(std*) callers */
>  static void reopen_fd_to_null(int fd)
>  {
>      int nullfd;
> @@ -50,6 +51,7 @@ static void reopen_fd_to_null(int fd)
>          close(nullfd);
>      }
>  }
> +#endif /* defined(__linux__) */
>  
>  void qmp_guest_shutdown(bool has_mode, const char *mode, Error **err)
>  {
> @@ -309,7 +311,11 @@ static void guest_file_init(void)
>      QTAILQ_INIT(&guest_file_state.filehandles);
>  }
>  
> +/* linux-specific implementations. avoid this if at all possible. */
> +#if defined(__linux__)
> +
>  #if defined(CONFIG_FSFREEZE)
> +
>  static void disable_logging(void)
>  {
>      ga_disable_logging(ga_state);
> @@ -505,38 +511,7 @@ static void guest_fsfreeze_cleanup(void)
>          }
>      }
>  }
> -#else
> -/*
> - * Return status of freeze/thaw
> - */
> -GuestFsfreezeStatus qmp_guest_fsfreeze_status(Error **err)
> -{
> -    error_set(err, QERR_UNSUPPORTED);
> -
> -    return 0;
> -}
> -
> -/*
> - * Walk list of mounted file systems in the guest, and freeze the ones which
> - * are real local file systems.
> - */
> -int64_t qmp_guest_fsfreeze_freeze(Error **err)
> -{
> -    error_set(err, QERR_UNSUPPORTED);
> -
> -    return 0;
> -}
> -
> -/*
> - * Walk list of frozen file systems in the guest, and thaw them.
> - */
> -int64_t qmp_guest_fsfreeze_thaw(Error **err)
> -{
> -    error_set(err, QERR_UNSUPPORTED);
> -
> -    return 0;
> -}
> -#endif
> +#endif /* CONFIG_FSFREEZE */
>  
>  #define LINUX_SYS_STATE_FILE "/sys/power/state"
>  #define SUSPEND_SUPPORTED 0
> @@ -904,6 +879,52 @@ error:
>      return NULL;
>  }
>  
> +#else /* defined(__linux__) */
> +
> +GuestFsfreezeStatus qmp_guest_fsfreeze_status(Error **err)
> +{
> +    error_set(err, QERR_UNSUPPORTED);
> +
> +    return 0;
> +}
> +
> +int64_t qmp_guest_fsfreeze_freeze(Error **err)
> +{
> +    error_set(err, QERR_UNSUPPORTED);
> +
> +    return 0;
> +}
> +
> +int64_t qmp_guest_fsfreeze_thaw(Error **err)
> +{
> +    error_set(err, QERR_UNSUPPORTED);
> +
> +    return 0;
> +}
> +
> +void qmp_guest_suspend_disk(Error **err)
> +{
> +    error_set(err, QERR_UNSUPPORTED);
> +}
> +
> +void qmp_guest_suspend_ram(Error **err)
> +{
> +    error_set(err, QERR_UNSUPPORTED);
> +}
> +
> +void qmp_guest_suspend_hybrid(Error **err)
> +{
> +    error_set(err, QERR_UNSUPPORTED);
> +}
> +
> +GuestNetworkInterfaceList *qmp_guest_network_get_interfaces(Error **errp)
> +{
> +    error_set(errp, QERR_UNSUPPORTED);
> +    return NULL;
> +}
> +
> +#endif
> +
>  /* register init/cleanup routines for stateful command groups */
>  void ga_command_state_init(GAState *s, GACommandState *cs)
>  {

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

* Re: [Qemu-devel] [PATCH] qemu-ga: Make guest-network-get-interfaces Linux only
  2012-03-20 16:10 ` Michael Roth
  2012-03-20 16:16   ` Michal Privoznik
@ 2012-03-26 16:35   ` Andreas Färber
  2012-03-26 18:47     ` Michael Roth
  1 sibling, 1 reply; 14+ messages in thread
From: Andreas Färber @ 2012-03-26 16:35 UTC (permalink / raw)
  To: Michael Roth; +Cc: Michal Privoznik, qemu-devel, Stefan Hajnoczi

Am 20.03.2012 17:10, schrieb Michael Roth:
> On Tue, Mar 20, 2012 at 04:09:53PM +0100, Michal Privoznik wrote:
>> Currently, the implementation of that command is full of
>> Linux specific code. Before any brave man will step into
>> and port it to other OSes, make this function Linux only.
>>
>> Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
> 
> Which aspect is linux-specific? getifaddrs() and getnameinfo() seem to
> be available on BSD and OpenSolaris, and we're already stubbed for w32.
> Are you seeing breakage?

The two OpenBSD buildbots were reporting breakages:

http://buildbot.b1-systems.de/qemu/buildslaves/brad_openbsd_current
http://buildbot.b1-systems.de/qemu/buildslaves/kraxel_openbsd49

Unfortunately they rarely nag the people to blame ;) and the reports on
qemu-devel are admittedly a bit brief.

Maybe it might make sense to let the buildbots build your qemu-ga
staging branch as well, Michael? That could catch this in advance.

Andreas

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

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

* Re: [Qemu-devel] [PATCH] qemu-ga: Make guest-network-get-interfaces Linux only
  2012-03-26 16:35   ` Andreas Färber
@ 2012-03-26 18:47     ` Michael Roth
  0 siblings, 0 replies; 14+ messages in thread
From: Michael Roth @ 2012-03-26 18:47 UTC (permalink / raw)
  To: Andreas Färber; +Cc: Michal Privoznik, qemu-devel, Stefan Hajnoczi

On Mon, Mar 26, 2012 at 06:35:49PM +0200, Andreas Färber wrote:
> Am 20.03.2012 17:10, schrieb Michael Roth:
> > On Tue, Mar 20, 2012 at 04:09:53PM +0100, Michal Privoznik wrote:
> >> Currently, the implementation of that command is full of
> >> Linux specific code. Before any brave man will step into
> >> and port it to other OSes, make this function Linux only.
> >>
> >> Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
> > 
> > Which aspect is linux-specific? getifaddrs() and getnameinfo() seem to
> > be available on BSD and OpenSolaris, and we're already stubbed for w32.
> > Are you seeing breakage?
> 
> The two OpenBSD buildbots were reporting breakages:
> 
> http://buildbot.b1-systems.de/qemu/buildslaves/brad_openbsd_current
> http://buildbot.b1-systems.de/qemu/buildslaves/kraxel_openbsd49
> 
> Unfortunately they rarely nag the people to blame ;) and the reports on
> qemu-devel are admittedly a bit brief.
> 
> Maybe it might make sense to let the buildbots build your qemu-ga
> staging branch as well, Michael? That could catch this in advance.

That would great! Is there any process in place for having a repo added? I've
been staging directly to pull branches, but started a single staging
branch at:

git://github.com/mdroth/qemu.git qga

> 
> Andreas
> 
> -- 
> SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
> GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
> 

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

* Re: [Qemu-devel] [PATCH] qemu-ga: fix bsd build, and re-org linux-specific implementations
  2012-03-25 19:40         ` [Qemu-devel] [PATCH] qemu-ga: fix bsd build, and re-org linux-specific implementations Michael Roth
  2012-03-26 16:22           ` Luiz Capitulino
@ 2012-03-26 20:24           ` Brad Smith
  1 sibling, 0 replies; 14+ messages in thread
From: Brad Smith @ 2012-03-26 20:24 UTC (permalink / raw)
  To: Michael Roth; +Cc: mprivozn, qemu-devel, lcapitulino

On 25/03/12 3:40 PM, Michael Roth wrote:
>
> Signed-off-by: Michael Roth<mdroth@linux.vnet.ibm.com>
> ---
>   qga/commands-posix.c |  111 +++++++++++++++++++++++++++++--------------------
>   1 files changed, 66 insertions(+), 45 deletions(-)
>
> diff --git a/qga/commands-posix.c b/qga/commands-posix.c
> index 7b2be2f..faf970d 100644
> --- a/qga/commands-posix.c
> +++ b/qga/commands-posix.c
> @@ -12,29 +12,30 @@
>    */
>
>   #include<glib.h>
> +#include<sys/types.h>
> +#include<sys/ioctl.h>
> +#include "qga/guest-agent-core.h"
> +#include "qga-qmp-commands.h"
> +#include "qerror.h"
> +#include "qemu-queue.h"
> +#include "host-utils.h"
>
>   #if defined(__linux__)
>   #include<mntent.h>
>   #include<linux/fs.h>
> -
> -#if defined(__linux__)&&  defined(FIFREEZE)
> -#define CONFIG_FSFREEZE
> -#endif
> -#endif
> -
> -#include<sys/types.h>
> -#include<sys/ioctl.h>
>   #include<ifaddrs.h>
>   #include<arpa/inet.h>
>   #include<sys/socket.h>
>   #include<net/if.h>
>   #include<sys/wait.h>
> -#include "qga/guest-agent-core.h"
> -#include "qga-qmp-commands.h"
> -#include "qerror.h"
> -#include "qemu-queue.h"
> -#include "host-utils.h"
>
> +#if defined(__linux__)&&  defined(FIFREEZE)
> +#define CONFIG_FSFREEZE
> +#endif
> +#endif
> +
> +#if defined(__linux__)
> +/* TODO: use this in place of all post-fork() fclose(std*) callers */
>   static void reopen_fd_to_null(int fd)
>   {
>       int nullfd;
> @@ -50,6 +51,7 @@ static void reopen_fd_to_null(int fd)
>           close(nullfd);
>       }
>   }
> +#endif /* defined(__linux__) */
>
>   void qmp_guest_shutdown(bool has_mode, const char *mode, Error **err)
>   {
> @@ -309,7 +311,11 @@ static void guest_file_init(void)
>       QTAILQ_INIT(&guest_file_state.filehandles);
>   }
>
> +/* linux-specific implementations. avoid this if at all possible. */
> +#if defined(__linux__)
> +
>   #if defined(CONFIG_FSFREEZE)
> +
>   static void disable_logging(void)
>   {
>       ga_disable_logging(ga_state);
> @@ -505,38 +511,7 @@ static void guest_fsfreeze_cleanup(void)
>           }
>       }
>   }
> -#else
> -/*
> - * Return status of freeze/thaw
> - */
> -GuestFsfreezeStatus qmp_guest_fsfreeze_status(Error **err)
> -{
> -    error_set(err, QERR_UNSUPPORTED);
> -
> -    return 0;
> -}
> -
> -/*
> - * Walk list of mounted file systems in the guest, and freeze the ones which
> - * are real local file systems.
> - */
> -int64_t qmp_guest_fsfreeze_freeze(Error **err)
> -{
> -    error_set(err, QERR_UNSUPPORTED);
> -
> -    return 0;
> -}
> -
> -/*
> - * Walk list of frozen file systems in the guest, and thaw them.
> - */
> -int64_t qmp_guest_fsfreeze_thaw(Error **err)
> -{
> -    error_set(err, QERR_UNSUPPORTED);
> -
> -    return 0;
> -}
> -#endif
> +#endif /* CONFIG_FSFREEZE */
>
>   #define LINUX_SYS_STATE_FILE "/sys/power/state"
>   #define SUSPEND_SUPPORTED 0
> @@ -904,6 +879,52 @@ error:
>       return NULL;
>   }
>
> +#else /* defined(__linux__) */
> +
> +GuestFsfreezeStatus qmp_guest_fsfreeze_status(Error **err)
> +{
> +    error_set(err, QERR_UNSUPPORTED);
> +
> +    return 0;
> +}
> +
> +int64_t qmp_guest_fsfreeze_freeze(Error **err)
> +{
> +    error_set(err, QERR_UNSUPPORTED);
> +
> +    return 0;
> +}
> +
> +int64_t qmp_guest_fsfreeze_thaw(Error **err)
> +{
> +    error_set(err, QERR_UNSUPPORTED);
> +
> +    return 0;
> +}
> +
> +void qmp_guest_suspend_disk(Error **err)
> +{
> +    error_set(err, QERR_UNSUPPORTED);
> +}
> +
> +void qmp_guest_suspend_ram(Error **err)
> +{
> +    error_set(err, QERR_UNSUPPORTED);
> +}
> +
> +void qmp_guest_suspend_hybrid(Error **err)
> +{
> +    error_set(err, QERR_UNSUPPORTED);
> +}
> +
> +GuestNetworkInterfaceList *qmp_guest_network_get_interfaces(Error **errp)
> +{
> +    error_set(errp, QERR_UNSUPPORTED);
> +    return NULL;
> +}
> +
> +#endif
> +
>   /* register init/cleanup routines for stateful command groups */
>   void ga_command_state_init(GAState *s, GACommandState *cs)
>   {

This builds. Thank you.

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

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

end of thread, other threads:[~2012-03-26 20:24 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-20 15:09 [Qemu-devel] [PATCH] qemu-ga: Make guest-network-get-interfaces Linux only Michal Privoznik
2012-03-20 16:10 ` Michael Roth
2012-03-20 16:16   ` Michal Privoznik
2012-03-20 18:19     ` Michael Roth
2012-03-21  0:47       ` Michael Roth
2012-03-26 16:35   ` Andreas Färber
2012-03-26 18:47     ` Michael Roth
2012-03-21  0:54 ` [Qemu-devel] [PATCH] qemu-ga: stub out guest-suspend* for non-linux Michael Roth
2012-03-23 18:20   ` Luiz Capitulino
2012-03-23 19:11     ` Michael Roth
2012-03-23 20:37       ` Luiz Capitulino
2012-03-25 19:40         ` [Qemu-devel] [PATCH] qemu-ga: fix bsd build, and re-org linux-specific implementations Michael Roth
2012-03-26 16:22           ` Luiz Capitulino
2012-03-26 20:24           ` Brad Smith

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.