aboutsummaryrefslogtreecommitdiff
path: root/ui/spice-core.c
diff options
context:
space:
mode:
Diffstat (limited to 'ui/spice-core.c')
-rw-r--r--ui/spice-core.c31
1 files changed, 21 insertions, 10 deletions
diff --git a/ui/spice-core.c b/ui/spice-core.c
index 47700b2200..eea52f5389 100644
--- a/ui/spice-core.c
+++ b/ui/spice-core.c
@@ -48,7 +48,6 @@ static time_t auth_expires = TIME_MAX;
static int spice_migration_completed;
static int spice_display_is_running;
static int spice_have_target_host;
-int using_spice = 0;
static QemuThread me;
@@ -503,7 +502,7 @@ static QemuOptsList qemu_spice_opts = {
},
};
-SpiceInfo *qmp_query_spice(Error **errp)
+static SpiceInfo *qmp_query_spice_real(Error **errp)
{
QemuOpts *opts = QTAILQ_FIRST(&qemu_spice_opts.head);
int port, tls_port;
@@ -634,7 +633,7 @@ static void vm_change_state_handler(void *opaque, int running,
}
}
-void qemu_spice_init(void)
+static void qemu_spice_init(void)
{
QemuOpts *opts = QTAILQ_FIRST(&qemu_spice_opts.head);
const char *password, *str, *x509_dir, *addr,
@@ -728,7 +727,7 @@ void qemu_spice_init(void)
tls_ciphers);
}
if (password) {
- qemu_spice_set_passwd(password, false, false);
+ qemu_spice.set_passwd(password, false, false);
}
if (qemu_opt_get_bool(opts, "sasl", 0)) {
if (spice_server_set_sasl(spice_server, 1) == -1) {
@@ -801,7 +800,7 @@ void qemu_spice_init(void)
migration_state.notify = migration_state_notifier;
add_migration_state_change_notifier(&migration_state);
spice_migrate.base.sif = &migrate_interface.base;
- qemu_spice_add_interface(&spice_migrate.base);
+ qemu_spice.add_interface(&spice_migrate.base);
qemu_spice_input_init();
@@ -830,7 +829,7 @@ void qemu_spice_init(void)
#endif
}
-int qemu_spice_add_interface(SpiceBaseInstance *sin)
+static int qemu_spice_add_interface(SpiceBaseInstance *sin)
{
if (!spice_server) {
if (QTAILQ_FIRST(&qemu_spice_opts.head) != NULL) {
@@ -942,8 +941,8 @@ static int qemu_spice_set_ticket(bool fail_if_conn, bool disconnect_if_conn)
fail_if_conn, disconnect_if_conn);
}
-int qemu_spice_set_passwd(const char *passwd,
- bool fail_if_conn, bool disconnect_if_conn)
+static int qemu_spice_set_passwd(const char *passwd,
+ bool fail_if_conn, bool disconnect_if_conn)
{
if (strcmp(auth, "spice") != 0) {
return -1;
@@ -954,13 +953,13 @@ int qemu_spice_set_passwd(const char *passwd,
return qemu_spice_set_ticket(fail_if_conn, disconnect_if_conn);
}
-int qemu_spice_set_pw_expire(time_t expires)
+static int qemu_spice_set_pw_expire(time_t expires)
{
auth_expires = expires;
return qemu_spice_set_ticket(false, false);
}
-int qemu_spice_display_add_client(int csock, int skipauth, int tls)
+static int qemu_spice_display_add_client(int csock, int skipauth, int tls)
{
if (tls) {
return spice_server_add_ssl_client(spice_server, csock, skipauth);
@@ -994,8 +993,20 @@ int qemu_spice_display_is_running(SimpleSpiceDisplay *ssd)
return spice_display_is_running;
}
+static struct QemuSpiceOps real_spice_ops = {
+ .init = qemu_spice_init,
+ .display_init = qemu_spice_display_init,
+ .migrate_info = qemu_spice_migrate_info,
+ .set_passwd = qemu_spice_set_passwd,
+ .set_pw_expire = qemu_spice_set_pw_expire,
+ .display_add_client = qemu_spice_display_add_client,
+ .add_interface = qemu_spice_add_interface,
+ .qmp_query = qmp_query_spice_real,
+};
+
static void spice_register_config(void)
{
+ qemu_spice = real_spice_ops;
qemu_add_opts(&qemu_spice_opts);
}
opts_init(spice_register_config);