提交 956f1a0d 编写于 作者: L Luiz Capitulino 提交者: Anthony Liguori

QMP: do_info() checks

This commit adds specific QMP checks to do_info(), so that
it behaves as expected in QMP mode.
Signed-off-by: NLuiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
上级 25b422eb
......@@ -367,16 +367,23 @@ static void do_info(Monitor *mon, const QDict *qdict, QObject **ret_data)
const mon_cmd_t *cmd;
const char *item = qdict_get_try_str(qdict, "item");
if (!item)
if (!item) {
assert(monitor_ctrl_mode(mon) == 0);
goto help;
}
for (cmd = info_cmds; cmd->name != NULL; cmd++) {
if (compare_cmd(item, cmd->name))
break;
}
if (cmd->name == NULL)
if (cmd->name == NULL) {
if (monitor_ctrl_mode(mon)) {
qemu_error_new(QERR_COMMAND_NOT_FOUND, item);
return;
}
goto help;
}
if (monitor_handler_ported(cmd)) {
cmd->mhandler.info_new(mon, ret_data);
......@@ -390,7 +397,12 @@ static void do_info(Monitor *mon, const QDict *qdict, QObject **ret_data)
cmd->user_print(mon, *ret_data);
}
} else {
cmd->mhandler.info(mon);
if (monitor_ctrl_mode(mon)) {
/* handler not converted yet */
qemu_error_new(QERR_COMMAND_NOT_FOUND, item);
} else {
cmd->mhandler.info(mon);
}
}
return;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册