aboutsummaryrefslogtreecommitdiff
path: root/qmp.c
diff options
context:
space:
mode:
authorLuiz Capitulino <lcapitulino@redhat.com>2011-12-08 11:13:50 -0200
committerLuiz Capitulino <lcapitulino@redhat.com>2012-01-18 10:23:39 -0200
commit333a96ec9fd08eaa03f8de1acc41a2851ccb8096 (patch)
tree13c07038b6cb21f34c4fa02d5d8fbef6f768bdad /qmp.c
parent903a881481745584b538591ea4db92bca7156956 (diff)
downloadqemu-arm-333a96ec9fd08eaa03f8de1acc41a2851ccb8096.tar.gz
qapi: Convert change
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Diffstat (limited to 'qmp.c')
-rw-r--r--qmp.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/qmp.c b/qmp.c
index 9c9ea629ed..1222b6c9c4 100644
--- a/qmp.c
+++ b/qmp.c
@@ -23,6 +23,7 @@
#include "hw/qdev.h"
#include "qapi/qmp-input-visitor.h"
#include "qapi/qmp-output-visitor.h"
+#include "blockdev.h"
NameInfo *qmp_query_name(Error **errp)
{
@@ -345,9 +346,52 @@ void qmp_expire_password(const char *protocol, const char *whenstr,
error_set(errp, QERR_INVALID_PARAMETER, "protocol");
}
+#ifdef CONFIG_VNC
void qmp_change_vnc_password(const char *password, Error **errp)
{
if (vnc_display_password(NULL, password) < 0) {
error_set(errp, QERR_SET_PASSWD_FAILED);
}
}
+
+static void qmp_change_vnc_listen(const char *target, Error **err)
+{
+ if (vnc_display_open(NULL, target) < 0) {
+ error_set(err, QERR_VNC_SERVER_FAILED, target);
+ }
+}
+
+static void qmp_change_vnc(const char *target, bool has_arg, const char *arg,
+ Error **errp)
+{
+ if (strcmp(target, "passwd") == 0 || strcmp(target, "password") == 0) {
+ if (!has_arg) {
+ error_set(errp, QERR_MISSING_PARAMETER, "password");
+ } else {
+ qmp_change_vnc_password(arg, errp);
+ }
+ } else {
+ qmp_change_vnc_listen(target, errp);
+ }
+}
+#else
+void qmp_change_vnc_password(const char *password, Error **errp)
+{
+ error_set(errp, QERR_FEATURE_DISABLED, "vnc");
+}
+static void qmp_change_vnc(const char *target, bool has_arg, const char *arg,
+ Error **errp)
+{
+ error_set(errp, QERR_FEATURE_DISABLED, "vnc");
+}
+#endif /* !CONFIG_VNC */
+
+void qmp_change(const char *device, const char *target,
+ bool has_arg, const char *arg, Error **err)
+{
+ if (strcmp(device, "vnc") == 0) {
+ qmp_change_vnc(target, has_arg, arg, err);
+ } else {
+ qmp_change_blockdev(device, target, has_arg, arg, err);
+ }
+}