From patchwork Tue Apr 29 09:10:28 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chunyan Liu X-Patchwork-Id: 343702 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 9222C1400A6 for ; Tue, 29 Apr 2014 19:14:29 +1000 (EST) Received: from localhost ([::1]:47992 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wf47P-000571-5x for incoming@patchwork.ozlabs.org; Tue, 29 Apr 2014 05:14:27 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50455) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wf44r-00007x-BE for qemu-devel@nongnu.org; Tue, 29 Apr 2014 05:11:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wf44l-0003Ok-8g for qemu-devel@nongnu.org; Tue, 29 Apr 2014 05:11:49 -0400 Received: from victor.provo.novell.com ([137.65.250.26]:57659) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wf44k-0003OM-Vw for qemu-devel@nongnu.org; Tue, 29 Apr 2014 05:11:43 -0400 Received: from linux-tt8j.lab.bej.apac.novell.com (prv-ext-foundry1int.gns.novell.com [137.65.251.240]) by victor.provo.novell.com with ESMTP (NOT encrypted); Tue, 29 Apr 2014 03:11:26 -0600 From: Chunyan Liu To: qemu-devel@nongnu.org Date: Tue, 29 Apr 2014 17:10:28 +0800 Message-Id: <1398762656-26079-5-git-send-email-cyliu@suse.com> X-Mailer: git-send-email 1.8.4.5 In-Reply-To: <1398762656-26079-1-git-send-email-cyliu@suse.com> References: <1398762656-26079-1-git-send-email-cyliu@suse.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 137.65.250.26 Cc: stefanha@redhat.com Subject: [Qemu-devel] [PATCH V26 04/32] qapi: output def_value_str when query command line options 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 Change qapi interfaces to output the newly added def_value_str when querying command line options. Signed-off-by: Dong Xu Wang Signed-off-by: Chunyan Liu Reviewed-by: Eric Blake Reviewed-by: Stefan Hajnoczi --- Changes to V25: * update @default description in .json file qapi-schema.json | 5 ++++- qmp-commands.hx | 2 ++ util/qemu-config.c | 4 ++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/qapi-schema.json b/qapi-schema.json index 0b00427..880829d 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -4088,12 +4088,15 @@ # # @help: #optional human readable text string, not suitable for parsing. # +# @default: #optional default value string (since 2.1) +# # Since 1.5 ## { 'type': 'CommandLineParameterInfo', 'data': { 'name': 'str', 'type': 'CommandLineParameterType', - '*help': 'str' } } + '*help': 'str', + '*default': 'str' } } ## # @CommandLineOptionInfo: diff --git a/qmp-commands.hx b/qmp-commands.hx index ed3ab92..1271332 100644 --- a/qmp-commands.hx +++ b/qmp-commands.hx @@ -2895,6 +2895,8 @@ Each array entry contains the following: or 'size') - "help": human readable description of the parameter (json-string, optional) + - "default": default value string for the parameter + (json-string, optional) Example: diff --git a/util/qemu-config.c b/util/qemu-config.c index f4e4f38..ba375c0 100644 --- a/util/qemu-config.c +++ b/util/qemu-config.c @@ -82,6 +82,10 @@ static CommandLineParameterInfoList *query_option_descs(const QemuOptDesc *desc) info->has_help = true; info->help = g_strdup(desc[i].help); } + if (desc[i].def_value_str) { + info->has_q_default = true; + info->q_default = g_strdup(desc[i].def_value_str); + } entry = g_malloc0(sizeof(*entry)); entry->value = info;