From: Luiz Capitulino Date: Thu, 6 Oct 2011 17:31:39 +0000 (-0300) Subject: qapi: Convert the cpu command X-Git-Tag: TizenStudio_2.0_p2.3.2~208^2~5099^2~13 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=755f196898e75bf453957609d1dbe02f73e5b12a;p=sdk%2Femulator%2Fqemu.git qapi: Convert the cpu command Signed-off-by: Anthony Liguori Signed-off-by: Luiz Capitulino --- diff --git a/hmp-commands.hx b/hmp-commands.hx index ab08d58..969ccf5 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -587,8 +587,7 @@ ETEXI .args_type = "index:i", .params = "index", .help = "set the default CPU", - .user_print = monitor_user_noop, - .mhandler.cmd_new = do_cpu_set, + .mhandler.cmd = hmp_cpu, }, STEXI diff --git a/hmp.c b/hmp.c index 619b8ba..35b0ca0 100644 --- a/hmp.c +++ b/hmp.c @@ -165,3 +165,15 @@ void hmp_system_powerdown(Monitor *mon, const QDict *qdict) { qmp_system_powerdown(NULL); } + +void hmp_cpu(Monitor *mon, const QDict *qdict) +{ + int64_t cpu_index; + + /* XXX: drop the monitor_set_cpu() usage when all HMP commands that + use it are converted to the QAPI */ + cpu_index = qdict_get_int(qdict, "index"); + if (monitor_set_cpu(cpu_index) < 0) { + monitor_printf(mon, "invalid CPU index\n"); + } +} diff --git a/hmp.h b/hmp.h index 49d9662..9322b7f 100644 --- a/hmp.h +++ b/hmp.h @@ -29,5 +29,6 @@ void hmp_quit(Monitor *mon, const QDict *qdict); void hmp_stop(Monitor *mon, const QDict *qdict); void hmp_system_reset(Monitor *mon, const QDict *qdict); void hmp_system_powerdown(Monitor *mon, const QDict *qdict); +void hmp_cpu(Monitor *mon, const QDict *qdict); #endif diff --git a/monitor.c b/monitor.c index 3e1cd33..1edb646 100644 --- a/monitor.c +++ b/monitor.c @@ -902,17 +902,6 @@ static void do_info_cpus(Monitor *mon, QObject **ret_data) *ret_data = QOBJECT(cpu_list); } -static int do_cpu_set(Monitor *mon, const QDict *qdict, QObject **ret_data) -{ - int index = qdict_get_int(qdict, "index"); - if (monitor_set_cpu(index) < 0) { - qerror_report(QERR_INVALID_PARAMETER_VALUE, "index", - "a CPU number"); - return -1; - } - return 0; -} - static void do_info_jit(Monitor *mon) { dump_exec_info((FILE *)mon, monitor_fprintf); diff --git a/qapi-schema.json b/qapi-schema.json index eb155b4..e4cf6da 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -351,3 +351,14 @@ # prompting the user in some way. ## { 'command': 'system_powerdown' } + +## +# @cpu: +# +# This command is a nop that is only provided for the purposes of compatibility. +# +# Since: 0.14.0 +# +# Notes: Do not use this command. +## +{ 'command': 'cpu', 'data': {'index': 'int'} } diff --git a/qmp-commands.hx b/qmp-commands.hx index 8efdb25..dcca53c 100644 --- a/qmp-commands.hx +++ b/qmp-commands.hx @@ -331,10 +331,7 @@ EQMP { .name = "cpu", .args_type = "index:i", - .params = "index", - .help = "set the default CPU", - .user_print = monitor_user_noop, - .mhandler.cmd_new = do_cpu_set, + .mhandler.cmd_new = qmp_marshal_input_cpu, }, SQMP diff --git a/qmp.c b/qmp.c index bf58b05..e84922b 100644 --- a/qmp.c +++ b/qmp.c @@ -90,3 +90,8 @@ void qmp_system_powerdown(Error **erp) { qemu_system_powerdown_request(); } + +void qmp_cpu(int64_t index, Error **errp) +{ + /* Just do nothing */ +}