qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 5/7] qdev: Add help for device properties


From: Markus Armbruster
Subject: [Qemu-devel] [PATCH 5/7] qdev: Add help for device properties
Date: Fri, 29 Jan 2010 19:49:00 +0100

Option "-device DRIVER,?" and monitor command "device_add DRIVER,?"
print the supported properties instead of creating a device.  The
former also terminates the program.

This is commit 2ba6edf0 (just reverted) done right.

Signed-off-by: Markus Armbruster <address@hidden>
---
 hw/qdev.c |   15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/hw/qdev.c b/hw/qdev.c
index f47f0cb..7c3701c 100644
--- a/hw/qdev.c
+++ b/hw/qdev.c
@@ -158,6 +158,7 @@ int qdev_device_help(QemuOpts *opts)
     const char *driver;
     DeviceInfo *info;
     char msg[256];
+    Property *prop;
 
     driver = qemu_opt_get(opts, "driver");
     if (driver && !strcmp(driver, "?")) {
@@ -168,7 +169,19 @@ int qdev_device_help(QemuOpts *opts)
         return 1;
     }
 
-    return 0;
+    if (!qemu_opt_get(opts, "?")) {
+        return 0;
+    }
+
+    info = qdev_find_info(NULL, driver);
+    if (!info) {
+        return 0;
+    }
+
+    for (prop = info->props; prop && prop->name; prop++) {
+        qemu_error("%s.%s\n", info->name, prop->name);
+    }
+    return 1;
 }
 
 DeviceState *qdev_device_add(QemuOpts *opts)
-- 
1.6.6





reply via email to

[Prev in Thread] Current Thread [Next in Thread]