All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Roth <mdroth@linux.vnet.ibm.com>
To: qemu-devel@nongnu.org
Cc: qemu-stable@nongnu.org
Subject: [Qemu-devel] [PATCH 02/25] qdev-monitor: include QOM properties in -device FOO, help output
Date: Wed, 27 Aug 2014 12:35:59 -0500	[thread overview]
Message-ID: <1409160982-16389-3-git-send-email-mdroth@linux.vnet.ibm.com> (raw)
In-Reply-To: <1409160982-16389-1-git-send-email-mdroth@linux.vnet.ibm.com>

From: Stefan Hajnoczi <stefanha@redhat.com>

Update -device FOO,help to include QOM properties in addition to qdev
properties.  Devices are gradually adding more QOM properties that are
not reflected as qdev properties.

It is important to report all device properties since management tools
like libvirt use this information (and device-list-properties QMP) to
detect the presence of QEMU features.

This patch reuses the device-list-properties QMP machinery to avoid code
duplication.

Reported-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Tested-by: Cole Robinson <crobinso@redhat.com>
(cherry picked from commit ef523587da4f213ca17133a90402d0815ecf08ee)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 qdev-monitor.c | 40 +++++++++++++++++-----------------------
 1 file changed, 17 insertions(+), 23 deletions(-)

