summaryrefslogtreecommitdiff
path: root/spice-qemu-char.c
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2011-03-24 11:12:04 +0100
committerAmit Shah <amit.shah@redhat.com>2011-04-28 11:02:31 +0530
commit025eb95a17149c1080d10cdeffce3484a3246776 (patch)
tree2ef26d7ad81cf8b4ee6715c602b0d9856447e0d0 /spice-qemu-char.c
parent1acc3ba424a97e868a1be88b6f67dd4a17fd430b (diff)
downloadqemu-025eb95a17149c1080d10cdeffce3484a3246776.tar.gz
qemu-025eb95a17149c1080d10cdeffce3484a3246776.tar.bz2
qemu-025eb95a17149c1080d10cdeffce3484a3246776.zip
spice-chardev: listen to frontend guest open / close
Note the vmc_register_interface() in spice_chr_write is left in place in case someone uses spice-chardev with a frontend which does not have guest open / close notification. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Alon Levy <alevy@redhat.com> Signed-off-by: Amit Shah <amit.shah@redhat.com>
Diffstat (limited to 'spice-qemu-char.c')
-rw-r--r--spice-qemu-char.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/spice-qemu-char.c b/spice-qemu-char.c
index 517f337c43..fa15a71e14 100644
--- a/spice-qemu-char.c
+++ b/spice-qemu-char.c
@@ -131,6 +131,18 @@ static void spice_chr_close(struct CharDriverState *chr)
qemu_free(s);
}
+static void spice_chr_guest_open(struct CharDriverState *chr)
+{
+ SpiceCharDriver *s = chr->opaque;
+ vmc_register_interface(s);
+}
+
+static void spice_chr_guest_close(struct CharDriverState *chr)
+{
+ SpiceCharDriver *s = chr->opaque;
+ vmc_unregister_interface(s);
+}
+
static void print_allowed_subtypes(void)
{
const char** psubtype;
@@ -183,6 +195,8 @@ CharDriverState *qemu_chr_open_spice(QemuOpts *opts)
chr->opaque = s;
chr->chr_write = spice_chr_write;
chr->chr_close = spice_chr_close;
+ chr->chr_guest_open = spice_chr_guest_open;
+ chr->chr_guest_close = spice_chr_guest_close;
qemu_chr_generic_open(chr);