From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=39505 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OwKxM-0000ST-Up for qemu-devel@nongnu.org; Thu, 16 Sep 2010 16:21:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OwKxL-0001OG-B1 for qemu-devel@nongnu.org; Thu, 16 Sep 2010 16:21:20 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53630) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OwKxL-0001O8-47 for qemu-devel@nongnu.org; Thu, 16 Sep 2010 16:21:19 -0400 From: Luiz Capitulino Date: Thu, 16 Sep 2010 17:20:50 -0300 Message-Id: <1284668464-15981-5-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1284668464-15981-1-git-send-email-lcapitulino@redhat.com> References: <1284668464-15981-1-git-send-email-lcapitulino@redhat.com> Subject: [Qemu-devel] [PATCH 04/18] Monitor: Drop QMP bits from do_info() List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: aliguori@us.ibm.com, armbru@redhat.com As of last commit, QMP doesn't use do_info() anymore. Simplify it. Signed-off-by: Luiz Capitulino --- monitor.c | 39 ++++++++------------------------------- 1 files changed, 8 insertions(+), 31 deletions(-) diff --git a/monitor.c b/monitor.c index 0ddc826..b76e227 100644 --- a/monitor.c +++ b/monitor.c @@ -639,7 +639,6 @@ static int do_info(Monitor *mon, const QDict *qdict, QObject **ret_data) const char *item = qdict_get_try_str(qdict, "item"); if (!item) { - assert(monitor_ctrl_mode(mon) == 0); goto help; } @@ -649,24 +648,11 @@ static int do_info(Monitor *mon, const QDict *qdict, QObject **ret_data) } if (cmd->name == NULL) { - if (monitor_ctrl_mode(mon)) { - qerror_report(QERR_COMMAND_NOT_FOUND, item); - return -1; - } goto help; } - if (monitor_ctrl_mode(mon) && monitor_cmd_user_only(cmd)) { - qerror_report(QERR_COMMAND_NOT_FOUND, item); - return -1; - } - if (monitor_handler_is_async(cmd)) { - if (monitor_ctrl_mode(mon)) { - qmp_async_info_handler(mon, cmd); - } else { - user_async_info_handler(mon, cmd); - } + user_async_info_handler(mon, cmd); /* * Indicate that this command is asynchronous and will not return any * data (not even empty). Instead, the data will be returned via a @@ -674,24 +660,15 @@ static int do_info(Monitor *mon, const QDict *qdict, QObject **ret_data) */ *ret_data = qobject_from_jsonf("{ '__mon_async': 'return' }"); } else if (monitor_handler_ported(cmd)) { - cmd->mhandler.info_new(mon, ret_data); + QObject *info_data = NULL; - if (!monitor_ctrl_mode(mon)) { - /* - * User Protocol function is called here, Monitor Protocol is - * handled by monitor_call_handler() - */ - if (*ret_data) - cmd->user_print(mon, *ret_data); + cmd->mhandler.info_new(mon, &info_data); + if (info_data) { + cmd->user_print(mon, info_data); + qobject_decref(info_data); } } else { - if (monitor_ctrl_mode(mon)) { - /* handler not converted yet */ - qerror_report(QERR_COMMAND_NOT_FOUND, item); - return -1; - } else { - cmd->mhandler.info(mon); - } + cmd->mhandler.info(mon); } return 0; -- 1.7.3.rc2.dirty