diff --git a/qdev-monitor.c b/qdev-monitor.c
index f87f3d8..5fe5e75 100644
--- a/qdev-monitor.c
+++ b/qdev-monitor.c
@@ -182,9 +182,10 @@ static const char *find_typename_by_alias(const char *alias)
 
 int qdev_device_help(QemuOpts *opts)
 {
+    Error *local_err = NULL;
     const char *driver;
-    Property *prop;
-    ObjectClass *klass;
+    DevicePropertyInfoList *prop_list;
+    DevicePropertyInfoList *prop;
 
     driver = qemu_opt_get(opts, "driver");
     if (driver && is_help_option(driver)) {
@@ -196,35 +197,28 @@ int qdev_device_help(QemuOpts *opts)
         return 0;
     }
 
-    klass = object_class_by_name(driver);
-    if (!klass) {
+    if (!object_class_by_name(driver)) {
         const char *typename = find_typename_by_alias(driver);
 
         if (typename) {
             driver = typename;
-            klass = object_class_by_name(driver);
         }
     }
 
-    if (!object_class_dynamic_cast(klass, TYPE_DEVICE)) {
-        return 0;
+    prop_list = qmp_device_list_properties(driver, &local_err);
+    if (!prop_list) {
+        error_printf("%s\n", error_get_pretty(local_err));
+        error_free(local_err);
+        return 1;
     }
-    do {
-        for (prop = DEVICE_CLASS(klass)->props; prop && prop->name; prop++) {
-            /*
-             * TODO Properties without a parser are just for dirty hacks.
-             * qdev_prop_ptr is the only such PropertyInfo.  It's marked
-             * for removal.  This conditional should be removed along with
-             * it.
-             */
-            if (!prop->info->set) {
-                continue;           /* no way to set it, don't show */
-            }
-            error_printf("%s.%s=%s\n", driver, prop->name,
-                         prop->info->legacy_name ?: prop->info->name);
-        }
-        klass = object_class_get_parent(klass);
-    } while (klass != object_class_by_name(TYPE_DEVICE));
+
+    for (prop = prop_list; prop; prop = prop->next) {
+        error_printf("%s.%s=%s\n", driver,
+                     prop->value->name,
+                     prop->value->type);
+    }
+
+    qapi_free_DevicePropertyInfoList(prop_list);
     return 1;
 }
 
-- 
1.9.1

  parent reply	other threads:[~2014-08-27 17:37 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-27 17:35 [Qemu-devel] Patch Round-up for stable 2.1.1, freeze on 2014-09-03 Michael Roth
2014-08-27 17:35 ` [Qemu-devel] [PATCH 01/25] qmp: hide "hotplugged" device property from device-list-properties Michael Roth
2014-08-27 17:35 ` Michael Roth [this message]
2014-08-27 17:36 ` [Qemu-devel] [PATCH 03/25] vfio: Fix MSI-X vector expansion Michael Roth
2014-08-27 17:36 ` [Qemu-devel] [PATCH 04/25] l2tpv3 (configure): it is linux-specific Michael Roth
2014-08-27 17:36 ` [Qemu-devel] [PATCH 05/25] ide: only constrain read/write requests to drive size, not other types Michael Roth
2014-08-27 17:36 ` [Qemu-devel] [PATCH 06/25] pci: Use bus master address space for delivering MSI/MSI-X messages Michael Roth
2014-08-28 10:18   ` [Qemu-devel] [Qemu-stable] " Greg Kurz
2014-08-28 14:39     ` Michael Roth
2014-09-18 15:36       ` Greg Kurz
2014-08-27 17:36 ` [Qemu-devel] [PATCH 07/25] hw:i386: typo fix: MEMORY_HOPTLUG_DEVICE -> MEMORY_HOTPLUG_DEVICE Michael Roth
2014-08-27 17:36 ` [Qemu-devel] [PATCH 08/25] pc-dimm: validate node property Michael Roth
2014-08-27 17:36 ` [Qemu-devel] [PATCH 09/25] pc-dimm: fix up error message Michael Roth
2014-08-27 17:36 ` [Qemu-devel] [PATCH 10/25] numa: show hex number in error message for consistency and prefix them with 0x Michael Roth
2014-08-27 17:36 ` [Qemu-devel] [PATCH 11/25] acpi: align RSDP Michael Roth
2014-08-27 17:36 ` [Qemu-devel] [PATCH 12/25] virtio-blk: fix reference a pointer which might be freed Michael Roth
2014-08-27 17:36 ` [Qemu-devel] [PATCH 13/25] target-arm: Fix return address for A64 BRK instructions Michael Roth
2014-08-27 17:36 ` [Qemu-devel] [PATCH 14/25] target-arm: Rename QEMU PSCI v0.1 definitions Michael Roth
2014-08-27 17:36 ` [Qemu-devel] [PATCH 15/25] arm/virt: Use PSCI v0.2 function IDs in the DT when KVM uses PSCI v0.2 Michael Roth
2014-08-27 17:36 ` [Qemu-devel] [PATCH 16/25] block/iscsi: fix memory corruption on iscsi resize Michael Roth
2014-08-27 17:36 ` [Qemu-devel] [PATCH 17/25] raw-posix: fix O_DIRECT short reads Michael Roth
2014-08-27 17:36 ` [Qemu-devel] [PATCH 18/25] qemu-iotests: add test case 101 for short file I/O Michael Roth
2014-08-27 17:36 ` [Qemu-devel] [PATCH 19/25] blkdebug: Delete BH in bdrv_aio_cancel Michael Roth
2014-08-27 17:36 ` [Qemu-devel] [PATCH 20/25] vmxnet3: Pad short frames to minimum size (60 bytes) Michael Roth
2014-08-27 17:36 ` [Qemu-devel] [PATCH 21/25] hostmem: set MPOL_MF_MOVE Michael Roth
2014-08-27 17:36 ` [Qemu-devel] [PATCH 22/25] pcihp: fix possible array out of bounds Michael Roth
2014-08-27 17:36 ` [Qemu-devel] [PATCH 23/25] pc: reserve more memory for ACPI for new machine types Michael Roth
2014-08-27 17:36 ` [Qemu-devel] [PATCH 24/25] thread-pool: avoid per-thread-pool EventNotifier Michael Roth
2014-08-27 17:36 ` [Qemu-devel] [PATCH 25/25] thread-pool: avoid deadlock in nested aio_poll() calls Michael Roth
2014-08-29  0:42 ` [Qemu-devel] Patch Round-up for stable 2.1.1, freeze on 2014-09-03 zhanghailiang
2014-08-29 15:12 ` Paolo Bonzini
2014-09-02  8:36 ` Michael S. Tsirkin
2014-09-02 15:20 ` [Qemu-devel] [Qemu-stable] " Michael Roth
2014-09-02 15:25   ` Michael S. Tsirkin
2014-09-02 15:27     ` Michael S. Tsirkin
2014-09-02 17:33       ` Andrey Korolyov
2014-09-02 19:53         ` Michael Roth
2014-09-02 21:03         ` Michael S. Tsirkin
2014-09-02 21:29           ` Andrey Korolyov
2014-09-02 21:51             ` Michael S. Tsirkin
2014-09-02 22:09               ` Andrey Korolyov
2014-09-02 22:17                 ` Andrey Korolyov
2014-09-03  6:10                   ` Michael S. Tsirkin
2014-09-03  7:43                     ` Andrey Korolyov
2014-09-03  8:13                       ` Michael S. Tsirkin
2014-09-03  8:36                         ` Andrey Korolyov
2014-09-03  9:07                           ` Michael S. Tsirkin
2014-09-03  9:18                             ` Andrey Korolyov
2014-09-03  9:31                               ` Michael S. Tsirkin
2014-09-03  6:35                   ` Michael S. Tsirkin
2014-09-03  5:57                     ` Jason Wang
2014-09-03  6:37                   ` Michael S. Tsirkin
2014-09-02 21:58             ` Michael Roth
2014-09-03 17:57               ` Michael S. Tsirkin
2014-09-03 18:59                 ` Michael Roth
2014-09-04 23:32   ` Michael Roth

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=1409160982-16389-3-git-send-email-mdroth@linux.vnet.ibm.com \
    --to=mdroth@linux.vnet.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-stable@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.