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 <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
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);
{
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)) {
/*