mirror of https://github.com/xqemu/xqemu.git
qemu-ga: fix bsd build, and re-org linux-specific implementations
This commit is contained in:
parent
cb1977d308
commit
e72c3f2ed9
|
@ -12,29 +12,30 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <glib.h>
|
#include <glib.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/types.h>
|
||||||
#include <sys/ioctl.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/guest-agent-core.h"
|
||||||
#include "qga-qmp-commands.h"
|
#include "qga-qmp-commands.h"
|
||||||
#include "qerror.h"
|
#include "qerror.h"
|
||||||
#include "qemu-queue.h"
|
#include "qemu-queue.h"
|
||||||
#include "host-utils.h"
|
#include "host-utils.h"
|
||||||
|
|
||||||
|
#if defined(__linux__)
|
||||||
|
#include <mntent.h>
|
||||||
|
#include <linux/fs.h>
|
||||||
|
#include <ifaddrs.h>
|
||||||
|
#include <arpa/inet.h>
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#include <net/if.h>
|
||||||
|
#include <sys/wait.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)
|
static void reopen_fd_to_null(int fd)
|
||||||
{
|
{
|
||||||
int nullfd;
|
int nullfd;
|
||||||
|
@ -50,6 +51,7 @@ static void reopen_fd_to_null(int fd)
|
||||||
close(nullfd);
|
close(nullfd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif /* defined(__linux__) */
|
||||||
|
|
||||||
void qmp_guest_shutdown(bool has_mode, const char *mode, Error **err)
|
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);
|
QTAILQ_INIT(&guest_file_state.filehandles);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* linux-specific implementations. avoid this if at all possible. */
|
||||||
|
#if defined(__linux__)
|
||||||
|
|
||||||
#if defined(CONFIG_FSFREEZE)
|
#if defined(CONFIG_FSFREEZE)
|
||||||
|
|
||||||
static void disable_logging(void)
|
static void disable_logging(void)
|
||||||
{
|
{
|
||||||
ga_disable_logging(ga_state);
|
ga_disable_logging(ga_state);
|
||||||
|
@ -505,38 +511,7 @@ static void guest_fsfreeze_cleanup(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#endif /* CONFIG_FSFREEZE */
|
||||||
/*
|
|
||||||
* 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
|
|
||||||
|
|
||||||
#define LINUX_SYS_STATE_FILE "/sys/power/state"
|
#define LINUX_SYS_STATE_FILE "/sys/power/state"
|
||||||
#define SUSPEND_SUPPORTED 0
|
#define SUSPEND_SUPPORTED 0
|
||||||
|
@ -904,6 +879,52 @@ error:
|
||||||
return NULL;
|
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 */
|
/* 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)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue