From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MgIPW-0001uj-26 for qemu-devel@nongnu.org; Wed, 26 Aug 2009 09:19:34 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MgIPR-0001qL-A0 for qemu-devel@nongnu.org; Wed, 26 Aug 2009 09:19:33 -0400 Received: from [199.232.76.173] (port=58187 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MgIPR-0001px-1A for qemu-devel@nongnu.org; Wed, 26 Aug 2009 09:19:29 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54377) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MgIPQ-0004Yr-DW for qemu-devel@nongnu.org; Wed, 26 Aug 2009 09:19:28 -0400 Received: from int-mx05.intmail.prod.int.phx2.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.18]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n7QDJR6Q020490 for ; Wed, 26 Aug 2009 09:19:27 -0400 From: Gerd Hoffmann Date: Wed, 26 Aug 2009 15:19:19 +0200 Message-Id: <1251292759-32247-5-git-send-email-kraxel@redhat.com> In-Reply-To: <1251292759-32247-1-git-send-email-kraxel@redhat.com> References: <1251292759-32247-1-git-send-email-kraxel@redhat.com> Subject: [Qemu-devel] [PATCH 4/4] qdev error logging List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Gerd Hoffmann 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; } } -- 1.6.2.5