From patchwork Tue Dec 8 12:11:36 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 40610 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 03E19B7B3E for ; Tue, 8 Dec 2009 23:21:02 +1100 (EST) Received: from localhost ([127.0.0.1]:58942 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NHz3q-0008Gk-Ru for incoming@patchwork.ozlabs.org; Tue, 08 Dec 2009 07:20:58 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NHyvI-0005f0-S3 for qemu-devel@nongnu.org; Tue, 08 Dec 2009 07:12:09 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NHyvD-0005cb-9z for qemu-devel@nongnu.org; Tue, 08 Dec 2009 07:12:07 -0500 Received: from [199.232.76.173] (port=44191 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NHyvC-0005cL-Jr for qemu-devel@nongnu.org; Tue, 08 Dec 2009 07:12:02 -0500 Received: from mx1.redhat.com ([209.132.183.28]:53884) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NHyvC-00081w-6k for qemu-devel@nongnu.org; Tue, 08 Dec 2009 07:12:02 -0500 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.13.8/8.13.8) with ESMTP id nB8CC1KX003023 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 8 Dec 2009 07:12:01 -0500 Received: from zweiblum.home.kraxel.org (vpn2-9-91.ams2.redhat.com [10.36.9.91]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id nB8CBx0H017075; Tue, 8 Dec 2009 07:11:59 -0500 Received: by zweiblum.home.kraxel.org (Postfix, from userid 500) id 9BDE170109; Tue, 8 Dec 2009 13:11:57 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Tue, 8 Dec 2009 13:11:36 +0100 Message-Id: <1260274314-2906-5-git-send-email-kraxel@redhat.com> In-Reply-To: <1260274314-2906-1-git-send-email-kraxel@redhat.com> References: <1260274314-2906-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Cc: Gerd Hoffmann , agraf@suse.de, lcapitulino@redhat.com Subject: [Qemu-devel] [FOR 0.12 PATCH v4 04/22] chardev: make chardevs specified in config file work. X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org The patch decuples the -chardev switch and the actual chardev initialization. Without this patch qemu ignores chardev entries coming via -readconfig. Signed-off-by: Gerd Hoffmann --- vl.c | 16 +++++++++++++--- 1 files changed, 13 insertions(+), 3 deletions(-) diff --git a/vl.c b/vl.c index f7acdd4..aa678ad 100644 --- a/vl.c +++ b/vl.c @@ -4586,6 +4586,16 @@ static int device_init_func(QemuOpts *opts, void *opaque) return 0; } +static int chardev_init_func(QemuOpts *opts, void *opaque) +{ + CharDriverState *chr; + + chr = qemu_chr_open_opts(opts, NULL); + if (!chr) + return -1; + return 0; +} + struct device_config { enum { DEV_USB, /* -usbdevice */ @@ -5180,9 +5190,6 @@ int main(int argc, char **argv, char **envp) fprintf(stderr, "parse error: %s\n", optarg); exit(1); } - if (qemu_chr_open_opts(opts, NULL) == NULL) { - exit(1); - } break; case QEMU_OPTION_serial: if (serial_device_index >= MAX_SERIAL_PORTS) { @@ -5501,6 +5508,9 @@ int main(int argc, char **argv, char **envp) } } + if (qemu_opts_foreach(&qemu_chardev_opts, chardev_init_func, NULL, 1) != 0) + exit(1); + #ifndef _WIN32 if (daemonize) { pid_t pid;