diff options
author | Luiz Capitulino <lcapitulino@redhat.com> | 2011-12-08 11:13:50 -0200 |
---|---|---|
committer | Luiz Capitulino <lcapitulino@redhat.com> | 2012-01-18 10:23:39 -0200 |
commit | 333a96ec9fd08eaa03f8de1acc41a2851ccb8096 (patch) | |
tree | 13c07038b6cb21f34c4fa02d5d8fbef6f768bdad /qmp.c | |
parent | 903a881481745584b538591ea4db92bca7156956 (diff) | |
download | qemu-333a96ec9fd08eaa03f8de1acc41a2851ccb8096.zip qemu-333a96ec9fd08eaa03f8de1acc41a2851ccb8096.tar.gz qemu-333a96ec9fd08eaa03f8de1acc41a2851ccb8096.tar.bz2 |
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.c | 44 |
1 files changed, 44 insertions, 0 deletions
@@ -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); + } +} |