Monitor: Drop QMP bits from do_info()
As of last commit, QMP doesn't use do_info() anymore. Simplify it. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
This commit is contained in:
parent
030db6e89d
commit
1dcbd6f6b7
33
monitor.c
33
monitor.c
|
@ -642,7 +642,6 @@ static int do_info(Monitor *mon, const QDict *qdict, QObject **ret_data)
|
||||||
const char *item = qdict_get_try_str(qdict, "item");
|
const char *item = qdict_get_try_str(qdict, "item");
|
||||||
|
|
||||||
if (!item) {
|
if (!item) {
|
||||||
assert(monitor_ctrl_mode(mon) == 0);
|
|
||||||
goto help;
|
goto help;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -652,24 +651,11 @@ static int do_info(Monitor *mon, const QDict *qdict, QObject **ret_data)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cmd->name == NULL) {
|
if (cmd->name == NULL) {
|
||||||
if (monitor_ctrl_mode(mon)) {
|
|
||||||
qerror_report(QERR_COMMAND_NOT_FOUND, item);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
goto help;
|
goto help;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (monitor_ctrl_mode(mon) && monitor_cmd_user_only(cmd)) {
|
|
||||||
qerror_report(QERR_COMMAND_NOT_FOUND, item);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (monitor_handler_is_async(cmd)) {
|
if (monitor_handler_is_async(cmd)) {
|
||||||
if (monitor_ctrl_mode(mon)) {
|
|
||||||
qmp_async_info_handler(mon, cmd);
|
|
||||||
} else {
|
|
||||||
user_async_info_handler(mon, cmd);
|
user_async_info_handler(mon, cmd);
|
||||||
}
|
|
||||||
/*
|
/*
|
||||||
* Indicate that this command is asynchronous and will not return any
|
* Indicate that this command is asynchronous and will not return any
|
||||||
* data (not even empty). Instead, the data will be returned via a
|
* data (not even empty). Instead, the data will be returned via a
|
||||||
|
@ -677,25 +663,16 @@ static int do_info(Monitor *mon, const QDict *qdict, QObject **ret_data)
|
||||||
*/
|
*/
|
||||||
*ret_data = qobject_from_jsonf("{ '__mon_async': 'return' }");
|
*ret_data = qobject_from_jsonf("{ '__mon_async': 'return' }");
|
||||||
} else if (monitor_handler_ported(cmd)) {
|
} else if (monitor_handler_ported(cmd)) {
|
||||||
cmd->mhandler.info_new(mon, ret_data);
|
QObject *info_data = NULL;
|
||||||
|
|
||||||
if (!monitor_ctrl_mode(mon)) {
|
cmd->mhandler.info_new(mon, &info_data);
|
||||||
/*
|
if (info_data) {
|
||||||
* User Protocol function is called here, Monitor Protocol is
|
cmd->user_print(mon, info_data);
|
||||||
* handled by monitor_call_handler()
|
qobject_decref(info_data);
|
||||||
*/
|
|
||||||
if (*ret_data)
|
|
||||||
cmd->user_print(mon, *ret_data);
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
if (monitor_ctrl_mode(mon)) {
|
|
||||||
/* handler not converted yet */
|
|
||||||
qerror_report(QERR_COMMAND_NOT_FOUND, item);
|
|
||||||
return -1;
|
|
||||||
} else {
|
} else {
|
||||||
cmd->mhandler.info(mon);
|
cmd->mhandler.info(mon);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue