diff mbox

[V18,24/25] qapi: query-command-line-options outputs def_value_str

Message ID 1376368326-7433-25-git-send-email-wdongxu@linux.vnet.ibm.com
State New
Headers show

Commit Message

Robert Wang Aug. 13, 2013, 4:32 a.m. UTC
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 <wdongxu@linux.vnet.ibm.com>
---
 qapi-schema.json   | 8 ++++++--
 qmp-commands.hx    | 2 ++
 util/qemu-config.c | 4 ++++
 3 files changed, 12 insertions(+), 2 deletions(-)

Comments

Kevin Wolf Aug. 27, 2013, 2:12 p.m. UTC | #1
Am 13.08.2013 um 06:32 hat Dong Xu Wang geschrieben:
> 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 <wdongxu@linux.vnet.ibm.com>
> ---
>  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

The "Since 1.6" belongs to the @default field only. The command as a
whole is still "Since 1.5".

Kevin
Eric Blake Aug. 27, 2013, 11:13 p.m. UTC | #2
On 08/27/2013 08:12 AM, Kevin Wolf wrote:
> Am 13.08.2013 um 06:32 hat Dong Xu Wang geschrieben:
>> 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".

>> +++ 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
> 
> The "Since 1.6" belongs to the @default field only. The command as a
> whole is still "Since 1.5".

Further, 1.6 is already released, so this should now be:

@default #optional string representation of the default used if
         the option is omitted (since 1.7).
Robert Wang Aug. 28, 2013, 8:57 a.m. UTC | #3
On 2013/8/28 7:13, Eric Blake wrote:
> On 08/27/2013 08:12 AM, Kevin Wolf wrote:
>> Am 13.08.2013 um 06:32 hat Dong Xu Wang geschrieben:
>>> 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".
>
>>> +++ 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
>>
>> The "Since 1.6" belongs to the @default field only. The command as a
>> whole is still "Since 1.5".
>
> Further, 1.6 is already released, so this should now be:
>
> @default #optional string representation of the default used if
>           the option is omitted (since 1.7).
Okay, the description is precise. Thanks :)
>
diff mbox

Patch

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;