qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH 4/5] qdev: Re-arrange code to have device properties


From: Amit Shah
Subject: [Qemu-devel] [PATCH 4/5] qdev: Re-arrange code to have device properties shown from own function
Date: Mon, 31 May 2010 18:11:30 +0530

Instead of printing out the device properties help messages from
qdev_device_help(), split it off into a new function. This way, we have
two separate function calls for device help and device properties help.

This will be later used to show all the devices and all the properties
associated with the device as part of a complete coverage for all
devices and options associated with each of them.

Signed-off-by: Amit Shah <address@hidden>
---
 hw/qdev.c |   41 ++++++++++++++++++++++++-----------------
 1 files changed, 24 insertions(+), 17 deletions(-)

diff --git a/hw/qdev.c b/hw/qdev.c
index 2cd205b..89ba986 100644
--- a/hw/qdev.c
+++ b/hw/qdev.c
@@ -151,27 +151,11 @@ static int set_property(const char *name, const char 
*value, void *opaque)
     return 0;
 }
 
-int qdev_device_help(QemuOpts *opts)
+static int show_device_props(const char *driver)
 {
-    const char *driver;
     DeviceInfo *info;
     Property *prop;
 
-    driver = qemu_opt_get(opts, "driver");
-    if (driver && !strcmp(driver, "?")) {
-        for (info = device_info_list; info != NULL; info = info->next) {
-            if (info->no_user) {
-                continue;       /* not available, don't show */
-            }
-            qdev_print_devinfo(info);
-        }
-        return 1;
-    }
-
-    if (!qemu_opt_get(opts, "?")) {
-        return 0;
-    }
-
     info = qdev_find_info(NULL, driver);
     if (!info) {
         return 0;
@@ -193,6 +177,29 @@ int qdev_device_help(QemuOpts *opts)
     return 1;
 }
 
+int qdev_device_help(QemuOpts *opts)
+{
+    const char *driver;
+    DeviceInfo *info;
+
+    driver = qemu_opt_get(opts, "driver");
+    if (driver && !strcmp(driver, "?")) {
+        for (info = device_info_list; info != NULL; info = info->next) {
+            if (info->no_user) {
+                continue;       /* not available, don't show */
+            }
+            qdev_print_devinfo(info);
+        }
+        return 1;
+    }
+
+    if (!qemu_opt_get(opts, "?")) {
+        return 0;
+    }
+
+    return show_device_props(driver);
+}
+
 DeviceState *qdev_device_add(QemuOpts *opts)
 {
     const char *driver, *path, *id;
-- 
1.7.0.1




reply via email to

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