From 422e6ae49d8ee83bfdc6c08a88621d6204c3072b Mon Sep 17 00:00:00 2001 From: Anthony Liguori Date: Mon, 5 Mar 2012 17:44:06 -0500 Subject: [PATCH 39/98] guest-agent: fix build with OpenBSD FS-Freeze only works with Linux. Signed-off-by: Anthony Liguori (cherry picked from commit 7006b9cff356233c3db0150ec55fd999c49dfae3) Signed-off-by: Jeff Cody Signed-off-by: Michal Novotny --- qga/guest-agent-commands.c | 63 ++++++++++++++++++++++++++++++++++++------- 1 files changed, 52 insertions(+), 11 deletions(-) diff --git a/qga/guest-agent-commands.c b/qga/guest-agent-commands.c index 8c0d67e..e215bd3 100644 --- a/qga/guest-agent-commands.c +++ b/qga/guest-agent-commands.c @@ -10,11 +10,17 @@ * See the COPYING file in the top-level directory. */ +#if defined(__linux__) +#define CONFIG_FSFREEZE +#endif + #include +#if defined(CONFIG_FSFREEZE) #include +#include +#endif #include #include -#include #include "qga/guest-agent-core.h" #include "qga-qmp-commands.h" #include "qerror.h" @@ -22,16 +28,6 @@ static GAState *ga_state; -static void disable_logging(void) -{ - ga_disable_logging(ga_state); -} - -static void enable_logging(void) -{ - ga_enable_logging(ga_state); -} - /* Note: in some situations, like with the fsfreeze, logging may be * temporarilly disabled. if it is necessary that a command be able * to log for accounting purposes, check ga_logging_enabled() beforehand, @@ -323,6 +319,17 @@ static void guest_file_init(void) QTAILQ_INIT(&guest_file_state.filehandles); } +#if defined(CONFIG_FSFREEZE) +static void disable_logging(void) +{ + ga_disable_logging(ga_state); +} + +static void enable_logging(void) +{ + ga_enable_logging(ga_state); +} + typedef struct GuestFsfreezeMount { char *dirname; char *devtype; @@ -508,11 +515,45 @@ static void guest_fsfreeze_cleanup(void) } } } +#else +/* + * Return status of freeze/thaw + */ +GuestFsfreezeStatus qmp_guest_fsfreeze_status(Error **err) +{ + error_set(err, QERR_COMMAND_NOT_FOUND, "guest_fsfreeze_status"); + + 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_COMMAND_NOT_FOUND, "guest_fsfreeze_freeze"); + + 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_COMMAND_NOT_FOUND, "guest_fsfreeze_thaw"); + + return 0; +} +#endif /* register init/cleanup routines for stateful command groups */ void ga_command_state_init(GAState *s, GACommandState *cs) { ga_state = s; +#if defined(CONFIG_FSFREEZE) ga_command_state_add(cs, guest_fsfreeze_init, guest_fsfreeze_cleanup); +#endif ga_command_state_add(cs, guest_file_init, NULL); } -- 1.7.7.6