qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [PATCH 4/4] qdev error logging
Date: Wed, 26 Aug 2009 15:19:19 +0200	[thread overview]
Message-ID: <1251292759-32247-5-git-send-email-kraxel@redhat.com> (raw)
In-Reply-To: <1251292759-32247-1-git-send-email-kraxel@redhat.com>

Use the new qemu_error() function in qdev.c

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 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

  parent reply	other threads:[~2009-08-26 13:19 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-26 13:19 [Qemu-devel] [PATCH 0/4] qdev: init() callback retval + error reporting Gerd Hoffmann
2009-08-26 13:19 ` [Qemu-devel] [PATCH 1/4] qdev: add return value to init() callbacks Gerd Hoffmann
2009-08-26 13:19 ` [Qemu-devel] [PATCH 2/4] add qemu_error() + friends Gerd Hoffmann
2009-08-26 13:19 ` [Qemu-devel] [PATCH 3/4] virtio-pci error logging Gerd Hoffmann
2009-08-26 13:19 ` Gerd Hoffmann [this message]
2009-08-28  0:46 ` [Qemu-devel] [PATCH 0/4] qdev: init() callback retval + error reporting Anthony Liguori
  -- strict thread matches above, loose matches on Subject: below --
2009-08-14  8:36 [Qemu-devel] [PATCH 1/4] qdev: add return value to init() callbacks Gerd Hoffmann
2009-08-14  8:36 ` [Qemu-devel] [PATCH 4/4] qdev error logging Gerd Hoffmann
2009-08-21 16:16   ` Markus Armbruster

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1251292759-32247-5-git-send-email-kraxel@redhat.com \
    --to=kraxel@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).