From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Mkgk3-0007bc-0S for qemu-devel@nongnu.org; Mon, 07 Sep 2009 12:06:55 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Mkgjx-0007Xp-95 for qemu-devel@nongnu.org; Mon, 07 Sep 2009 12:06:53 -0400 Received: from [199.232.76.173] (port=34967 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mkgjx-0007Xg-0b for qemu-devel@nongnu.org; Mon, 07 Sep 2009 12:06:49 -0400 Received: from mx1.redhat.com ([209.132.183.28]:23140) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Mkgjw-0003XZ-DL for qemu-devel@nongnu.org; Mon, 07 Sep 2009 12:06:48 -0400 Received: from int-mx03.intmail.prod.int.phx2.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n87G6lXN013979 for ; Mon, 7 Sep 2009 12:06:47 -0400 From: Gerd Hoffmann Date: Mon, 7 Sep 2009 18:06:22 +0200 Message-Id: <1252339585-27797-21-git-send-email-kraxel@redhat.com> In-Reply-To: <1252339585-27797-1-git-send-email-kraxel@redhat.com> References: <1252339585-27797-1-git-send-email-kraxel@redhat.com> Subject: [Qemu-devel] [PATCH 20/23] Allow -serial chardev: List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Gerd Hoffmann 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 --- qemu-char.c | 16 ++++++++++++++++ qemu-char.h | 1 + qemu-config.c | 3 +++ 3 files changed, 20 insertions(+), 0 deletions(-) diff --git a/qemu-char.c b/qemu-char.c index e31f97b..2e71038 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; +} diff --git a/qemu-char.h b/qemu-char.h index 9bff0c7..0bf8944 100644 --- a/qemu-char.h +++ b/qemu-char.h @@ -90,6 +90,7 @@ void qemu_chr_read(CharDriverState *s, uint8_t *buf, int len); int qemu_chr_get_msgfd(CharDriverState *s); void qemu_chr_accept_input(CharDriverState *s); void qemu_chr_info(Monitor *mon); +CharDriverState *qemu_chr_find(const char *name); extern int term_escape_char; diff --git a/qemu-config.c b/qemu-config.c index 8404f1b..f6f4cb4 100644 --- a/qemu-config.c +++ b/qemu-config.c @@ -130,6 +130,9 @@ QemuOptsList qemu_chardev_opts = { },{ .name = "rows", .type = QEMU_OPT_NUMBER, + },{ + .name = "mux", + .type = QEMU_OPT_BOOL, }, { /* end if list */ } }, -- 1.6.2.5