[Spice-devel] [PATCH v2] spice-vmc: add a reset handler used to unregister spice interface (and trigger server mouse)
Alon Levy
alevy at redhat.com
Tue Aug 31 04:57:43 PDT 2010
v2:
use qdev.reset instead of old API.
diff --git a/hw/spice-vmc.c b/hw/spice-vmc.c
index 434c70f..0636973 100644
--- a/hw/spice-vmc.c
+++ b/hw/spice-vmc.c
@@ -189,6 +189,15 @@ static void vmc_print_optional_subtypes(void)
fprintf(stderr, "\n");
}
+static void vmc_reset(DeviceState *opaque)
+{
+ VirtIOSerialPort *port = DO_UPCAST(VirtIOSerialPort, dev, opaque);
+ SpiceVirtualChannel *svc = DO_UPCAST(SpiceVirtualChannel, port, port);
+
+ dprintf(svc, 1, "%s\n", __func__);
+ vmc_unregister_interface(svc);
+}
+
static int vmc_initfn(VirtIOSerialDevice *dev)
{
VirtIOSerialPort *port = DO_UPCAST(VirtIOSerialPort, dev, &dev->qdev);
@@ -241,6 +250,7 @@ static int vmc_exitfn(VirtIOSerialDevice *dev)
static VirtIOSerialPortInfo vmc_info = {
.qdev.name = VMC_DEVICE_NAME,
.qdev.size = sizeof(SpiceVirtualChannel),
+ .qdev.reset = vmc_reset,
.init = vmc_initfn,
.exit = vmc_exitfn,
.guest_open = vmc_guest_open,
More information about the Spice-devel
mailing list