[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 10/20] QMP: do_info() checks
From: |
Luiz Capitulino |
Subject: |
[Qemu-devel] [PATCH 10/20] QMP: do_info() checks |
Date: |
Thu, 26 Nov 2009 22:59:00 -0200 |
This commit adds specific QMP checks to do_info(), so that
it behaves as expected in QMP mode.
Signed-off-by: Luiz Capitulino <address@hidden>
---
monitor.c | 18 +++++++++++++++---
1 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/monitor.c b/monitor.c
index ffb5ed2..de56201 100644
--- a/monitor.c
+++ b/monitor.c
@@ -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;
--
1.6.6.rc0.50.gaf06e
- [Qemu-devel] [PATCH v1 00/20] QEMU Monitor Protocol, Luiz Capitulino, 2009/11/26
- [Qemu-devel] [PATCH 01/20] monitor: Introduce MONITOR_USE_CONTROL flag, Luiz Capitulino, 2009/11/26
- [Qemu-devel] [PATCH 02/20] monitor: Command-line flag to enable control mode, Luiz Capitulino, 2009/11/26
- [Qemu-devel] [PATCH 03/20] monitor: Introduce monitor_call_handler(), Luiz Capitulino, 2009/11/26
- [Qemu-devel] [PATCH 04/20] monitor: Introduce monitor_find_command(), Luiz Capitulino, 2009/11/26
- [Qemu-devel] [PATCH 05/20] monitor: Rename monitor_handle_command(), Luiz Capitulino, 2009/11/26
- [Qemu-devel] [PATCH 06/20] monitor: Introduce 'info commands', Luiz Capitulino, 2009/11/26
- [Qemu-devel] [PATCH 07/20] QError: Add errors needed by QMP, Luiz Capitulino, 2009/11/26
- [Qemu-devel] [PATCH 08/20] QMP: Initial support, Luiz Capitulino, 2009/11/26
- [Qemu-devel] [PATCH 09/20] QMP: Output support, Luiz Capitulino, 2009/11/26
- [Qemu-devel] [PATCH 10/20] QMP: do_info() checks,
Luiz Capitulino <=
- [Qemu-devel] [PATCH 11/20] QMP: Input support, Luiz Capitulino, 2009/11/26
- [Qemu-devel] [PATCH 12/20] QMP: Allow 'query-' commands, Luiz Capitulino, 2009/11/26
- [Qemu-devel] [PATCH 13/20] QMP: Asynchronous events infrastructure, Luiz Capitulino, 2009/11/26
- [Qemu-devel] [PATCH 14/20] QMP: Introduce basic asynchronous events, Luiz Capitulino, 2009/11/26
- [Qemu-devel] [PATCH 15/20] QMP: Disable monitor print functions, Luiz Capitulino, 2009/11/26
- [Qemu-devel] [PATCH 16/20] QMP: Introduce README file, Luiz Capitulino, 2009/11/26
- [Qemu-devel] [PATCH 17/20] QMP: Introduce specification, Luiz Capitulino, 2009/11/26
- [Qemu-devel] [PATCH 18/20] QMP: Introduce qmp-events.txt, Luiz Capitulino, 2009/11/26
- [Qemu-devel] [PATCH 19/20] QMP: Introduce qmp-shell, Luiz Capitulino, 2009/11/26
- [Qemu-devel] [PATCH 20/20] QMP: Introduce vm-info, Luiz Capitulino, 2009/11/26