Patchwork [07/25] Monitor: Convert bdrv_info_print() into bdrv_info()

login
register
mail settings
Submitter Luiz Capitulino
Date Dec. 6, 2010, 6:23 p.m.
Message ID <1291659852-23028-8-git-send-email-lcapitulino@redhat.com>
Download mbox | patch
Permalink /patch/74442/
State New
Headers show

Comments

Luiz Capitulino - Dec. 6, 2010, 6:23 p.m.
The new handler directly calls qmp_query_block() to gather
data and then prints it. This change allows us to drop the
user_print callback.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
---
 block.c   |    6 +++++-
 block.h   |    2 +-
 monitor.c |    3 +--
 3 files changed, 7 insertions(+), 4 deletions(-)

Patch

diff --git a/block.c b/block.c
index a5d865b..2eadd70 100644
--- a/block.c
+++ b/block.c
@@ -1591,9 +1591,13 @@  static void bdrv_print_dict(QObject *obj, void *opaque)
     monitor_printf(mon, "\n");
 }
 
-void bdrv_info_print(Monitor *mon, const QObject *data)
+void bdrv_info(Monitor *mon)
 {
+    QObject *data;
+
+    qmp_query_block(NULL, &data);
     qlist_iter(qobject_to_qlist(data), bdrv_print_dict, mon);
+    qobject_decref(data);
 }
 
 void qmp_query_block(Monitor *mon, QObject **ret_data)
diff --git a/block.h b/block.h
index a979d5b..e71b6ad 100644
--- a/block.h
+++ b/block.h
@@ -52,8 +52,8 @@  typedef enum {
 
 void bdrv_mon_event(const BlockDriverState *bdrv,
                     BlockMonEventAction action, int is_read);
-void bdrv_info_print(Monitor *mon, const QObject *data);
 void qmp_query_block(Monitor *mon, QObject **ret_data);
+void bdrv_info(Monitor *mon);
 void bdrv_stats_print(Monitor *mon, const QObject *data);
 void qmp_query_blockstats(Monitor *mon, QObject **ret_data);
 
diff --git a/monitor.c b/monitor.c
index d48c137..2bdaf03 100644
--- a/monitor.c
+++ b/monitor.c
@@ -2409,8 +2409,7 @@  static const mon_cmd_t info_cmds[] = {
         .args_type  = "",
         .params     = "",
         .help       = "show the block devices",
-        .user_print = bdrv_info_print,
-        .mhandler.info_new = qmp_query_block,
+        .mhandler.info = bdrv_info,
     },
     {
         .name       = "blockstats",