From: "Denis V. Lunev" <den@openvz.org>
To: qemu-devel@nongnu.org
Cc: "Anton Nefedov" <anton.nefedov@virtuozzo.com>,
"Denis V . Lunev" <den@openvz.org>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>,
"Dr. David Alan Gilbert" <dgilbert@redhat.com>
Subject: [Qemu-devel] [PATCH 2/2] virtio-console: chardev hotswap support
Date: Thu, 9 Feb 2017 18:25:34 +0300 [thread overview]
Message-ID: <1486653934-14805-3-git-send-email-den@openvz.org> (raw)
In-Reply-To: <1486653934-14805-1-git-send-email-den@openvz.org>
From: Anton Nefedov <anton.nefedov@virtuozzo.com>
Signed-off-by: Anton Nefedov <anton.nefedov@virtuozzo.com>
Signed-off-by: Denis V. Lunev <den@openvz.org>
CC: Paolo Bonzini <pbonzini@redhat.com>
CC: "Marc-André Lureau" <marcandre.lureau@redhat.com>
CC: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
---
hw/char/virtio-console.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/hw/char/virtio-console.c b/hw/char/virtio-console.c
index 798d9b6..4827219 100644
--- a/hw/char/virtio-console.c
+++ b/hw/char/virtio-console.c
@@ -163,6 +163,29 @@ static void chr_event(void *opaque, int event)
}
}
+static int chr_be_change(void *opaque)
+{
+ VirtConsole *vcon = opaque;
+ VirtIOSerialPort *port = VIRTIO_SERIAL_PORT(vcon);
+ VirtIOSerialPortClass *k = VIRTIO_SERIAL_PORT_GET_CLASS(port);
+
+ if (k->is_console) {
+ qemu_chr_fe_set_handlers(&vcon->chr, chr_can_read, chr_read,
+ NULL, vcon, NULL, true);
+ } else {
+ qemu_chr_fe_set_handlers(&vcon->chr, chr_can_read, chr_read,
+ chr_event, vcon, NULL, false);
+ }
+ if (vcon->watch) {
+ g_source_remove(vcon->watch);
+ vcon->watch = qemu_chr_fe_add_watch(&vcon->chr,
+ G_IO_OUT | G_IO_HUP,
+ chr_write_unblocked, vcon);
+ }
+
+ return 0;
+}
+
static void virtconsole_realize(DeviceState *dev, Error **errp)
{
VirtIOSerialPort *port = VIRTIO_SERIAL_PORT(dev);
@@ -194,6 +217,7 @@ static void virtconsole_realize(DeviceState *dev, Error **errp)
qemu_chr_fe_set_handlers(&vcon->chr, chr_can_read, chr_read,
chr_event, vcon, NULL, false);
}
+ qemu_chr_fe_set_be_change_handler(&vcon->chr, chr_be_change);
}
}
--
2.7.4
next prev parent reply other threads:[~2017-02-09 15:25 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-09 15:25 [Qemu-devel] [PATCH 0/2] chardevice hotswap Denis V. Lunev
2017-02-09 15:25 ` [Qemu-devel] [PATCH 1/2] char: " Denis V. Lunev
2017-02-09 16:09 ` Daniel P. Berrange
2017-02-09 16:43 ` Dr. David Alan Gilbert
2017-02-09 15:25 ` Denis V. Lunev [this message]
2017-02-09 15:37 ` [Qemu-devel] [PATCH 0/2] " no-reply
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=1486653934-14805-3-git-send-email-den@openvz.org \
--to=den@openvz.org \
--cc=anton.nefedov@virtuozzo.com \
--cc=dgilbert@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=pbonzini@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).