From 87a751a09f4c55e7d37da70331df606859b5e6c0 Mon Sep 17 00:00:00 2001 From: Luiz Capitulino Date: Mon, 29 Mar 2010 16:14:36 -0300 Subject: [PATCH 01/23] Monitor: Introduce cmd_new_ret() RH-Author: Luiz Capitulino Message-id: <1269879298-30711-2-git-send-email-lcapitulino@redhat.com> Patchwork-id: 8169 O-Subject: [PATCH 01/23] Monitor: Introduce cmd_new_ret() Bugzilla: 563491 RH-Acked-by: Markus Armbruster RH-Acked-by: Juan Quintela RH-Acked-by: Kevin Wolf 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 Signed-off-by: Anthony Liguori (cherry picked from commit 97536cffbfb0b5f62b1dea50411031afa4f0cc35) --- monitor.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-) Signed-off-by: Eduardo Habkost --- monitor.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-) diff --git a/monitor.c b/monitor.c index 971ec0b..5ad7ce2 100644 --- a/monitor.c +++ b/monitor.c @@ -102,6 +102,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); @@ -3841,7 +3842,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.7.0.3