mirror of
https://git.proxmox.com/git/qemu
synced 2025-08-08 02:06:42 +00:00
guest-agent: fix build with OpenBSD
FS-Freeze only works with Linux. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
parent
fd2a9d2fc7
commit
7006b9cff3
@ -10,11 +10,17 @@
|
|||||||
* See the COPYING file in the top-level directory.
|
* See the COPYING file in the top-level directory.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#if defined(__linux__)
|
||||||
|
#define CONFIG_FSFREEZE
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
#if defined(CONFIG_FSFREEZE)
|
||||||
#include <mntent.h>
|
#include <mntent.h>
|
||||||
|
#include <linux/fs.h>
|
||||||
|
#endif
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#include <linux/fs.h>
|
|
||||||
#include "qga/guest-agent-core.h"
|
#include "qga/guest-agent-core.h"
|
||||||
#include "qga-qmp-commands.h"
|
#include "qga-qmp-commands.h"
|
||||||
#include "qerror.h"
|
#include "qerror.h"
|
||||||
@ -22,16 +28,6 @@
|
|||||||
|
|
||||||
static GAState *ga_state;
|
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
|
/* Note: in some situations, like with the fsfreeze, logging may be
|
||||||
* temporarilly disabled. if it is necessary that a command be able
|
* temporarilly disabled. if it is necessary that a command be able
|
||||||
* to log for accounting purposes, check ga_logging_enabled() beforehand,
|
* 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);
|
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 {
|
typedef struct GuestFsfreezeMount {
|
||||||
char *dirname;
|
char *dirname;
|
||||||
char *devtype;
|
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 */
|
/* register init/cleanup routines for stateful command groups */
|
||||||
void ga_command_state_init(GAState *s, GACommandState *cs)
|
void ga_command_state_init(GAState *s, GACommandState *cs)
|
||||||
{
|
{
|
||||||
ga_state = s;
|
ga_state = s;
|
||||||
|
#if defined(CONFIG_FSFREEZE)
|
||||||
ga_command_state_add(cs, guest_fsfreeze_init, guest_fsfreeze_cleanup);
|
ga_command_state_add(cs, guest_fsfreeze_init, guest_fsfreeze_cleanup);
|
||||||
|
#endif
|
||||||
ga_command_state_add(cs, guest_file_init, NULL);
|
ga_command_state_add(cs, guest_file_init, NULL);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user