qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Gonglei <arei.gonglei@huawei.com>,
	Gerd Hoffmann <kraxel@redhat.com>,
	Anthony Liguori <aliguori@amazon.com>
Subject: [Qemu-devel] [PULL 2/7] vnc: correct missing property about vnc_display
Date: Mon, 16 Feb 2015 09:26:00 +0100	[thread overview]
Message-ID: <1424075165-25016-3-git-send-email-kraxel@redhat.com> (raw)
In-Reply-To: <1424075165-25016-1-git-send-email-kraxel@redhat.com>

From: Gonglei <arei.gonglei@huawei.com>

Missing three property for vnc socket connection,
revalue display variable with correct way.

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 ui/vnc.c | 26 +++++++++++++++++++++++---
 1 file changed, 23 insertions(+), 3 deletions(-)

diff --git a/ui/vnc.c b/ui/vnc.c
index 90e8a88..6a82d7f 100644
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -3316,10 +3316,15 @@ void vnc_display_open(const char *id, Error **errp)
 {
     VncDisplay *vs = vnc_display_find(id);
     QemuOpts *opts = qemu_opts_find(&qemu_vnc_opts, id);
-    const char *display, *share, *device_id;
+    const char *share, *device_id;
     QemuConsole *con;
     int password = 0;
     int reverse = 0;
+    const char *vnc;
+    const char *has_to;
+    char *display, *to = NULL;
+    bool has_ipv4 = false;
+    bool has_ipv6 = false;
 #ifdef CONFIG_VNC_WS
     const char *websocket;
 #endif
@@ -3345,10 +3350,21 @@ void vnc_display_open(const char *id, Error **errp)
     if (!opts) {
         return;
     }
-    display = qemu_opt_get(opts, "vnc");
-    if (!display || strcmp(display, "none") == 0) {
+    vnc = qemu_opt_get(opts, "vnc");
+    if (!vnc || strcmp(vnc, "none") == 0) {
         return;
     }
+
+    has_to = qemu_opt_get(opts, "to");
+    if (has_to) {
+        to = g_strdup_printf(",to=%s", has_to);
+    }
+    has_ipv4 = qemu_opt_get_bool(opts, "ipv4", false);
+    has_ipv6 = qemu_opt_get_bool(opts, "ipv6", false);
+    display = g_strdup_printf("%s%s%s%s", vnc,
+                                  has_to ? to : "",
+                                  has_ipv4 ? ",ipv4" : "",
+                                  has_ipv6 ? ",ipv6" : "");
     vs->display = g_strdup(display);
 
     password = qemu_opt_get_bool(opts, "password", false);
@@ -3628,6 +3644,8 @@ void vnc_display_open(const char *id, Error **errp)
             }
 #endif /* CONFIG_VNC_WS */
         }
+        g_free(to);
+        g_free(display);
         g_free(vs->display);
         vs->display = dpy;
         qemu_set_fd_handler2(vs->lsock, NULL,
@@ -3642,6 +3660,8 @@ void vnc_display_open(const char *id, Error **errp)
     return;
 
 fail:
+    g_free(to);
+    g_free(display);
     g_free(vs->display);
     vs->display = NULL;
 #ifdef CONFIG_VNC_WS
-- 
1.8.3.1

  parent reply	other threads:[~2015-02-16  8:26 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-16  8:25 [Qemu-devel] [PULL 0/7] vnc: fixup some QemuOpts conversion fallout Gerd Hoffmann
2015-02-16  8:25 ` [Qemu-devel] [PULL 1/7] vnc: fix qemu crash when not configure vnc option Gerd Hoffmann
2015-02-16  8:26 ` Gerd Hoffmann [this message]
2015-02-16  8:26 ` [Qemu-devel] [PULL 3/7] vnc: using bool type instead of int for QEMU_OPT_BOOL Gerd Hoffmann
2015-02-16  8:26 ` [Qemu-devel] [PULL 4/7] vnc: introduce an wrapper for auto assign vnc id Gerd Hoffmann
2015-02-16  8:26 ` [Qemu-devel] [PULL 5/7] vnc: auto assian an id when calling change vnc qmp interface Gerd Hoffmann
2015-02-16  8:26 ` [Qemu-devel] [PULL 6/7] ui/vnc: optimize full scanline updates Gerd Hoffmann
2015-02-16  8:26 ` [Qemu-devel] [PULL 7/7] vnc: fix coverity warning Gerd Hoffmann
2015-02-24 12:58 ` [Qemu-devel] [PULL 0/7] vnc: fixup some QemuOpts conversion fallout Peter Maydell

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=1424075165-25016-3-git-send-email-kraxel@redhat.com \
    --to=kraxel@redhat.com \
    --cc=aliguori@amazon.com \
    --cc=arei.gonglei@huawei.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).