aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuiz Capitulino <lcapitulino@redhat.com>2009-11-26 22:58:53 -0200
committerAnthony Liguori <aliguori@us.ibm.com>2009-12-03 09:41:21 -0600
commit99e2fc1672bbf84d081729a42c6a579ffdffecf8 (patch)
tree86e7ace65d03f9e00821e69af4ea1c9edc2a07a1
parentadcb181afe5a951c521411c7a8e9d9b791aa6742 (diff)
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: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
-rw-r--r--monitor.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/monitor.c b/monitor.c
index 1dda8cdedb..e202ba0024 100644
--- a/monitor.c
+++ b/monitor.c
@@ -3187,6 +3187,18 @@ static void monitor_print_error(Monitor *mon)
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)
{
QDict *qdict;
@@ -3201,13 +3213,7 @@ static void monitor_handle_command(Monitor *mon, const char *cmdline)
qemu_errors_to_mon(mon);
if (monitor_handler_ported(cmd)) {
- QObject *data = NULL;
-
- cmd->mhandler.cmd_new(mon, qdict, &data);
- if (data)
- cmd->user_print(mon, data);
-
- qobject_decref(data);
+ monitor_call_handler(mon, cmd, qdict);
} else {
cmd->mhandler.cmd(mon, qdict);
}