qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 1/2] qdev: factor out qdev_print_devinfo.
@ 2009-07-29 11:12 Gerd Hoffmann
  2009-07-29 11:12 ` [Qemu-devel] [PATCH 2/2] qdev/core: add monitor command to list all drivers Gerd Hoffmann
  2009-07-31 23:44 ` [Qemu-devel] [PATCH 1/2] qdev: factor out qdev_print_devinfo Markus Armbruster
  0 siblings, 2 replies; 9+ messages in thread
From: Gerd Hoffmann @ 2009-07-29 11:12 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann


Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/qdev.c |   19 ++++++++++++++++++-
 1 files changed, 18 insertions(+), 1 deletions(-)

diff --git a/hw/qdev.c b/hw/qdev.c
index 479eb72..6f05232 100644
--- a/hw/qdev.c
+++ b/hw/qdev.c
@@ -105,6 +105,21 @@ DeviceState *qdev_create(BusState *bus, const char *name)
     return dev;
 }
 
+static int qdev_print_devinfo(DeviceInfo *info, char *dest, int len)
+{
+    int pos = 0;
+
+    pos += snprintf(dest+pos, len-pos, "name \"%s\", bus %s",
+                    info->name, info->bus_info->name);
+    if (info->alias)
+        pos += snprintf(dest+pos, len-pos, ", alias \"%s\"", info->alias);
+    if (info->desc)
+        pos += snprintf(dest+pos, len-pos, ", desc \"%s\"", info->desc);
+    if (info->no_user)
+        pos += snprintf(dest+pos, len-pos, ", no-user");
+    return pos;
+}
+
 DeviceState *qdev_device_add(const char *cmdline)
 {
     DeviceInfo *info;
@@ -120,8 +135,10 @@ DeviceState *qdev_device_add(const char *cmdline)
         return NULL;
     }
     if (strcmp(driver, "?") == 0) {
+        char msg[256];
         for (info = device_info_list; info != NULL; info = info->next) {
-            fprintf(stderr, "name \"%s\", bus %s\n", info->name, info->bus_info->name);
+            qdev_print_devinfo(info, msg, sizeof(msg));
+            fprintf(stderr, "%s\n", msg);
         }
         return NULL;
     }
-- 
1.6.2.5

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2009-08-03 12:46 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-29 11:12 [Qemu-devel] [PATCH 1/2] qdev: factor out qdev_print_devinfo Gerd Hoffmann
2009-07-29 11:12 ` [Qemu-devel] [PATCH 2/2] qdev/core: add monitor command to list all drivers Gerd Hoffmann
2009-08-02 14:10   ` Avi Kivity
2009-08-03 10:05     ` Gerd Hoffmann
2009-08-03 12:51       ` Avi Kivity
2009-07-31 23:44 ` [Qemu-devel] [PATCH 1/2] qdev: factor out qdev_print_devinfo Markus Armbruster
2009-08-03  7:50   ` Gerd Hoffmann
2009-08-03  8:24     ` Markus Armbruster
2009-08-03  9:23       ` Gerd Hoffmann

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).