qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 5/7] qdev: Add help for device properties
Date: Fri, 29 Jan 2010 19:49:00 +0100	[thread overview]
Message-ID: <1264790942-15045-6-git-send-email-armbru@redhat.com> (raw)
In-Reply-To: <1264790942-15045-1-git-send-email-armbru@redhat.com>

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

  parent reply	other threads:[~2010-01-29 18:49 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-29 18:48 [Qemu-devel] [PATCH 0/7] Clean up -device help Markus Armbruster
2010-01-29 18:48 ` [Qemu-devel] [PATCH 1/7] qemu-option: Make qemu_opts_foreach() accumulate return values Markus Armbruster
2010-02-03 18:51   ` Anthony Liguori
2010-01-29 18:48 ` [Qemu-devel] [PATCH 2/7] qdev: Fix exit code for -device ? Markus Armbruster
2010-01-29 18:48 ` [Qemu-devel] [PATCH 3/7] Revert "qdev: Add help for property value" Markus Armbruster
2010-01-29 18:48 ` [Qemu-devel] [PATCH 4/7] Revert "qdev: Add help for device properties" Markus Armbruster
2010-01-29 18:49 ` Markus Armbruster [this message]
2010-01-29 18:49 ` [Qemu-devel] [PATCH 6/7] qdev: update help on -device Markus Armbruster
2010-01-29 18:49 ` [Qemu-devel] [PATCH 7/7] qdev: Add rudimentary help for property value 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=1264790942-15045-6-git-send-email-armbru@redhat.com \
    --to=armbru@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).