Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NfOCl-0007AY-AH for qemu-devel@nongnu.org; Wed, 10 Feb 2010 20:50:55 -0500 Received: from [199.232.76.173] (port=57749 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NfOCk-00079w-SR for qemu-devel@nongnu.org; Wed, 10 Feb 2010 20:50:54 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1NfOCj-0001Jq-G0 for qemu-devel@nongnu.org; Wed, 10 Feb 2010 20:50:54 -0500 Received: from mx1.redhat.com ([209.132.183.28]:2597) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NfOCj-0001Jm-0p for qemu-devel@nongnu.org; Wed, 10 Feb 2010 20:50:53 -0500 Received: from int-mx05.intmail.prod.int.phx2.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.18]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o1B1oqfu014618 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 10 Feb 2010 20:50:52 -0500 From: Luiz Capitulino Date: Wed, 10 Feb 2010 23:50:00 -0200 Message-Id: <1265853007-27300-15-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1265853007-27300-1-git-send-email-lcapitulino@redhat.com> References: <1265853007-27300-1-git-send-email-lcapitulino@redhat.com> Subject: [Qemu-devel] [PATCH 14/21] Monitor: Convert do_info() to cmd_new_ret() List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: armbru@redhat.com Note that this function only fails in QMP, in the user Monitor it prints the help text instead. Signed-off-by: Luiz Capitulino --- monitor.c | 8 +++++--- qemu-monitor.hx | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/monitor.c b/monitor.c index 3470b0b..baedc34 100644 --- a/monitor.c +++ b/monitor.c @@ -556,7 +556,7 @@ static void user_async_info_handler(Monitor *mon, const mon_cmd_t *cmd) } } -static void do_info(Monitor *mon, const QDict *qdict, QObject **ret_data) +static int do_info(Monitor *mon, const QDict *qdict, QObject **ret_data) { const mon_cmd_t *cmd; const char *item = qdict_get_try_str(qdict, "item"); @@ -574,7 +574,7 @@ static void do_info(Monitor *mon, const QDict *qdict, QObject **ret_data) if (cmd->name == NULL) { if (monitor_ctrl_mode(mon)) { qemu_error_new(QERR_COMMAND_NOT_FOUND, item); - return; + return -1; } goto help; } @@ -606,15 +606,17 @@ static void do_info(Monitor *mon, const QDict *qdict, QObject **ret_data) if (monitor_ctrl_mode(mon)) { /* handler not converted yet */ qemu_error_new(QERR_COMMAND_NOT_FOUND, item); + return -1; } else { cmd->mhandler.info(mon); } } - return; + return 0; help: help_cmd(mon, "info"); + return 0; } static void do_info_version_print(Monitor *mon, const QObject *data) diff --git a/qemu-monitor.hx b/qemu-monitor.hx index 5ae1969..7bfb8d0 100644 --- a/qemu-monitor.hx +++ b/qemu-monitor.hx @@ -43,7 +43,7 @@ ETEXI .params = "[subcommand]", .help = "show various information about the system state", .user_print = monitor_user_noop, - .mhandler.cmd_new = do_info, + .cmd_new_ret = do_info, }, STEXI -- 1.6.6