Patchwork [6/6] monitor: convert do_cpu_set() to QObject, QError

login
register
mail settings
Submitter Markus Armbruster
Date Jan. 15, 2010, 4:25 p.m.
Message ID <1263572729-14813-7-git-send-email-armbru@redhat.com>
Download mbox | patch
Permalink /patch/42973/
State New
Headers show

Comments

Markus Armbruster - Jan. 15, 2010, 4:25 p.m.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 monitor.c       |    4 ++--
 qemu-monitor.hx |    3 ++-
 2 files changed, 4 insertions(+), 3 deletions(-)

Patch

diff --git a/monitor.c b/monitor.c
index 6664a04..5f0a54c 100644
--- a/monitor.c
+++ b/monitor.c
@@ -797,11 +797,11 @@  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)
+static void do_cpu_set(Monitor *mon, const QDict *qdict, QObject **ret_data)
 {
     int index = qdict_get_int(qdict, "index");
     if (mon_set_cpu(index) < 0)
-        monitor_printf(mon, "Invalid CPU index\n");
+        qemu_error_new(QERR_INVALID_CPU_INDEX);
 }
 
 static void do_info_jit(Monitor *mon)
diff --git a/qemu-monitor.hx b/qemu-monitor.hx
index 1aa7818..415734a 100644
--- a/qemu-monitor.hx
+++ b/qemu-monitor.hx
@@ -573,7 +573,8 @@  ETEXI
         .args_type  = "index:i",
         .params     = "index",
         .help       = "set the default CPU",
-        .mhandler.cmd = do_cpu_set,
+        .user_print = monitor_user_noop,
+        .mhandler.cmd_new = do_cpu_set,
     },
 
 STEXI