[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 01/21] Monitor: Introduce cmd_new_ret()
From: |
Luiz Capitulino |
Subject: |
[Qemu-devel] [PATCH 01/21] Monitor: Introduce cmd_new_ret() |
Date: |
Wed, 10 Feb 2010 23:49:47 -0200 |
In order to implement the new error handling and debugging
mechanism for command handlers, we need to change the cmd_new()
callback to return a value.
This commit introduces cmd_new_ret(), which returns a value and
will be used only temporarily to handle the transition from
cmd_new().
That is, as soon as all command handlers are ported to cmd_new_ret(),
it will be renamed back to cmd_new() and the new error handling
and debugging mechanism will be added on top of it.
Signed-off-by: Luiz Capitulino <address@hidden>
---
monitor.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/monitor.c b/monitor.c
index ae125b8..63c62fb 100644
--- a/monitor.c
+++ b/monitor.c
@@ -98,6 +98,7 @@ typedef struct mon_cmd_t {
const char *params;
const char *help;
void (*user_print)(Monitor *mon, const QObject *data);
+ int (*cmd_new_ret)(Monitor *mon, const QDict *params, QObject **ret_data);
union {
void (*info)(Monitor *mon);
void (*info_new)(Monitor *mon, QObject **ret_data);
@@ -3801,7 +3802,11 @@ static void monitor_call_handler(Monitor *mon, const
mon_cmd_t *cmd,
{
QObject *data = NULL;
- cmd->mhandler.cmd_new(mon, params, &data);
+ if (cmd->cmd_new_ret) {
+ cmd->cmd_new_ret(mon, params, &data);
+ } else {
+ cmd->mhandler.cmd_new(mon, params, &data);
+ }
if (is_async_return(data)) {
/*
--
1.6.6
- [Qemu-devel] [PATCH v0 00/21]: Monitor: improve handlers error handling, Luiz Capitulino, 2010/02/10
- [Qemu-devel] [PATCH 01/21] Monitor: Introduce cmd_new_ret(),
Luiz Capitulino <=
- [Qemu-devel] [PATCH 03/21] Monitor: Convert do_cont() to cmd_new_ret(), Luiz Capitulino, 2010/02/10
- [Qemu-devel] [PATCH 02/21] Monitor: Convert simple handlers to cmd_new_ret(), Luiz Capitulino, 2010/02/10
- [Qemu-devel] [PATCH 04/21] Monitor: Convert do_eject() to cmd_new_ret(), Luiz Capitulino, 2010/02/10
- [Qemu-devel] [PATCH 05/21] Monitor: Convert do_cpu_set() to cmd_new_ret(), Luiz Capitulino, 2010/02/10
- [Qemu-devel] [PATCH 06/21] Monitor: Convert do_block_set_passwd() to cmd_new_ret(), Luiz Capitulino, 2010/02/10
- [Qemu-devel] [PATCH 07/21] Monitor: Convert do_getfd() to cmd_new_ret(), Luiz Capitulino, 2010/02/10
- [Qemu-devel] [PATCH 08/21] Monitor: Convert do_closefd() to cmd_new_ret(), Luiz Capitulino, 2010/02/10
- [Qemu-devel] [PATCH 09/21] Monitor: Convert pci_device_hot_add() to cmd_new_ret(), Luiz Capitulino, 2010/02/10
- [Qemu-devel] [PATCH 10/21] Monitor: Convert pci_device_hot_remove() to cmd_new_ret(), Luiz Capitulino, 2010/02/10