aboutsummaryrefslogtreecommitdiff
path: root/vl.c
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2014-09-16 12:33:03 +0200
committerGerd Hoffmann <kraxel@redhat.com>2015-01-22 11:18:46 +0100
commit4db14629c38611061fc19ec6927405923de84f08 (patch)
tree91f5a9dbe009f55a16654f426d8484ccdc42c671 /vl.c
parentc8496408b443a2a34dd03ad4274c2575248aa3e8 (diff)
vnc: switch to QemuOpts, allow multiple servers
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 <kraxel@redhat.com>
Diffstat (limited to 'vl.c')
-rw-r--r--vl.c42
1 files changed, 13 insertions, 29 deletions
diff --git a/vl.c b/vl.c
index 9fb32c13df..983259bc9f 100644
--- a/vl.c
+++ b/vl.c
@@ -158,9 +158,6 @@ int smp_cpus = 1;
int max_cpus = 0;
int smp_cores = 1;
int smp_threads = 1;
-#ifdef CONFIG_VNC
-const char *vnc_display;
-#endif
int acpi_enabled = 1;
int no_hpet = 0;
int fd_bootchk = 1;
@@ -2002,16 +1999,12 @@ static DisplayType select_display(const char *p)
#endif
} else if (strstart(p, "vnc", &opts)) {
#ifdef CONFIG_VNC
- display_remote++;
-
- if (*opts) {
- const char *nextopt;
-
- if (strstart(opts, "=", &nextopt)) {
- vnc_display = nextopt;
+ if (*opts == '=') {
+ display_remote++;
+ if (vnc_parse_func(opts+1) == NULL) {
+ exit(1);
}
- }
- if (!vnc_display) {
+ } else {
fprintf(stderr, "VNC requires a display argument vnc=<display>\n");
exit(1);
}
@@ -3479,7 +3472,9 @@ int main(int argc, char **argv, char **envp)
case QEMU_OPTION_vnc:
#ifdef CONFIG_VNC
display_remote++;
- vnc_display = optarg;
+ if (vnc_parse_func(optarg) == NULL) {
+ exit(1);
+ }
#else
fprintf(stderr, "VNC support is disabled\n");
exit(1);
@@ -3975,7 +3970,7 @@ int main(int argc, char **argv, char **envp)
#elif defined(CONFIG_SDL) || defined(CONFIG_COCOA)
display_type = DT_SDL;
#elif defined(CONFIG_VNC)
- vnc_display = "localhost:0,to=99";
+ vnc_parse_func("localhost:0,to=99,id=default");
show_vnc_port = 1;
#else
display_type = DT_NONE;
@@ -4286,21 +4281,10 @@ int main(int argc, char **argv, char **envp)
#ifdef CONFIG_VNC
/* init remote displays */
- if (vnc_display) {
- Error *local_err = NULL;
- const char *id = "default";
- vnc_display_init(id);
- vnc_display_open(id, vnc_display, &local_err);
- if (local_err != NULL) {
- error_report("Failed to start VNC server on `%s': %s",
- vnc_display, error_get_pretty(local_err));
- error_free(local_err);
- exit(1);
- }
-
- if (show_vnc_port) {
- printf("VNC server running on `%s'\n", vnc_display_local_addr(id));
- }
+ qemu_opts_foreach(qemu_find_opts("vnc"), vnc_init_func, NULL, 0);
+ if (show_vnc_port) {
+ printf("VNC server running on `%s'\n",
+ vnc_display_local_addr("default"));
}
#endif
#ifdef CONFIG_SPICE