pseries: Add H_SET_MODE hcall to change guest exception endianness
[qemu/kevin.git] / qga / commands.c
blob528b082fa889f5f6b8ac68494e1f3a5c6a87c532
1 /*
2 * QEMU Guest Agent common/cross-platform command implementations
4 * Copyright IBM Corp. 2012
6 * Authors:
7 * Michael Roth <mdroth@linux.vnet.ibm.com>
9 * This work is licensed under the terms of the GNU GPL, version 2 or later.
10 * See the COPYING file in the top-level directory.
13 #include <glib.h>
14 #include "qga/guest-agent-core.h"
15 #include "qga-qmp-commands.h"
16 #include "qapi/qmp/qerror.h"
18 /* Note: in some situations, like with the fsfreeze, logging may be
19 * temporarilly disabled. if it is necessary that a command be able
20 * to log for accounting purposes, check ga_logging_enabled() beforehand,
21 * and use the QERR_QGA_LOGGING_DISABLED to generate an error
23 void slog(const gchar *fmt, ...)
25 va_list ap;
27 va_start(ap, fmt);
28 g_logv("syslog", G_LOG_LEVEL_INFO, fmt, ap);
29 va_end(ap);
32 int64_t qmp_guest_sync_delimited(int64_t id, Error **errp)
34 ga_set_response_delimited(ga_state);
35 return id;
38 int64_t qmp_guest_sync(int64_t id, Error **errp)
40 return id;
43 void qmp_guest_ping(Error **err)
45 slog("guest-ping called");
48 struct GuestAgentInfo *qmp_guest_info(Error **err)
50 GuestAgentInfo *info = g_malloc0(sizeof(GuestAgentInfo));
51 GuestAgentCommandInfo *cmd_info;
52 GuestAgentCommandInfoList *cmd_info_list;
53 char **cmd_list_head, **cmd_list;
55 info->version = g_strdup(QEMU_VERSION);
57 cmd_list_head = cmd_list = qmp_get_command_list();
58 if (*cmd_list_head == NULL) {
59 goto out;
62 while (*cmd_list) {
63 cmd_info = g_malloc0(sizeof(GuestAgentCommandInfo));
64 cmd_info->name = g_strdup(*cmd_list);
65 cmd_info->enabled = qmp_command_is_enabled(cmd_info->name);
67 cmd_info_list = g_malloc0(sizeof(GuestAgentCommandInfoList));
68 cmd_info_list->value = cmd_info;
69 cmd_info_list->next = info->supported_commands;
70 info->supported_commands = cmd_info_list;
72 g_free(*cmd_list);
73 cmd_list++;
76 out:
77 g_free(cmd_list_head);
78 return info;