From patchwork Fri Jun 21 10:38:23 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 253182 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id A1C872C0315 for ; Fri, 21 Jun 2013 20:45:18 +1000 (EST) Received: from localhost ([::1]:35765 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UpyqC-0005tY-IC for incoming@patchwork.ozlabs.org; Fri, 21 Jun 2013 06:45:16 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42527) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Upyjf-0005WC-I9 for qemu-devel@nongnu.org; Fri, 21 Jun 2013 06:38:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Upyjd-0007jr-BG for qemu-devel@nongnu.org; Fri, 21 Jun 2013 06:38:31 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56649) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Upyjd-0007jB-2w; Fri, 21 Jun 2013 06:38:29 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r5LAcS3T002316 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 21 Jun 2013 06:38:28 -0400 Received: from rincewind.home.kraxel.org (ovpn-116-29.ams2.redhat.com [10.36.116.29]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r5LAcR4W025413; Fri, 21 Jun 2013 06:38:28 -0400 Received: by rincewind.home.kraxel.org (Postfix, from userid 500) id 0E94643276; Fri, 21 Jun 2013 12:38:26 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 21 Jun 2013 12:38:23 +0200 Message-Id: <1371811105-730-12-git-send-email-kraxel@redhat.com> In-Reply-To: <1371811105-730-1-git-send-email-kraxel@redhat.com> References: <1371811105-730-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: qemu-trivial@nongnu.org, Anthony Liguori , Gerd Hoffmann Subject: [Qemu-devel] [PATCH 11/13] qemu-char: add -chardev mux support X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Allow to explicitly create mux chardevs on the command line, like you can using QMP. Signed-off-by: Gerd Hoffmann --- qemu-char.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/qemu-char.c b/qemu-char.c index 65c0c48..c83ff21 100644 --- a/qemu-char.c +++ b/qemu-char.c @@ -3122,6 +3122,19 @@ static void qemu_chr_parse_memory(QemuOpts *opts, ChardevBackend *backend, } } +static void qemu_chr_parse_mux(QemuOpts *opts, ChardevBackend *backend, + Error **errp) +{ + const char *chardev = qemu_opt_get(opts, "chardev"); + + if (chardev == NULL) { + error_setg(errp, "chardev: mux: no chardev given"); + return; + } + backend->mux = g_new0(ChardevMux, 1); + backend->mux->chardev = g_strdup(chardev); +} + typedef struct CharDriver { const char *name; /* old, pre qapi */ @@ -3488,6 +3501,9 @@ QemuOptsList qemu_chardev_opts = { },{ .name = "size", .type = QEMU_OPT_SIZE, + },{ + .name = "chardev", + .type = QEMU_OPT_STRING, }, { /* end of list */ } }, @@ -3778,6 +3794,8 @@ static void register_types(void) register_char_driver_qapi("console", CHARDEV_BACKEND_KIND_CONSOLE, NULL); register_char_driver_qapi("pipe", CHARDEV_BACKEND_KIND_PIPE, qemu_chr_parse_pipe); + register_char_driver_qapi("mux", CHARDEV_BACKEND_KIND_MUX, + qemu_chr_parse_mux); } type_init(register_types);