From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Luiz Capitulino <lcapitulino@redhat.com>,
armbru@redhat.com, Anthony Liguori <aliguori@amazon.com>,
Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [PATCH 1/2] vnc: set id at parse time not init time
Date: Tue, 17 Feb 2015 10:02:26 +0100 [thread overview]
Message-ID: <1424163747-27927-2-git-send-email-kraxel@redhat.com> (raw)
In-Reply-To: <1424163747-27927-1-git-send-email-kraxel@redhat.com>
This way the generated id will be stored in -writeconfig cfg files.
Also we can make vnc_auto_assign_id() local to vnc.c.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
include/ui/console.h | 1 -
qmp.c | 1 -
ui/vnc.c | 22 ++++++++++++----------
3 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/include/ui/console.h b/include/ui/console.h
index 5c19c3c..8a4d671 100644
--- a/include/ui/console.h
+++ b/include/ui/console.h
@@ -335,7 +335,6 @@ void vnc_display_init(const char *id);
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);
-void vnc_auto_assign_id(QemuOptsList *olist, QemuOpts *opts);
#ifdef CONFIG_VNC
int vnc_display_password(const char *id, const char *password);
int vnc_display_pw_expire(const char *id, time_t expires);
diff --git a/qmp.c b/qmp.c
index d701cff..c479e77 100644
--- a/qmp.c
+++ b/qmp.c
@@ -391,7 +391,6 @@ static void qmp_change_vnc_listen(const char *target, Error **errp)
return;
}
- vnc_auto_assign_id(olist, opts);
vnc_display_open("default", errp);
}
diff --git a/ui/vnc.c b/ui/vnc.c
index 10a2724..ff0b5bd 100644
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -3687,12 +3687,7 @@ void vnc_display_add_client(const char *id, int csock, bool skipauth)
vnc_connect(vs, csock, skipauth, false);
}
-QemuOpts *vnc_parse_func(const char *str)
-{
- return qemu_opts_parse(qemu_find_opts("vnc"), str, 1);
-}
-
-void vnc_auto_assign_id(QemuOptsList *olist, QemuOpts *opts)
+static void vnc_auto_assign_id(QemuOptsList *olist, QemuOpts *opts)
{
int i = 2;
char *id;
@@ -3705,18 +3700,25 @@ void vnc_auto_assign_id(QemuOptsList *olist, QemuOpts *opts)
qemu_opts_set_id(opts, id);
}
-int vnc_init_func(QemuOpts *opts, void *opaque)
+QemuOpts *vnc_parse_func(const char *str)
{
- Error *local_err = NULL;
QemuOptsList *olist = qemu_find_opts("vnc");
- char *id = (char *)qemu_opts_id(opts);
+ QemuOpts *opts = qemu_opts_parse(olist, str, 1);
+ const char *id = qemu_opts_id(opts);
if (!id) {
/* auto-assign id if not present */
vnc_auto_assign_id(olist, opts);
- id = (char *)qemu_opts_id(opts);
}
+ return opts;
+}
+
+int vnc_init_func(QemuOpts *opts, void *opaque)
+{
+ Error *local_err = NULL;
+ char *id = (char *)qemu_opts_id(opts);
+ assert(id);
vnc_display_init(id);
vnc_display_open(id, &local_err);
if (local_err != NULL) {
--
1.8.3.1
next prev parent reply other threads:[~2015-02-17 9:02 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-17 9:02 [Qemu-devel] [PATCH 0/2] vnc: -readconfig fixups Gerd Hoffmann
2015-02-17 9:02 ` Gerd Hoffmann [this message]
2015-02-17 9:02 ` [Qemu-devel] [PATCH 2/2] vnc: -readconfig fix Gerd Hoffmann
2015-02-17 12:19 ` [Qemu-devel] [PATCH 0/2] vnc: -readconfig fixups Markus Armbruster
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1424163747-27927-2-git-send-email-kraxel@redhat.com \
--to=kraxel@redhat.com \
--cc=aliguori@amazon.com \
--cc=armbru@redhat.com \
--cc=lcapitulino@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).