From patchwork Tue Feb 7 14:09:12 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Armbruster X-Patchwork-Id: 139969 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 33E7F1007D3 for ; Wed, 8 Feb 2012 03:24:03 +1100 (EST) Received: from localhost ([::1]:33774 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RulkS-0002aC-LQ for incoming@patchwork.ozlabs.org; Tue, 07 Feb 2012 09:10:20 -0500 Received: from eggs.gnu.org ([140.186.70.92]:53906) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ruljo-0001Uu-6O for qemu-devel@nongnu.org; Tue, 07 Feb 2012 09:09:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ruljf-0005fP-HM for qemu-devel@nongnu.org; Tue, 07 Feb 2012 09:09:40 -0500 Received: from oxygen.pond.sub.org ([78.46.104.156]:39188) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ruljf-0005eU-CX for qemu-devel@nongnu.org; Tue, 07 Feb 2012 09:09:31 -0500 Received: from blackfin.pond.sub.org (p5B32D218.dip.t-dialin.net [91.50.210.24]) by oxygen.pond.sub.org (Postfix) with ESMTPA id B23B6A43EC; Tue, 7 Feb 2012 15:09:29 +0100 (CET) Received: by blackfin.pond.sub.org (Postfix, from userid 500) id 066F560081; Tue, 7 Feb 2012 15:09:26 +0100 (CET) From: Markus Armbruster To: qemu-devel@nongnu.org Date: Tue, 7 Feb 2012 15:09:12 +0100 Message-Id: <1328623766-12287-6-git-send-email-armbru@redhat.com> X-Mailer: git-send-email 1.7.6.5 In-Reply-To: <1328623766-12287-1-git-send-email-armbru@redhat.com> References: <1328623766-12287-1-git-send-email-armbru@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 78.46.104.156 Cc: kwolf@redhat.com, aliguori@us.ibm.com Subject: [Qemu-devel] [PATCH 05/19] vl.c: Error locations for options using add_device_config() 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 These are -bt, -serial, -virtcon, -parallel, -debugcon, -usbdevice. Improves messages emitted via proper error reporting interfaces. For instance: $ qemu-system-x86_64 -nodefaults -S -usb -usbdevice net:vlan=xxx qemu-system-x86_64: Parameter 'vlan' expects a number becomes: qemu-system-x86_64: -usbdevice net:vlan=xxx: Parameter 'vlan' expects a number Many more remain unimproved, because they're fprintf()ed. The next few commits will take care of that. Signed-off-by: Markus Armbruster --- vl.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/vl.c b/vl.c index 2d464cf..e252a9d 100644 --- a/vl.c +++ b/vl.c @@ -1859,6 +1859,7 @@ struct device_config { DEV_DEBUGCON, /* -debugcon */ } type; const char *cmdline; + Location loc; QTAILQ_ENTRY(device_config) next; }; QTAILQ_HEAD(, device_config) device_configs = QTAILQ_HEAD_INITIALIZER(device_configs); @@ -1870,6 +1871,7 @@ static void add_device_config(int type, const char *cmdline) conf = g_malloc0(sizeof(*conf)); conf->type = type; conf->cmdline = cmdline; + loc_save(&conf->loc); QTAILQ_INSERT_TAIL(&device_configs, conf, next); } @@ -1881,7 +1883,9 @@ static int foreach_device_config(int type, int (*func)(const char *cmdline)) QTAILQ_FOREACH(conf, &device_configs, next) { if (conf->type != type) continue; + loc_push_restore(&conf->loc); rc = func(conf->cmdline); + loc_pop(&conf->loc); if (0 != rc) return rc; }