From patchwork Fri Aug 14 08:36:08 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 31379 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 bilbo.ozlabs.org (Postfix) with ESMTPS id DFAB9B6EDF for ; Fri, 14 Aug 2009 18:38:48 +1000 (EST) Received: from localhost ([127.0.0.1]:46106 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MbsJB-0004oq-Sx for incoming@patchwork.ozlabs.org; Fri, 14 Aug 2009 04:38:45 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MbsGp-0004HS-LO for qemu-devel@nongnu.org; Fri, 14 Aug 2009 04:36:19 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MbsGl-0004Gt-6i for qemu-devel@nongnu.org; Fri, 14 Aug 2009 04:36:19 -0400 Received: from [199.232.76.173] (port=49684 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MbsGl-0004Gq-4T for qemu-devel@nongnu.org; Fri, 14 Aug 2009 04:36:15 -0400 Received: from mx2.redhat.com ([66.187.237.31]:41548) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MbsGk-0005Ig-J5 for qemu-devel@nongnu.org; Fri, 14 Aug 2009 04:36:14 -0400 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n7E8aE3V026515 for ; Fri, 14 Aug 2009 04:36:14 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n7E8aD15021880; Fri, 14 Aug 2009 04:36:13 -0400 Received: from zweiblum.home.kraxel.org (vpn1-4-95.ams2.redhat.com [10.36.4.95]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with SMTP id n7E8a9jm000861; Fri, 14 Aug 2009 04:36:10 -0400 Received: by zweiblum.home.kraxel.org (Postfix, from userid 500) id 44291700DA; Fri, 14 Aug 2009 10:36:08 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 14 Aug 2009 10:36:08 +0200 Message-Id: <1250238968-2114-4-git-send-email-kraxel@redhat.com> In-Reply-To: <1250238968-2114-1-git-send-email-kraxel@redhat.com> References: <1250238968-2114-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.58 on 172.16.27.26 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) Cc: Gerd Hoffmann Subject: [Qemu-devel] [PATCH 4/4] qdev error logging 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 Use the new qemu_error() function in qdev.c Signed-off-by: Gerd Hoffmann --- hw/qdev.c | 34 +++++++++++++++++----------------- 1 files changed, 17 insertions(+), 17 deletions(-) diff --git a/hw/qdev.c b/hw/qdev.c index 1b7d963..ff2f096 100644 --- a/hw/qdev.c +++ b/hw/qdev.c @@ -138,8 +138,8 @@ static int set_property(const char *name, const char *value, void *opaque) return 0; if (-1 == qdev_prop_parse(dev, name, value)) { - fprintf(stderr, "can't set property \"%s\" to \"%s\" for \"%s\"\n", - name, value, dev->info->name); + qemu_error("can't set property \"%s\" to \"%s\" for \"%s\"\n", + name, value, dev->info->name); return -1; } return 0; @@ -154,14 +154,14 @@ DeviceState *qdev_device_add(QemuOpts *opts) driver = qemu_opt_get(opts, "driver"); if (!driver) { - fprintf(stderr, "-device: no driver specified\n"); + qemu_error("-device: no driver specified\n"); return NULL; } if (strcmp(driver, "?") == 0) { char msg[256]; for (info = device_info_list; info != NULL; info = info->next) { qdev_print_devinfo(info, msg, sizeof(msg)); - fprintf(stderr, "%s\n", msg); + qemu_error("%s\n", msg); } return NULL; } @@ -169,13 +169,13 @@ DeviceState *qdev_device_add(QemuOpts *opts) /* find driver */ info = qdev_find_info(NULL, driver); if (!info) { - fprintf(stderr, "Device \"%s\" not found. Try -device '?' for a list.\n", - driver); + qemu_error("Device \"%s\" not found. Try -device '?' for a list.\n", + driver); return NULL; } if (info->no_user) { - fprintf(stderr, "device \"%s\" can't be added via command line\n", - info->name); + qemu_error("device \"%s\" can't be added via command line\n", + info->name); return NULL; } @@ -442,12 +442,12 @@ static BusState *qbus_find(const char *path) pos = 0; } else { if (sscanf(path, "%127[^/]%n", elem, &len) != 1) { - fprintf(stderr, "path parse error (\"%s\")\n", path); + qemu_error("path parse error (\"%s\")\n", path); return NULL; } bus = qbus_find_recursive(main_system_bus, elem, NULL); if (!bus) { - fprintf(stderr, "bus \"%s\" not found\n", elem); + qemu_error("bus \"%s\" not found\n", elem); return NULL; } pos = len; @@ -461,14 +461,14 @@ static BusState *qbus_find(const char *path) /* find device */ if (sscanf(path+pos, "/%127[^/]%n", elem, &len) != 1) { - fprintf(stderr, "path parse error (\"%s\" pos %d)\n", path, pos); + qemu_error("path parse error (\"%s\" pos %d)\n", path, pos); return NULL; } pos += len; dev = qbus_find_dev(bus, elem); if (!dev) { qbus_list_dev(bus, msg, sizeof(msg)); - fprintf(stderr, "device \"%s\" not found\n%s\n", elem, msg); + qemu_error("device \"%s\" not found\n%s\n", elem, msg); return NULL; } if (path[pos] == '\0') { @@ -476,28 +476,28 @@ static BusState *qbus_find(const char *path) * one child bus accept it nevertheless */ switch (dev->num_child_bus) { case 0: - fprintf(stderr, "device has no child bus (%s)\n", path); + qemu_error("device has no child bus (%s)\n", path); return NULL; case 1: return LIST_FIRST(&dev->child_bus); default: qbus_list_bus(dev, msg, sizeof(msg)); - fprintf(stderr, "device has multiple child busses (%s)\n%s\n", - path, msg); + qemu_error("device has multiple child busses (%s)\n%s\n", + path, msg); return NULL; } } /* find bus */ if (sscanf(path+pos, "/%127[^/]%n", elem, &len) != 1) { - fprintf(stderr, "path parse error (\"%s\" pos %d)\n", path, pos); + qemu_error("path parse error (\"%s\" pos %d)\n", path, pos); return NULL; } pos += len; bus = qbus_find_bus(dev, elem); if (!bus) { qbus_list_bus(dev, msg, sizeof(msg)); - fprintf(stderr, "child bus \"%s\" not found\n%s\n", elem, msg); + qemu_error("child bus \"%s\" not found\n%s\n", elem, msg); return NULL; } }