|
Justin M. Forbes |
252f3a |
>From c169795bed5374f0071af201da2dd32b3c5a2417 Mon Sep 17 00:00:00 2001
|
|
Justin M. Forbes |
252f3a |
From: Hans de Goede <hdegoede@redhat.com>
|
|
Justin M. Forbes |
252f3a |
Date: Fri, 18 Mar 2011 15:35:27 +0100
|
|
Justin M. Forbes |
252f3a |
Subject: [PATCH 17/17] spice-chardev: listen to frontend guest open / close
|
|
Justin M. Forbes |
252f3a |
|
|
Justin M. Forbes |
252f3a |
Note the vmc_register_interface() in spice_chr_write is left in place
|
|
Justin M. Forbes |
252f3a |
in case someone uses spice-chardev with a frontend which does not have
|
|
Justin M. Forbes |
252f3a |
guest open / close notification.
|
|
Justin M. Forbes |
252f3a |
|
|
Justin M. Forbes |
252f3a |
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
Justin M. Forbes |
252f3a |
---
|
|
Justin M. Forbes |
252f3a |
spice-qemu-char.c | 14 ++++++++++++++
|
|
Justin M. Forbes |
252f3a |
1 files changed, 14 insertions(+), 0 deletions(-)
|
|
Justin M. Forbes |
252f3a |
|
|
Justin M. Forbes |
252f3a |
diff --git a/spice-qemu-char.c b/spice-qemu-char.c
|
|
Justin M. Forbes |
252f3a |
index ed7851e..343146c 100644
|
|
Justin M. Forbes |
252f3a |
--- a/spice-qemu-char.c
|
|
Justin M. Forbes |
252f3a |
+++ b/spice-qemu-char.c
|
|
Justin M. Forbes |
252f3a |
@@ -155,6 +155,18 @@ static void spice_chr_close(struct CharDriverState *chr)
|
|
Justin M. Forbes |
252f3a |
qemu_free(s);
|
|
Justin M. Forbes |
252f3a |
}
|
|
Justin M. Forbes |
252f3a |
|
|
Justin M. Forbes |
252f3a |
+static void spice_chr_guest_open(struct CharDriverState *chr)
|
|
Justin M. Forbes |
252f3a |
+{
|
|
Justin M. Forbes |
252f3a |
+ SpiceCharDriver *s = chr->opaque;
|
|
Justin M. Forbes |
252f3a |
+ vmc_register_interface(s);
|
|
Justin M. Forbes |
252f3a |
+}
|
|
Justin M. Forbes |
252f3a |
+
|
|
Justin M. Forbes |
252f3a |
+static void spice_chr_guest_close(struct CharDriverState *chr)
|
|
Justin M. Forbes |
252f3a |
+{
|
|
Justin M. Forbes |
252f3a |
+ SpiceCharDriver *s = chr->opaque;
|
|
Justin M. Forbes |
252f3a |
+ vmc_unregister_interface(s);
|
|
Justin M. Forbes |
252f3a |
+}
|
|
Justin M. Forbes |
252f3a |
+
|
|
Justin M. Forbes |
252f3a |
static void print_allowed_subtypes(void)
|
|
Justin M. Forbes |
252f3a |
{
|
|
Justin M. Forbes |
252f3a |
const char** psubtype;
|
|
Justin M. Forbes |
252f3a |
@@ -207,6 +219,8 @@ CharDriverState *qemu_chr_open_spice(QemuOpts *opts)
|
|
Justin M. Forbes |
252f3a |
chr->opaque = s;
|
|
Justin M. Forbes |
252f3a |
chr->chr_write = spice_chr_write;
|
|
Justin M. Forbes |
252f3a |
chr->chr_close = spice_chr_close;
|
|
Justin M. Forbes |
252f3a |
+ chr->chr_guest_open = spice_chr_guest_open;
|
|
Justin M. Forbes |
252f3a |
+ chr->chr_guest_close = spice_chr_guest_close;
|
|
Justin M. Forbes |
252f3a |
s->unblock_timer = qemu_new_timer(vm_clock, spice_chr_unblock, s);
|
|
Justin M. Forbes |
252f3a |
|
|
Justin M. Forbes |
252f3a |
qemu_chr_generic_open(chr);
|
|
Justin M. Forbes |
252f3a |
--
|
|
Justin M. Forbes |
252f3a |
1.7.3.2
|
|
Justin M. Forbes |
252f3a |
|