From patchwork Thu Sep 26 01:57:15 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Wu X-Patchwork-Id: 278082 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id C08952C009F for ; Thu, 26 Sep 2013 11:58:07 +1000 (EST) Received: from localhost ([::1]:55739 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VP0qD-0005O0-Vg for incoming@patchwork.ozlabs.org; Wed, 25 Sep 2013 21:58:05 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59503) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VP0pk-0005Bu-Px for qemu-devel@nongnu.org; Wed, 25 Sep 2013 21:57:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VP0pb-0003ew-Nt for qemu-devel@nongnu.org; Wed, 25 Sep 2013 21:57:36 -0400 Received: from e28smtp02.in.ibm.com ([122.248.162.2]:60773) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VP0pb-0003eX-2O for qemu-devel@nongnu.org; Wed, 25 Sep 2013 21:57:27 -0400 Received: from /spool/local by e28smtp02.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 26 Sep 2013 07:27:22 +0530 Received: from d28dlp01.in.ibm.com (9.184.220.126) by e28smtp02.in.ibm.com (192.168.1.132) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 26 Sep 2013 07:27:20 +0530 Received: from d28relay02.in.ibm.com (d28relay02.in.ibm.com [9.184.220.59]) by d28dlp01.in.ibm.com (Postfix) with ESMTP id E1438E0040 for ; Thu, 26 Sep 2013 07:28:24 +0530 (IST) Received: from d28av03.in.ibm.com (d28av03.in.ibm.com [9.184.220.65]) by d28relay02.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r8Q1xdMw41746666 for ; Thu, 26 Sep 2013 07:29:40 +0530 Received: from d28av03.in.ibm.com (localhost [127.0.0.1]) by d28av03.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id r8Q1vInU025759 for ; Thu, 26 Sep 2013 07:27:18 +0530 Received: from localhost.localdomain ([9.125.25.189]) by d28av03.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id r8Q1vHtb025740; Thu, 26 Sep 2013 07:27:17 +0530 From: Mark Wu To: Qemu-devel@nongnu.org Date: Thu, 26 Sep 2013 09:57:15 +0800 Message-Id: <1380160635-15715-1-git-send-email-wudxw@linux.vnet.ibm.com> X-Mailer: git-send-email 1.8.3.1 X-TM-AS-MML: No X-Content-Scanned: Fidelis XPS MAILER x-cbid: 13092601-5816-0000-0000-00000A14CA5A X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 122.248.162.2 Cc: Mark Wu , Michael Roth , Luiz Capitulino Subject: [Qemu-devel] [PATCH v3] Extend qemu-ga's 'guest-info' command to expose flag 'success-response' X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Now we have several qemu-ga commands not returning response on success. It has been documented in qga/qapi-schema.json already. This patch exposes the 'success-response' flag by extending 'guest-info' command. With this change, the clients can handle the command response more flexibly. Signed-off-by: Mark Wu Reviewed-by: Eric Blake --- Changes: v3: 1. treat cmd->options as a bitmask instead of single option (per Eric) 2. rebase on the patch " Add interface to traverse the qmp command list by QmpCommand" to avoid the O(n2) problem (per Eric and Michael) v2: add the notation 'since 1.7' to the option 'success-response' (per Eric Blake's comments) qga/commands.c | 1 + qga/qapi-schema.json | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/qga/commands.c b/qga/commands.c index 602cd47..f70d0c4 100644 --- a/qga/commands.c +++ b/qga/commands.c @@ -54,6 +54,7 @@ static void qmp_command_info(QmpCommand *cmd, void *opaque) cmd_info = g_malloc0(sizeof(GuestAgentCommandInfo)); cmd_info->name = g_strdup(cmd->name); cmd_info->enabled = cmd->enabled; + cmd_info->success_response = !(cmd->options & QCO_NO_SUCCESS_RESP); cmd_info_list = g_malloc0(sizeof(GuestAgentCommandInfoList)); cmd_info_list->value = cmd_info; cmd_info_list->next = info->supported_commands; diff --git a/qga/qapi-schema.json b/qga/qapi-schema.json index 7155b7a..245f968 100644 --- a/qga/qapi-schema.json +++ b/qga/qapi-schema.json @@ -141,10 +141,13 @@ # # @enabled: whether command is currently enabled by guest admin # +# @success-response: whether command returns a response on success +# (since 1.7) +# # Since 1.1.0 ## { 'type': 'GuestAgentCommandInfo', - 'data': { 'name': 'str', 'enabled': 'bool' } } + 'data': { 'name': 'str', 'enabled': 'bool', 'success-response': 'bool' } } ## # @GuestAgentInfo