qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Amit Shah <amit.shah@redhat.com>
To: qemu list <qemu-devel@nongnu.org>
Cc: Amit Shah <amit.shah@redhat.com>,
	Juan Quintela <quintela@redhat.com>,
	Markus Armbruster <armbru@redhat.com>,
	Gerd Hoffmann <kraxel@redhat.com>
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	[thread overview]
Message-ID: <fed433e1e70fdcde45db3f58c21b32b8a6f46dc6.1275309375.git.amit.shah@redhat.com> (raw)
In-Reply-To: <cover.1275309375.git.amit.shah@redhat.com>
In-Reply-To: <cover.1275309375.git.amit.shah@redhat.com>

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 <amit.shah@redhat.com>
---
 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

  parent reply	other threads:[~2010-05-31 12:40 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-31 12:41 [Qemu-devel] [PATCH 0/5] Add '-device help' output for device params and help text Amit Shah
2010-05-31 12:41 ` [Qemu-devel] [PATCH 1/5] qdev: Add a description field for qdev properties for documentation Amit Shah
2010-05-31 12:41 ` [Qemu-devel] [PATCH 2/5] virtio-serial: Add description fields for qdev properties Amit Shah
2010-05-31 12:41 ` [Qemu-devel] [PATCH 3/5] net.h: Add description fields for qdev properites Amit Shah
2010-05-31 12:41 ` Amit Shah [this message]
2010-05-31 12:41 ` [Qemu-devel] [PATCH 5/5] qdev: Add new '-device help' option, shows all devices and properties Amit Shah
2010-06-07 14:43   ` Markus Armbruster
2010-06-08  5:13     ` Amit Shah
2010-06-07 16:09 ` [Qemu-devel] [PATCH 0/5] Add '-device help' output for device params and help text Anthony Liguori
2010-06-08  5:21   ` Amit Shah
2010-06-14 16:55     ` Anthony Liguori
2010-06-15  9:17       ` 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=fed433e1e70fdcde45db3f58c21b32b8a6f46dc6.1275309375.git.amit.shah@redhat.com \
    --to=amit.shah@redhat.com \
    --cc=armbru@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    /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).