[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 04/10] vnc: switch to QemuOpts, allow multiple s
From: |
Markus Armbruster |
Subject: |
Re: [Qemu-devel] [PATCH 04/10] vnc: switch to QemuOpts, allow multiple servers |
Date: |
Fri, 13 Feb 2015 19:30:40 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) |
One more question...
Gerd Hoffmann <address@hidden> writes:
> This patch switches vnc over to QemuOpts, and it (more or less
> as side effect) allows multiple vnc server instances.
>
> Signed-off-by: Gerd Hoffmann <address@hidden>
> ---
> include/ui/console.h | 4 +-
> qmp.c | 15 ++-
> ui/vnc.c | 270
> ++++++++++++++++++++++++++++++++-------------------
> vl.c | 42 +++-----
> 4 files changed, 199 insertions(+), 132 deletions(-)
>
> diff --git a/include/ui/console.h b/include/ui/console.h
> index 5ff2e27..887ed91 100644
> --- a/include/ui/console.h
> +++ b/include/ui/console.h
> @@ -328,12 +328,14 @@ void cocoa_display_init(DisplayState *ds, int
> full_screen);
>
> /* vnc.c */
> void vnc_display_init(const char *id);
> -void vnc_display_open(const char *id, const char *display, Error **errp);
> +void vnc_display_open(const char *id, Error **errp);
> void vnc_display_add_client(const char *id, int csock, bool skipauth);
> char *vnc_display_local_addr(const char *id);
> #ifdef CONFIG_VNC
> int vnc_display_password(const char *id, const char *password);
> int vnc_display_pw_expire(const char *id, time_t expires);
> +QemuOpts *vnc_parse_func(const char *str);
> +int vnc_init_func(QemuOpts *opts, void *opaque);
> #else
> static inline int vnc_display_password(const char *id, const char *password)
> {
> diff --git a/qmp.c b/qmp.c
> index 0b4f131..963305c 100644
> --- a/qmp.c
> +++ b/qmp.c
> @@ -368,7 +368,20 @@ void qmp_change_vnc_password(const char *password, Error
> **errp)
>
> static void qmp_change_vnc_listen(const char *target, Error **errp)
> {
> - vnc_display_open(NULL, target, errp);
> + QemuOptsList *olist = qemu_find_opts("vnc");
> + QemuOpts *opts;
> +
> + if (strstr(target, "id=")) {
> + error_setg(errp, "id not supported");
> + return;
> + }
> +
> + opts = qemu_opts_find(olist, "default");
> + if (opts) {
> + qemu_opts_del(opts);
> + }
> + opts = vnc_parse_func(target);
> + vnc_display_open("default", errp);
vnc_parse_func() can fail. Shouldn't we keep the old display
configuration then?
> }
>
[...]