Patchwork [05/21] Monitor: Convert do_cpu_set() to cmd_new_ret()

login
register
mail settings
Submitter Luiz Capitulino
Date Feb. 11, 2010, 1:49 a.m.
Message ID <1265853007-27300-6-git-send-email-lcapitulino@redhat.com>
Download mbox | patch
Permalink /patch/45082/
State New
Headers show

Comments

Luiz Capitulino - Feb. 11, 2010, 1:49 a.m.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
---
 monitor.c       |    7 +++++--
 qemu-monitor.hx |    2 +-
 2 files changed, 6 insertions(+), 3 deletions(-)

Patch

diff --git a/monitor.c b/monitor.c
index e960c38..598dbfe 100644
--- a/monitor.c
+++ b/monitor.c
@@ -921,11 +921,14 @@  static void do_info_cpus(Monitor *mon, QObject **ret_data)
     *ret_data = QOBJECT(cpu_list);
 }
 
-static void do_cpu_set(Monitor *mon, const QDict *qdict, QObject **ret_data)
+static int do_cpu_set(Monitor *mon, const QDict *qdict, QObject **ret_data)
 {
     int index = qdict_get_int(qdict, "index");
-    if (mon_set_cpu(index) < 0)
+    if (mon_set_cpu(index) < 0) {
         qemu_error_new(QERR_INVALID_PARAMETER, "index");
+        return -1;
+    }
+    return 0;
 }
 
 static void do_info_jit(Monitor *mon)
diff --git a/qemu-monitor.hx b/qemu-monitor.hx
index c1bd773..835fd05 100644
--- a/qemu-monitor.hx
+++ b/qemu-monitor.hx
@@ -604,7 +604,7 @@  ETEXI
         .params     = "index",
         .help       = "set the default CPU",
         .user_print = monitor_user_noop,
-        .mhandler.cmd_new = do_cpu_set,
+        .cmd_new_ret = do_cpu_set,
     },
 
 STEXI