From patchwork Thu Feb 11 01:49:47 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Capitulino X-Patchwork-Id: 45079 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 0CB7DB7C33 for ; Thu, 11 Feb 2010 12:52:38 +1100 (EST) Received: from localhost ([127.0.0.1]:47131 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NfOEN-0007xW-G9 for incoming@patchwork.ozlabs.org; Wed, 10 Feb 2010 20:52:35 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NfOCE-0006hX-0c for qemu-devel@nongnu.org; Wed, 10 Feb 2010 20:50:22 -0500 Received: from [199.232.76.173] (port=57694 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NfOCC-0006gz-LJ for qemu-devel@nongnu.org; Wed, 10 Feb 2010 20:50:20 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1NfOC9-0001Cz-S8 for qemu-devel@nongnu.org; Wed, 10 Feb 2010 20:50:20 -0500 Received: from mx1.redhat.com ([209.132.183.28]:53274) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NfOC8-0001CZ-K5 for qemu-devel@nongnu.org; Wed, 10 Feb 2010 20:50:17 -0500 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o1B1oFc6008993 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 10 Feb 2010 20:50:16 -0500 Received: from localhost (vpn-10-105.rdu.redhat.com [10.11.10.105]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o1B1oEoJ005068; Wed, 10 Feb 2010 20:50:15 -0500 From: Luiz Capitulino To: qemu-devel@nongnu.org Date: Wed, 10 Feb 2010 23:49:47 -0200 Message-Id: <1265853007-27300-2-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> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Cc: armbru@redhat.com Subject: [Qemu-devel] [PATCH 01/21] Monitor: Introduce cmd_new_ret() 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 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 --- monitor.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-) diff --git a/monitor.c b/monitor.c index ae125b8..63c62fb 100644 --- a/monitor.c +++ b/monitor.c @@ -98,6 +98,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); @@ -3801,7 +3802,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)) { /*