diff mbox

[08/17] monitor: Convert do_info_hpet() to QObject

Message ID 1258489944-12159-9-git-send-email-lcapitulino@redhat.com
State New
Headers show

Commit Message

Luiz Capitulino Nov. 17, 2009, 8:32 p.m. UTC
The returned QObject is a QString.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
---
 monitor.c |   24 +++++++++++++++++++++---
 1 files changed, 21 insertions(+), 3 deletions(-)
diff mbox

Patch

diff --git a/monitor.c b/monitor.c
index 5140198..9ecf5ff 100644
--- a/monitor.c
+++ b/monitor.c
@@ -361,10 +361,27 @@  static void do_info_name(Monitor *mon, QObject **ret_data)
 }
 
 #if defined(TARGET_I386)
-static void do_info_hpet(Monitor *mon)
+static void do_info_hpet_print(Monitor *mon, const QObject *data)
 {
     monitor_printf(mon, "HPET is %s by QEMU\n",
-                   (no_hpet) ? "disabled" : "enabled");
+                   qstring_get_str(qobject_to_qstring(data)));
+}
+
+/**
+ * do_info_hpet(): Show HPET state
+ *
+ * Return a QString with HPET information, which can be:
+ *
+ * - "enabled"
+ * - "disabled"
+ */
+static void do_info_hpet(Monitor *mon, QObject **ret_data)
+{
+    if (no_hpet) {
+        *ret_data = QOBJECT(qstring_from_str("disabled"));
+    } else {
+        *ret_data = QOBJECT(qstring_from_str("enabled"));
+    }
 }
 #endif
 
@@ -2096,7 +2113,8 @@  static const mon_cmd_t info_cmds[] = {
         .args_type  = "",
         .params     = "",
         .help       = "show state of HPET",
-        .mhandler.info = do_info_hpet,
+        .user_print = do_info_hpet_print,
+        .mhandler.info_new = do_info_hpet,
     },
 #endif
     {