diff options
author | Hans de Goede <hdegoede@redhat.com> | 2011-03-24 11:12:02 +0100 |
---|---|---|
committer | Amit Shah <amit.shah@redhat.com> | 2011-04-28 11:02:21 +0530 |
commit | 7c32c4feebd962960fb160291a426b983e0ae668 (patch) | |
tree | 1757d459bbb1202e0e2a377862805e49fb9c0437 /qemu-char.c | |
parent | a7d3970d0635ebce1412736e7aaf11d387919dc8 (diff) | |
download | qemu-7c32c4feebd962960fb160291a426b983e0ae668.zip qemu-7c32c4feebd962960fb160291a426b983e0ae668.tar.gz qemu-7c32c4feebd962960fb160291a426b983e0ae668.tar.bz2 |
chardev: Allow frontends to notify backends of guest open / close
Some frontends know when the guest has opened the "channel" and is actively
listening to it, for example virtio-serial. This patch adds 2 new qemu-chardev
functions which can be used by frontends to signal guest open / close, and
allows interested backends to listen to this.
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 'qemu-char.c')
-rw-r--r-- | qemu-char.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/qemu-char.c b/qemu-char.c index 03858d4..710d98f 100644 --- a/qemu-char.c +++ b/qemu-char.c @@ -480,6 +480,9 @@ static CharDriverState *qemu_chr_open_mux(CharDriverState *drv) chr->chr_write = mux_chr_write; chr->chr_update_read_handler = mux_chr_update_read_handler; chr->chr_accept_input = mux_chr_accept_input; + /* Frontend guest-open / -close notification is not support with muxes */ + chr->chr_guest_open = NULL; + chr->chr_guest_close = NULL; /* Muxes are always open on creation */ qemu_chr_generic_open(chr); @@ -2579,6 +2582,20 @@ void qemu_chr_set_echo(struct CharDriverState *chr, bool echo) } } +void qemu_chr_guest_open(struct CharDriverState *chr) +{ + if (chr->chr_guest_open) { + chr->chr_guest_open(chr); + } +} + +void qemu_chr_guest_close(struct CharDriverState *chr) +{ + if (chr->chr_guest_close) { + chr->chr_guest_close(chr); + } +} + void qemu_chr_close(CharDriverState *chr) { QTAILQ_REMOVE(&chardevs, chr, next); |