From: Hans de Goede <hdegoede@redhat.com>
To: qemu-devel@nongnu.org
Cc: Hans de Goede <hdegoede@redhat.com>
Subject: [Qemu-devel] [PATCH 2/3] virtio-console: notify backend of guest open / close
Date: Thu, 24 Mar 2011 11:12:03 +0100 [thread overview]
Message-ID: <1300961524-6205-3-git-send-email-hdegoede@redhat.com> (raw)
In-Reply-To: <1300961524-6205-1-git-send-email-hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
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 c235b27..e635771 100644
--- a/hw/virtio-console.c
+++ b/hw/virtio-console.c
@@ -27,6 +27,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)
{
@@ -63,6 +79,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.3.2
next prev parent reply other threads:[~2011-03-24 10:09 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-24 10:12 [Qemu-devel] [PATCH 0/3] spicevmc -> chardev: restore guest open / close (v2) Hans de Goede
2011-03-24 10:12 ` [Qemu-devel] [PATCH 1/3] chardev: Allow frontends to notify backends of guest open / close Hans de Goede
2011-03-24 10:12 ` Hans de Goede [this message]
2011-03-24 10:12 ` [Qemu-devel] [PATCH 3/3] spice-chardev: listen to frontend " Hans de Goede
2011-03-24 10:44 ` [Qemu-devel] [PATCH 0/3] spicevmc -> chardev: restore guest open / close (v2) Alon Levy
2011-04-25 10:25 ` Amit Shah
-- strict thread matches above, loose matches on Subject: below --
2011-03-22 13:15 [Qemu-devel] [PATCH 0/3] spicevmc -> chardev: restore guest open / close notifcation Hans de Goede
2011-03-22 13:15 ` [Qemu-devel] [PATCH 2/3] virtio-console: notify backend of guest open / close Hans de Goede
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1300961524-6205-3-git-send-email-hdegoede@redhat.com \
--to=hdegoede@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).