aboutsummaryrefslogtreecommitdiff
path: root/qemu-char.c
diff options
context:
space:
mode:
authorKusanagi Kouichi <slash@ac.auone-net.jp>2011-04-26 19:19:26 +0900
committerAmit Shah <amit.shah@redhat.com>2011-04-28 11:03:07 +0530
commitd5b27167e17e0d9393d6364703cc68e7f018023c (patch)
tree3ce6acb13954c23310a88fb0cfb5444e15d96920 /qemu-char.c
parentcd8f7df2891891c3a6c346892545c4407be6699f (diff)
downloadqemu-d5b27167e17e0d9393d6364703cc68e7f018023c.zip
qemu-d5b27167e17e0d9393d6364703cc68e7f018023c.tar.gz
qemu-d5b27167e17e0d9393d6364703cc68e7f018023c.tar.bz2
char: Allow devices to use a single multiplexed chardev.
This fixes regression caused by commit 2d6c1ef40f3678ab47a4d14fb5dadaa486bfcda6 ("char: Prevent multiple devices opening same chardev"): -nodefaults -nographic -chardev stdio,id=stdio,mux=on,signal=off \ -mon stdio -device virtio-serial-pci \ -device virtconsole,chardev=stdio -device isa-serial,chardev=stdio fails with: qemu-system-x86_64: -device isa-serial,chardev=stdio: Property 'isa-serial.chardev' can't take value 'stdio', it's in use Signed-off-by: Kusanagi Kouichi <slash@ac.auone-net.jp> Signed-off-by: Amit Shah <amit.shah@redhat.com>
Diffstat (limited to 'qemu-char.c')
-rw-r--r--qemu-char.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/qemu-char.c b/qemu-char.c
index 710d98f..eaf6571 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -199,7 +199,7 @@ void qemu_chr_add_handlers(CharDriverState *s,
{
if (!opaque) {
/* chr driver being released. */
- s->assigned = 0;
+ ++s->avail_connections;
}
s->chr_can_read = fd_can_read;
s->chr_read = fd_read;
@@ -2547,7 +2547,10 @@ CharDriverState *qemu_chr_open_opts(QemuOpts *opts,
snprintf(base->label, len, "%s-base", qemu_opts_id(opts));
chr = qemu_chr_open_mux(base);
chr->filename = base->filename;
+ chr->avail_connections = MAX_MUX;
QTAILQ_INSERT_TAIL(&chardevs, chr, next);
+ } else {
+ chr->avail_connections = 1;
}
chr->label = qemu_strdup(qemu_opts_id(opts));
return chr;