@@ -18,10 +18,17 @@
#ifndef QEMU_SPICE_MODULE_H
#define QEMU_SPICE_MODULE_H
+#ifdef CONFIG_SPICE
+#include <spice.h>
+#endif
+
struct QemuSpiceOps {
void (*init)(void);
void (*display_init)(void);
int (*migrate_info)(const char *h, int p, int t, const char *s);
+#ifdef CONFIG_SPICE
+ int (*add_interface)(SpiceBaseInstance *sin);
+#endif
};
extern int using_spice;
@@ -29,7 +29,6 @@
void qemu_spice_input_init(void);
void qemu_spice_display_init(void);
int qemu_spice_display_add_client(int csock, int skipauth, int tls);
-int qemu_spice_add_interface(SpiceBaseInstance *sin);
bool qemu_spice_have_display_interface(QemuConsole *con);
int qemu_spice_add_display_interface(QXLInstance *qxlin, QemuConsole *con);
int qemu_spice_set_passwd(const char *passwd,
@@ -106,7 +106,7 @@ static int line_out_init(HWVoiceOut *hw, struct audsettings *as,
out->active = 0;
out->sin.base.sif = &playback_sif.base;
- qemu_spice_add_interface (&out->sin.base);
+ qemu_spice.add_interface(&out->sin.base);
#if SPICE_INTERFACE_PLAYBACK_MAJOR > 1 || SPICE_INTERFACE_PLAYBACK_MINOR >= 3
spice_server_set_playback_rate(&out->sin, settings.freq);
#endif
@@ -215,7 +215,7 @@ static int line_in_init(HWVoiceIn *hw, struct audsettings *as, void *drv_opaque)
in->active = 0;
in->sin.base.sif = &record_sif.base;
- qemu_spice_add_interface (&in->sin.base);
+ qemu_spice.add_interface(&in->sin.base);
#if SPICE_INTERFACE_RECORD_MAJOR > 2 || SPICE_INTERFACE_RECORD_MINOR >= 3
spice_server_set_record_rate(&in->sin, settings.freq);
#endif
@@ -110,7 +110,7 @@ static void vmc_register_interface(SpiceChardev *scd)
return;
}
scd->sin.base.sif = &vmc_interface.base;
- qemu_spice_add_interface(&scd->sin.base);
+ qemu_spice.add_interface(&scd->sin.base);
scd->active = true;
trace_spice_vmc_register_interface(scd);
}
@@ -800,7 +800,7 @@ static 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();
@@ -829,7 +829,7 @@ static 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) {
@@ -997,6 +997,7 @@ static struct QemuSpiceOps real_spice_ops = {
.init = qemu_spice_init,
.display_init = qemu_spice_display_init,
.migrate_info = qemu_spice_migrate_info,
+ .add_interface = qemu_spice_add_interface,
};
static void spice_register_config(void)
@@ -231,7 +231,7 @@ static void mouse_mode_notifier(Notifier *notifier, void *data)
}
if (is_absolute) {
- qemu_spice_add_interface(&pointer->tablet.base);
+ qemu_spice.add_interface(&pointer->tablet.base);
} else {
spice_server_remove_interface(&pointer->tablet.base);
}
@@ -245,13 +245,13 @@ void qemu_spice_input_init(void)
kbd = g_malloc0(sizeof(*kbd));
kbd->sin.base.sif = &kbd_interface.base;
- qemu_spice_add_interface(&kbd->sin.base);
+ qemu_spice.add_interface(&kbd->sin.base);
qemu_add_led_event_handler(kbd_leds, kbd);
pointer = g_malloc0(sizeof(*pointer));
pointer->mouse.base.sif = &mouse_interface.base;
pointer->tablet.base.sif = &tablet_interface.base;
- qemu_spice_add_interface(&pointer->mouse.base);
+ qemu_spice.add_interface(&pointer->mouse.base);
pointer->absolute = false;
pointer->mouse_mode.notify = mouse_mode_notifier;