qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Miguel Di Ciurcio Filho <miguel.filho@gmail.com>
To: qemu-devel@nongnu.org
Cc: armbru@redhat.com, lcapitulino@redhat.com,
	Miguel Di Ciurcio Filho <miguel.filho@gmail.com>,
	avi@redhat.com
Subject: [Qemu-devel] [PATCH v4 3/3] monitor: Convert 'info qdm' to QMP
Date: Fri, 23 Jul 2010 13:47:40 -0300	[thread overview]
Message-ID: <1279903660-9607-4-git-send-email-miguel.filho@gmail.com> (raw)
In-Reply-To: <1279903660-9607-1-git-send-email-miguel.filho@gmail.com>

---
 hw/qdev.c |   31 +++++++++++++++++++++++++++----
 hw/qdev.h |    2 +-
 monitor.c |    3 ++-
 3 files changed, 30 insertions(+), 6 deletions(-)

diff --git a/hw/qdev.c b/hw/qdev.c
index 14985f5..ea9633c 100644
--- a/hw/qdev.c
+++ b/hw/qdev.c
@@ -780,13 +780,36 @@ void do_info_qtree(Monitor *mon)
         qbus_print(mon, main_system_bus, 0);
 }
 
-void do_info_qdm(Monitor *mon)
+static void qdm_list_iter(QObject *obj, void *opaque)
 {
-    DeviceInfo *info;
 
-    for (info = device_info_list; info != NULL; info = info->next) {
-        qdev_print_devinfo(info);
+    Monitor *mon = opaque;
+    QDict *dev = qobject_to_qdict(obj);
+
+    monitor_printf(mon, "name \"%s\", bus %s", qdict_get_str(dev, "name"),
+            qdict_get_str(dev, "bus"));
+
+    if (qdict_haskey(dev, "alias")) {
+        monitor_printf(mon, ", alias \"%s\"", qdict_get_str(dev, "alias"));
     }
+
+    if (qdict_haskey(dev, "description")) {
+        monitor_printf(mon, ", desc \"%s\"", qdict_get_str(dev, "description"));
+    }
+
+    if (!qdict_get_bool(dev, "creatable")) {
+        monitor_printf(mon, ", no-user");
+    }
+
+    monitor_printf(mon, "\n");
+}
+
+void do_info_qdm_print(Monitor *mon, const QObject *ret_data)
+{
+    QList *devs;
+
+    devs = qobject_to_qlist(ret_data);
+    qlist_iter(devs, qdm_list_iter, mon);
 }
 
 static const char *qdev_property_type_to_string(int type)
diff --git a/hw/qdev.h b/hw/qdev.h
index 8c6fa06..04d8501 100644
--- a/hw/qdev.h
+++ b/hw/qdev.h
@@ -184,7 +184,7 @@ void qbus_free(BusState *bus);
 /*** monitor commands ***/
 
 void do_info_qtree(Monitor *mon);
-void do_info_qdm(Monitor *mon);
+void do_info_qdm_print(Monitor *mon, const QObject *ret_data);
 void do_available_devices(Monitor *mon, QObject **ret_data);
 int do_device_add(Monitor *mon, const QDict *qdict, QObject **ret_data);
 int do_device_del(Monitor *mon, const QDict *qdict, QObject **ret_data);
diff --git a/monitor.c b/monitor.c
index 384d5fc..1322416 100644
--- a/monitor.c
+++ b/monitor.c
@@ -2573,7 +2573,8 @@ static const mon_cmd_t info_cmds[] = {
         .args_type  = "",
         .params     = "",
         .help       = "show qdev device model list",
-        .mhandler.info = do_info_qdm,
+        .user_print = do_info_qdm_print,
+        .mhandler.info_new = do_available_devices,
     },
     {
         .name       = "roms",
-- 
1.7.1

  parent reply	other threads:[~2010-07-23 16:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-23 16:47 [Qemu-devel] [PATCH v4 0/3] QMP: Introduce query-available-devices (was query-qdm) Miguel Di Ciurcio Filho
2010-07-23 16:47 ` [Qemu-devel] [PATCH v4 1/3] QMP: Introduce the documentation for query-available-devices Miguel Di Ciurcio Filho
2010-07-23 16:47 ` [Qemu-devel] [PATCH v4 2/3] QMP: Introduce query-available-devices Miguel Di Ciurcio Filho
2010-07-23 16:47 ` Miguel Di Ciurcio Filho [this message]
2010-07-23 20:20 ` [Qemu-devel] Re: [PATCH v4 0/3] QMP: Introduce query-available-devices (was query-qdm) Luiz Capitulino

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=1279903660-9607-4-git-send-email-miguel.filho@gmail.com \
    --to=miguel.filho@gmail.com \
    --cc=armbru@redhat.com \
    --cc=avi@redhat.com \
    --cc=lcapitulino@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).