vnc: fixup some QemuOpts conversion fallout.
-----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQIcBAABAgAGBQJU4aasAAoJEEy22O7T6HE4B2sQALOYATw+4GG6dd3ngJhNOXAx jt/M9QyoYAnmw3BD7Sw/MV7fl7n19rEoruL5aQ+Q1mqETkBKq4/dPXqw5NSLEaQB zMBQfw3QpRn9IKkWc7z1nOSm322RYsvd+2TG6OV0i8Q4et/sHYoXXozRkQUPVFXX U5ESuDjUp8O6VbF+G/6L51t6liseRhkHW8hgsfnELeVYwyXMSCPSXVIXCkif2jko cyiD7lwtUdLAwICM4truc0D+aKQoFhkIkEFpwtGb0a8ZHdwx00Apb8OBZGhP8PDt xZvPrEnMcCUpPQrvyMrTTflwW/uSO7UBhbs5lQ8GJqYu5HA5z9KjuH7UJF5XfQhN pJI6rF6qjHXbfeygRidYu5o+pinltnpyPOWgaPgY2+i/LE/DuYlUV7o001LUeLae f3uKu1OIQLJE7hpB18wDMV89muQcsiPSYeHEHaThf9a/3Elh1U2JhfFbdoB51lyB Elu17PNKRYDQGsUFcH7AcHYuLRvrzg47dO+2E/Op4OrFoR8SCoFsreG0Cibp+mhb scwQHZUA9z9IQoCP06RnsGpKCsfVy9hRlf8enwaJsxFyh+ml8jpziywReJD+5eE0 I2AeNqyJWFL39yyZD464ffoXyuNSDtFjGO3+Kx53nUK3Uclp+Ot1ETlaSeGsIKY0 qCi/r1+ZWZ5rlG7k0yMU =Z1qf -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/kraxel/tags/pull-vnc-20150216-1' into staging vnc: fixup some QemuOpts conversion fallout. # gpg: Signature made Mon Feb 16 08:13:32 2015 GMT using RSA key ID D3E87138 # gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>" # gpg: aka "Gerd Hoffmann <gerd@kraxel.org>" # gpg: aka "Gerd Hoffmann (private) <kraxel@gmail.com>" * remotes/kraxel/tags/pull-vnc-20150216-1: vnc: fix coverity warning ui/vnc: optimize full scanline updates vnc: auto assian an id when calling change vnc qmp interface vnc: introduce an wrapper for auto assign vnc id vnc: using bool type instead of int for QEMU_OPT_BOOL vnc: correct missing property about vnc_display vnc: fix qemu crash when not configure vnc option Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
3dd2d1a339
|
@ -335,6 +335,7 @@ 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);
|
||||
|
|
5
qmp.c
5
qmp.c
|
@ -387,6 +387,11 @@ static void qmp_change_vnc_listen(const char *target, Error **errp)
|
|||
qemu_opts_del(opts);
|
||||
}
|
||||
opts = vnc_parse_func(target);
|
||||
if (!opts) {
|
||||
return;
|
||||
}
|
||||
|
||||
vnc_auto_assign_id(olist, opts);
|
||||
vnc_display_open("default", errp);
|
||||
}
|
||||
|
||||
|
|
74
ui/vnc.c
74
ui/vnc.c
|
@ -1111,6 +1111,12 @@ static int vnc_update_client(VncState *vs, int has_dirty, bool sync)
|
|||
n += vnc_job_add_rect(job, x * VNC_DIRTY_PIXELS_PER_BIT, y,
|
||||
(x2 - x) * VNC_DIRTY_PIXELS_PER_BIT, h);
|
||||
}
|
||||
if (!x && x2 == width / VNC_DIRTY_PIXELS_PER_BIT) {
|
||||
y += h;
|
||||
if (y == height) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
vnc_job_push(job);
|
||||
|
@ -3242,6 +3248,7 @@ char *vnc_display_local_addr(const char *id)
|
|||
{
|
||||
VncDisplay *vs = vnc_display_find(id);
|
||||
|
||||
assert(vs);
|
||||
return vnc_socket_local_addr("%s:%s", vs->lsock);
|
||||
}
|
||||
|
||||
|
@ -3271,6 +3278,15 @@ static QemuOptsList qemu_vnc_opts = {
|
|||
},{
|
||||
.name = "connections",
|
||||
.type = QEMU_OPT_NUMBER,
|
||||
},{
|
||||
.name = "to",
|
||||
.type = QEMU_OPT_NUMBER,
|
||||
},{
|
||||
.name = "ipv4",
|
||||
.type = QEMU_OPT_BOOL,
|
||||
},{
|
||||
.name = "ipv6",
|
||||
.type = QEMU_OPT_BOOL,
|
||||
},{
|
||||
.name = "password",
|
||||
.type = QEMU_OPT_BOOL,
|
||||
|
@ -3307,19 +3323,24 @@ 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;
|
||||
bool password = false;
|
||||
bool reverse = false;
|
||||
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
|
||||
#ifdef CONFIG_VNC_TLS
|
||||
int tls = 0, x509 = 0;
|
||||
bool tls = false, x509 = false;
|
||||
const char *path;
|
||||
#endif
|
||||
#ifdef CONFIG_VNC_SASL
|
||||
int sasl = 0;
|
||||
bool sasl = false;
|
||||
int saslErr;
|
||||
#endif
|
||||
#if defined(CONFIG_VNC_TLS) || defined(CONFIG_VNC_SASL)
|
||||
|
@ -3336,10 +3357,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);
|
||||
|
@ -3360,7 +3392,7 @@ void vnc_display_open(const char *id, Error **errp)
|
|||
tls = qemu_opt_get_bool(opts, "tls", false);
|
||||
path = qemu_opt_get(opts, "x509");
|
||||
if (path) {
|
||||
x509 = 1;
|
||||
x509 = true;
|
||||
vs->tls.x509verify = qemu_opt_get_bool(opts, "x509verify", false);
|
||||
if (vnc_tls_set_x509_creds_dir(vs, path) < 0) {
|
||||
error_setg(errp, "Failed to find x509 certificates/keys in %s",
|
||||
|
@ -3619,6 +3651,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,
|
||||
|
@ -3633,6 +3667,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
|
||||
|
@ -3656,6 +3692,19 @@ 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)
|
||||
{
|
||||
int i = 2;
|
||||
char *id;
|
||||
|
||||
id = g_strdup("default");
|
||||
while (qemu_opts_find(olist, id)) {
|
||||
g_free(id);
|
||||
id = g_strdup_printf("vnc%d", i++);
|
||||
}
|
||||
qemu_opts_set_id(opts, id);
|
||||
}
|
||||
|
||||
int vnc_init_func(QemuOpts *opts, void *opaque)
|
||||
{
|
||||
Error *local_err = NULL;
|
||||
|
@ -3664,13 +3713,8 @@ int vnc_init_func(QemuOpts *opts, void *opaque)
|
|||
|
||||
if (!id) {
|
||||
/* auto-assign id if not present */
|
||||
int i = 2;
|
||||
id = g_strdup("default");
|
||||
while (qemu_opts_find(olist, id)) {
|
||||
g_free(id);
|
||||
id = g_strdup_printf("vnc%d", i++);
|
||||
}
|
||||
qemu_opts_set_id(opts, id);
|
||||
vnc_auto_assign_id(olist, opts);
|
||||
id = (char *)qemu_opts_id(opts);
|
||||
}
|
||||
|
||||
vnc_display_init(id);
|
||||
|
|
Loading…
Reference in a new issue