From patchwork Fri Oct 1 18:19:11 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Capitulino X-Patchwork-Id: 66479 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 8434BB70E1 for ; Sat, 2 Oct 2010 04:27:18 +1000 (EST) Received: from localhost ([127.0.0.1]:40997 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P1kKB-0001r8-Hg for incoming@patchwork.ozlabs.org; Fri, 01 Oct 2010 14:27:15 -0400 Received: from [140.186.70.92] (port=49492 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P1kDU-00068O-EP for qemu-devel@nongnu.org; Fri, 01 Oct 2010 14:20:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1P1kD2-0003KL-Lf for qemu-devel@nongnu.org; Fri, 01 Oct 2010 14:20:20 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38223) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1P1kD2-0003JN-Ca for qemu-devel@nongnu.org; Fri, 01 Oct 2010 14:19:52 -0400 Received: from int-mx03.intmail.prod.int.phx2.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o91IJmEu018016 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 1 Oct 2010 14:19:48 -0400 Received: from localhost (ovpn-113-58.phx2.redhat.com [10.3.113.58]) by int-mx03.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o91IJl4J022315; Fri, 1 Oct 2010 14:19:47 -0400 From: Luiz Capitulino To: aliguori@us.ibm.com Date: Fri, 1 Oct 2010 15:19:11 -0300 Message-Id: <1285957167-1228-8-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1285957167-1228-1-git-send-email-lcapitulino@redhat.com> References: <1285957167-1228-1-git-send-email-lcapitulino@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.16 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. Cc: qemu-devel@nongnu.org Subject: [Qemu-devel] [PATCH 07/23] Monitor: Drop QMP bits from do_info() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 ff65f38..4fc0ad3 100644 --- a/monitor.c +++ b/monitor.c @@ -642,7 +642,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; } @@ -652,24 +651,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 @@ -677,24 +663,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;