From patchwork Tue Aug 13 04:32:05 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Wang X-Patchwork-Id: 266707 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (unknown [IPv6:2001:4830:134:3::12]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id BD54C2C010A for ; Tue, 13 Aug 2013 14:47:44 +1000 (EST) Received: from localhost ([::1]:49087 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V96WE-0005ve-Pb for incoming@patchwork.ozlabs.org; Tue, 13 Aug 2013 00:47:42 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55270) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V96JK-0008W4-4D for qemu-devel@nongnu.org; Tue, 13 Aug 2013 00:34:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V96JB-00010v-Hp for qemu-devel@nongnu.org; Tue, 13 Aug 2013 00:34:22 -0400 Received: from mail-pb0-x230.google.com ([2607:f8b0:400e:c01::230]:46252) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V96JB-00010n-Bm for qemu-devel@nongnu.org; Tue, 13 Aug 2013 00:34:13 -0400 Received: by mail-pb0-f48.google.com with SMTP id ma3so7490373pbc.21 for ; Mon, 12 Aug 2013 21:34:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=dli3Es4htbfcORHKbEUsbQzgaH/kMijY/cyJEcT9T50=; b=latzArNZwwyNX1hOXit9H4sEceUIHjYoUqJVwJNTNqsrn30iyZ5fzt1pYVC1Ctxvwk EScj+0hR+jETuxeKLDhY5fH7webTi8QzEECO5fg+oiw0wW383MAnobSLdWA0CvEEAon7 vuklHj/U9S6TfHqhwKA+bfsur4WUBB3iw+Z2gdLFppnhd5VVPXt7oHwV39M10Eap0uoD cDcEV8g0GSt27vd6SvIQJfKHtmEgmWkkx8VOEKw6mZJAaW2RfqZs04aP6Oj82oROZF1p A8DtFYB3dkzEJ9DdoPkucd/4hKzMTeHxetPpNM9FEuJIDAn4KASIRnjRqkbNowre0H30 RJ6w== X-Received: by 10.68.106.99 with SMTP id gt3mr2492159pbb.116.1376368452606; Mon, 12 Aug 2013 21:34:12 -0700 (PDT) Received: from 11.wdongxu.kvm58 ([202.108.130.153]) by mx.google.com with ESMTPSA id mz5sm10285023pbc.18.2013.08.12.21.34.09 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 12 Aug 2013 21:34:12 -0700 (PDT) From: Dong Xu Wang To: qemu-devel@nongnu.org Date: Tue, 13 Aug 2013 12:32:05 +0800 Message-Id: <1376368326-7433-25-git-send-email-wdongxu@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.11.7 In-Reply-To: <1376368326-7433-1-git-send-email-wdongxu@linux.vnet.ibm.com> References: <1376368326-7433-1-git-send-email-wdongxu@linux.vnet.ibm.com> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400e:c01::230 Cc: kwolf@redhat.com, wdongxu@cn.ibm.com, stefanha@redhat.com, Dong Xu Wang Subject: [Qemu-devel] [PATCH V18 24/25] qapi: query-command-line-options outputs def_value_str 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 QMP command query-command-line-options shows details information of parameters, since added def_value_str, also output it in the QMP command. v16->v17: 1) add "Since 1.6" tag. 2) rename def_str_value to "default". Signed-off-by: Dong Xu Wang --- qapi-schema.json | 8 ++++++-- qmp-commands.hx | 2 ++ util/qemu-config.c | 4 ++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/qapi-schema.json b/qapi-schema.json index a51f7d2..aa18d84 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -3630,12 +3630,16 @@ # # @help: #optional human readable text string, not suitable for parsing. # -# Since 1.5 +# @default: #optional string representation of the default used +# if the option is omitted. +# +# Since 1.6 ## { '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 cf47e3f..3c6ab30 100644 --- a/qmp-commands.hx +++ b/qmp-commands.hx @@ -2575,6 +2575,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 a59568d..315ecbf 100644 --- a/util/qemu-config.c +++ b/util/qemu-config.c @@ -67,6 +67,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;