diff options
author | Gerd Hoffmann <kraxel@redhat.com> | 2009-09-10 10:58:52 +0200 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2009-09-11 10:19:49 -0500 |
commit | c845f401497ff0995ece2b3df628808cf6d74dbe (patch) | |
tree | 7d18514ad5264799715afa2fd4efece0612cf73a /qemu-char.c | |
parent | 7e1b35b44c26fb0ede72613608e1a6fddabfac75 (diff) |
Allow -serial chardev:<name>
Lets put -chardev into use now. With this patch applied chardev:name is
accepted as chardev specification everywhere, i.e. now you can:
-chardev stdio,id=ttyS0
-serial chardev:ttyS0
which does the same as '-serial stdio".
Muxing can be done this way:
-chardev stdio,id=mux,mux=on
-serial chardev:mux
-monitor chardev:mux
You can mux more than two streams.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'qemu-char.c')
-rw-r--r-- | qemu-char.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/qemu-char.c b/qemu-char.c index ef73afef71..ce2799e205 100644 --- a/qemu-char.c +++ b/qemu-char.c @@ -2416,6 +2416,10 @@ CharDriverState *qemu_chr_open(const char *label, const char *filename, void (*i CharDriverState *chr; QemuOpts *opts; + if (strstart(filename, "chardev:", &p)) { + return qemu_chr_find(p); + } + opts = qemu_chr_parse_compat(label, filename); if (!opts) return NULL; @@ -2445,3 +2449,15 @@ void qemu_chr_info(Monitor *mon) monitor_printf(mon, "%s: filename=%s\n", chr->label, chr->filename); } } + +CharDriverState *qemu_chr_find(const char *name) +{ + CharDriverState *chr; + + TAILQ_FOREACH(chr, &chardevs, next) { + if (strcmp(chr->label, name) != 0) + continue; + return chr; + } + return NULL; +} |