From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:46517) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SCCh0-0004Kj-Qg for qemu-devel@nongnu.org; Mon, 26 Mar 2012 12:22:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SCCgy-0006Zz-E8 for qemu-devel@nongnu.org; Mon, 26 Mar 2012 12:22:50 -0400 Received: from mx1.redhat.com ([209.132.183.28]:9809) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SCCgy-0006Zh-54 for qemu-devel@nongnu.org; Mon, 26 Mar 2012 12:22:48 -0400 Date: Mon, 26 Mar 2012 13:22:37 -0300 From: Luiz Capitulino Message-ID: <20120326132237.5e6ac474@doriath.home> In-Reply-To: <1332704430-17582-1-git-send-email-mdroth@linux.vnet.ibm.com> References: <20120323173715.10836950@doriath.home> <1332704430-17582-1-git-send-email-mdroth@linux.vnet.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] qemu-ga: fix bsd build, and re-org linux-specific implementations List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Michael Roth Cc: mprivozn@redhat.com, qemu-devel@nongnu.org, brad@comstyle.com On Sun, 25 Mar 2012 14:40:30 -0500 Michael Roth wrote: > > Signed-off-by: Michael Roth > --- > qga/commands-posix.c | 111 +++++++++++++++++++++++++++++-------------------- > 1 files changed, 66 insertions(+), 45 deletions(-) Reviewed-by: Luiz Capitulino > > 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 > +#include > +#include > +#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 > #include > - > -#if defined(__linux__) && defined(FIFREEZE) > -#define CONFIG_FSFREEZE > -#endif > -#endif > - > -#include > -#include > #include > #include > #include > #include > #include > -#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) > {