mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 08:13:54 -06:00
ui: Factor out hmp_change_vnc(), and move to ui/ui-hmp-cmds.c
Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-Id: <20230109190321.1056914-14-armbru@redhat.com>
This commit is contained in:
parent
f8f2e9a859
commit
f916a1751e
4 changed files with 42 additions and 30 deletions
|
@ -25,7 +25,7 @@
|
|||
#include "qemu/timer.h"
|
||||
#include "qemu/sockets.h"
|
||||
#include "qemu/help_option.h"
|
||||
#include "monitor/monitor-internal.h"
|
||||
#include "monitor/monitor.h"
|
||||
#include "qapi/error.h"
|
||||
#include "qapi/clone-visitor.h"
|
||||
#include "qapi/opts-visitor.h"
|
||||
|
@ -41,7 +41,6 @@
|
|||
#include "qapi/qapi-commands-run-state.h"
|
||||
#include "qapi/qapi-commands-stats.h"
|
||||
#include "qapi/qapi-commands-tpm.h"
|
||||
#include "qapi/qapi-commands-ui.h"
|
||||
#include "qapi/qapi-commands-virtio.h"
|
||||
#include "qapi/qapi-visit-virtio.h"
|
||||
#include "qapi/qapi-visit-net.h"
|
||||
|
@ -1075,15 +1074,6 @@ void hmp_x_colo_lost_heartbeat(Monitor *mon, const QDict *qdict)
|
|||
hmp_handle_error(mon, err);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_VNC
|
||||
static void hmp_change_read_arg(void *opaque, const char *password,
|
||||
void *readline_opaque)
|
||||
{
|
||||
qmp_change_vnc_password(password, NULL);
|
||||
monitor_read_command(opaque, 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
void hmp_change(Monitor *mon, const QDict *qdict)
|
||||
{
|
||||
const char *device = qdict_get_str(qdict, "device");
|
||||
|
@ -1096,23 +1086,7 @@ void hmp_change(Monitor *mon, const QDict *qdict)
|
|||
|
||||
#ifdef CONFIG_VNC
|
||||
if (strcmp(device, "vnc") == 0) {
|
||||
if (read_only) {
|
||||
error_setg(&err, "Parameter 'read-only-mode' is invalid for VNC");
|
||||
goto end;
|
||||
}
|
||||
if (strcmp(target, "passwd") == 0 ||
|
||||
strcmp(target, "password") == 0) {
|
||||
if (!arg) {
|
||||
MonitorHMP *hmp_mon = container_of(mon, MonitorHMP, common);
|
||||
monitor_read_password(hmp_mon, hmp_change_read_arg, NULL);
|
||||
return;
|
||||
} else {
|
||||
qmp_change_vnc_password(arg, &err);
|
||||
}
|
||||
} else {
|
||||
error_setg(&err, "Expected 'password' after 'vnc'");
|
||||
goto end;
|
||||
}
|
||||
hmp_change_vnc(mon, device, target, arg, read_only, force, &err);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue