char: Allow devices to use a single multiplexed chardev.

This fixes regression caused by commit
2d6c1ef40f
("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>
This commit is contained in:
Kusanagi Kouichi 2011-04-26 19:19:26 +09:00 committed by Amit Shah
parent cd8f7df289
commit d5b27167e1
3 changed files with 7 additions and 4 deletions

View file

@ -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;