[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 2/6] virtio-console: notify backend of guest open /
From: |
Amit Shah |
Subject: |
[Qemu-devel] [PATCH 2/6] virtio-console: notify backend of guest open / close |
Date: |
Thu, 28 Apr 2011 13:00:49 +0530 |
From: Hans de Goede <address@hidden>
Signed-off-by: Hans de Goede <address@hidden>
Reviewed-by: Alon Levy <address@hidden>
Signed-off-by: Amit Shah <address@hidden>
---
hw/virtio-console.c | 18 ++++++++++++++++++
1 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/hw/virtio-console.c b/hw/virtio-console.c
index 6b5237b..de539c4 100644
--- a/hw/virtio-console.c
+++ b/hw/virtio-console.c
@@ -28,6 +28,22 @@ static ssize_t flush_buf(VirtIOSerialPort *port, const
uint8_t *buf, size_t len)
return qemu_chr_write(vcon->chr, buf, len);
}
+/* Callback function that's called when the guest opens the port */
+static void guest_open(VirtIOSerialPort *port)
+{
+ VirtConsole *vcon = DO_UPCAST(VirtConsole, port, port);
+
+ qemu_chr_guest_open(vcon->chr);
+}
+
+/* Callback function that's called when the guest closes the port */
+static void guest_close(VirtIOSerialPort *port)
+{
+ VirtConsole *vcon = DO_UPCAST(VirtConsole, port, port);
+
+ qemu_chr_guest_close(vcon->chr);
+}
+
/* Readiness of the guest to accept data on a port */
static int chr_can_read(void *opaque)
{
@@ -64,6 +80,8 @@ static int generic_port_init(VirtConsole *vcon,
VirtIOSerialPort *port)
qemu_chr_add_handlers(vcon->chr, chr_can_read, chr_read, chr_event,
vcon);
vcon->port.info->have_data = flush_buf;
+ vcon->port.info->guest_open = guest_open;
+ vcon->port.info->guest_close = guest_close;
}
return 0;
}
--
1.7.4.4
- [Qemu-devel] [PULL] char, virtio-serial, spice, Amit Shah, 2011/04/28
- [Qemu-devel] [PATCH 3/6] spice-chardev: listen to frontend guest open / close, Amit Shah, 2011/04/28
- [Qemu-devel] [PATCH 1/6] chardev: Allow frontends to notify backends of guest open / close, Amit Shah, 2011/04/28
- [Qemu-devel] [PATCH 4/6] char: Allow devices to use a single multiplexed chardev., Amit Shah, 2011/04/28
- [Qemu-devel] [PATCH 2/6] virtio-console: notify backend of guest open / close,
Amit Shah <=
- [Qemu-devel] [PATCH 5/6] char: Detect chardev release by NULL handlers as well as NULL opaque, Amit Shah, 2011/04/28
- [Qemu-devel] [PATCH 6/6] virtio-serial: Fix endianness bug in the config space, Amit Shah, 2011/04/28
- Re: [Qemu-devel] [PULL] char, virtio-serial, spice, Anthony Liguori, 2011/04/28