提交 99e2fc16 编写于 作者: L Luiz Capitulino 提交者: Anthony Liguori

monitor: Introduce monitor_call_handler()

This commit moves the code which calls Monitor handlers to
its own function, as it will be used by QMP code as well.
Signed-off-by: NLuiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
上级 adcb181a
...@@ -3187,6 +3187,18 @@ static void monitor_print_error(Monitor *mon) ...@@ -3187,6 +3187,18 @@ static void monitor_print_error(Monitor *mon)
mon->error = NULL; mon->error = NULL;
} }
static void monitor_call_handler(Monitor *mon, const mon_cmd_t *cmd,
const QDict *params)
{
QObject *data = NULL;
cmd->mhandler.cmd_new(mon, params, &data);
if (data)
cmd->user_print(mon, data);
qobject_decref(data);
}
static void monitor_handle_command(Monitor *mon, const char *cmdline) static void monitor_handle_command(Monitor *mon, const char *cmdline)
{ {
QDict *qdict; QDict *qdict;
...@@ -3201,13 +3213,7 @@ static void monitor_handle_command(Monitor *mon, const char *cmdline) ...@@ -3201,13 +3213,7 @@ static void monitor_handle_command(Monitor *mon, const char *cmdline)
qemu_errors_to_mon(mon); qemu_errors_to_mon(mon);
if (monitor_handler_ported(cmd)) { if (monitor_handler_ported(cmd)) {
QObject *data = NULL; monitor_call_handler(mon, cmd, qdict);
cmd->mhandler.cmd_new(mon, qdict, &data);
if (data)
cmd->user_print(mon, data);
qobject_decref(data);
} else { } else {
cmd->mhandler.cmd(mon, qdict); cmd->mhandler.cmd(mon, qdict);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册