From: Luiz Capitulino <lcapitulino@redhat.com>
To: Michael Roth <mdroth@linux.vnet.ibm.com>
Cc: mprivozn@redhat.com, qemu-devel@nongnu.org, brad@comstyle.com
Subject: Re: [Qemu-devel] [PATCH] qemu-ga: fix bsd build, and re-org linux-specific implementations
Date: Mon, 26 Mar 2012 13:22:37 -0300 [thread overview]
Message-ID: <20120326132237.5e6ac474@doriath.home> (raw)
In-Reply-To: <1332704430-17582-1-git-send-email-mdroth@linux.vnet.ibm.com>
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)
> {
next prev parent reply other threads:[~2012-03-26 16:22 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
2012-03-26 20:24 ` Brad Smith
-- strict thread matches above, loose matches on Subject: below --
2012-03-26 18:28 [Qemu-devel] [PULL] qemu-ga build fixes Michael Roth
2012-03-26 18:28 ` [Qemu-devel] [PATCH] qemu-ga: fix bsd build, and re-org linux-specific implementations Michael Roth
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120326132237.5e6ac474@doriath.home \
--to=lcapitulino@redhat.com \
--cc=brad@comstyle.com \
--cc=mdroth@linux.vnet.ibm.com \
--cc=mprivozn@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).