diff mbox series

[for-6.0,2/6] qapi: Rename KvmInfo to AccelInfo

Message ID 20201116131011.26607-3-r.bolshakov@yadro.com (mailing list archive)
State New, archived
Headers show
Series Add HMP/QMP commands to query accelerator | expand

Commit Message

Roman Bolshakov Nov. 16, 2020, 1:10 p.m. UTC
There's nothing specific to KVM in the structure. A more generic name
would be more appropriate.

Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
---
 monitor/hmp-cmds.c |  4 ++--
 monitor/qmp-cmds.c |  8 ++++----
 qapi/machine.json  | 18 +++++++++---------
 3 files changed, 15 insertions(+), 15 deletions(-)

Comments

Dr. David Alan Gilbert Nov. 27, 2020, 10:40 a.m. UTC | #1
* Roman Bolshakov (r.bolshakov@yadro.com) wrote:
> There's nothing specific to KVM in the structure. A more generic name
> would be more appropriate.
> 
> Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>

For HMP:

Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>

Markus/Eric: Is it OK from QMP to change the type like that?

Dave

> ---
>  monitor/hmp-cmds.c |  4 ++--
>  monitor/qmp-cmds.c |  8 ++++----
>  qapi/machine.json  | 18 +++++++++---------
>  3 files changed, 15 insertions(+), 15 deletions(-)
> 
> diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
> index a6a6684df1..ea86289fe8 100644
> --- a/monitor/hmp-cmds.c
> +++ b/monitor/hmp-cmds.c
> @@ -120,7 +120,7 @@ void hmp_info_version(Monitor *mon, const QDict *qdict)
>  
>  void hmp_info_kvm(Monitor *mon, const QDict *qdict)
>  {
> -    KvmInfo *info;
> +    AccelInfo *info;
>  
>      info = qmp_query_kvm(NULL);
>      monitor_printf(mon, "kvm support: ");
> @@ -130,7 +130,7 @@ void hmp_info_kvm(Monitor *mon, const QDict *qdict)
>          monitor_printf(mon, "not compiled\n");
>      }
>  
> -    qapi_free_KvmInfo(info);
> +    qapi_free_AccelInfo(info);
>  }
>  
>  void hmp_info_status(Monitor *mon, const QDict *qdict)
> diff --git a/monitor/qmp-cmds.c b/monitor/qmp-cmds.c
> index 0454394e76..f5d50afa9c 100644
> --- a/monitor/qmp-cmds.c
> +++ b/monitor/qmp-cmds.c
> @@ -52,9 +52,9 @@ NameInfo *qmp_query_name(Error **errp)
>      return info;
>  }
>  
> -KvmInfo *qmp_query_kvm(Error **errp)
> +AccelInfo *qmp_query_kvm(Error **errp)
>  {
> -    KvmInfo *info = g_malloc0(sizeof(*info));
> +    AccelInfo *info = g_malloc0(sizeof(*info));
>  
>      info->enabled = kvm_enabled();
>      info->present = kvm_available();
> @@ -62,9 +62,9 @@ KvmInfo *qmp_query_kvm(Error **errp)
>      return info;
>  }
>  
> -KvmInfo *qmp_query_accel(const char *name, Error **errp)
> +AccelInfo *qmp_query_accel(const char *name, Error **errp)
>  {
> -    KvmInfo *info = g_malloc0(sizeof(*info));
> +    AccelInfo *info = g_malloc0(sizeof(*info));
>  
>      AccelClass *ac = accel_find(name);
>  
> diff --git a/qapi/machine.json b/qapi/machine.json
> index 11f364fab4..5648d8d24d 100644
> --- a/qapi/machine.json
> +++ b/qapi/machine.json
> @@ -562,24 +562,24 @@
>  { 'command': 'inject-nmi' }
>  
>  ##
> -# @KvmInfo:
> +# @AccelInfo:
>  #
> -# Information about support for KVM acceleration
> +# Information about support for an acceleration
>  #
> -# @enabled: true if KVM acceleration is active
> +# @enabled: true if an acceleration is active
>  #
> -# @present: true if KVM acceleration is built into this executable
> +# @present: true if an acceleration is built into this executable
>  #
>  # Since: 0.14.0
>  ##
> -{ 'struct': 'KvmInfo', 'data': {'enabled': 'bool', 'present': 'bool'} }
> +{ 'struct': 'AccelInfo', 'data': {'enabled': 'bool', 'present': 'bool'} }
>  
>  ##
>  # @query-kvm:
>  #
>  # Returns information about KVM acceleration
>  #
> -# Returns: @KvmInfo
> +# Returns: @AccelInfo
>  #
>  # Since: 0.14.0
>  #
> @@ -589,14 +589,14 @@
>  # <- { "return": { "enabled": true, "present": true } }
>  #
>  ##
> -{ 'command': 'query-kvm', 'returns': 'KvmInfo' }
> +{ 'command': 'query-kvm', 'returns': 'AccelInfo' }
>  
>  ##
>  # @query-accel:
>  #
>  # Returns information about an accelerator
>  #
> -# Returns: @KvmInfo
> +# Returns: @AccelInfo
>  #
>  # Since: 6.0.0
>  #
> @@ -608,7 +608,7 @@
>  ##
>  { 'command': 'query-accel',
>    'data': { 'name': 'str' },
> -  'returns': 'KvmInfo' }
> +  'returns': 'AccelInfo' }
>  
>  ##
>  # @NumaOptionsType:
> -- 
> 2.29.2
>
Markus Armbruster Nov. 27, 2020, 12:08 p.m. UTC | #2
"Dr. David Alan Gilbert" <dgilbert@redhat.com> writes:

> * Roman Bolshakov (r.bolshakov@yadro.com) wrote:
>> There's nothing specific to KVM in the structure. A more generic name
>> would be more appropriate.
>> 
>> Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
>
> For HMP:
>
> Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
>
> Markus/Eric: Is it OK from QMP to change the type like that?

Type names are not part of the external interface, and can therefore be
changed freely.

>> diff --git a/qapi/machine.json b/qapi/machine.json
>> index 11f364fab4..5648d8d24d 100644
>> --- a/qapi/machine.json
>> +++ b/qapi/machine.json
>> @@ -562,24 +562,24 @@
>>  { 'command': 'inject-nmi' }
>>  
>>  ##
>> -# @KvmInfo:
>> +# @AccelInfo:
>>  #
>> -# Information about support for KVM acceleration
>> +# Information about support for an acceleration

We might add accelerator information that isn't about "is this one
supported?", and then the description becomes misleading.

Suggest

    # Accelerator information

>>  #
>> -# @enabled: true if KVM acceleration is active
>> +# @enabled: true if an acceleration is active

Well, "an acceleration" is always active.  The flag tells us that *this*
accelerator is active.  Suggest

    # @enabled: whether this accelerator is active

>>  #
>> -# @present: true if KVM acceleration is built into this executable
>> +# @present: true if an acceleration is built into this executable

Suggest

    # @present: whether this accelerator is ...


>>  #
>>  # Since: 0.14.0
>>  ##
>> -{ 'struct': 'KvmInfo', 'data': {'enabled': 'bool', 'present': 'bool'} }
>> +{ 'struct': 'AccelInfo', 'data': {'enabled': 'bool', 'present': 'bool'} }
>>  
>>  ##
>>  # @query-kvm:
>>  #
>>  # Returns information about KVM acceleration
>>  #
>> -# Returns: @KvmInfo
>> +# Returns: @AccelInfo
>>  #
>>  # Since: 0.14.0
>>  #
>> @@ -589,14 +589,14 @@
>>  # <- { "return": { "enabled": true, "present": true } }
>>  #
>>  ##
>> -{ 'command': 'query-kvm', 'returns': 'KvmInfo' }
>> +{ 'command': 'query-kvm', 'returns': 'AccelInfo' }
>>  
>>  ##
>>  # @query-accel:
>>  #
>>  # Returns information about an accelerator
>>  #
>> -# Returns: @KvmInfo
>> +# Returns: @AccelInfo
>>  #
>>  # Since: 6.0.0
>>  #
>> @@ -608,7 +608,7 @@
>>  ##
>>  { 'command': 'query-accel',
>>    'data': { 'name': 'str' },
>> -  'returns': 'KvmInfo' }
>> +  'returns': 'AccelInfo' }
>>  
>>  ##
>>  # @NumaOptionsType:
>> -- 
>> 2.29.2
>> 

Adjust the comments, and you may add
Acked-by: Markus Armbruster <armbru@redhat.com>
diff mbox series

Patch

diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
index a6a6684df1..ea86289fe8 100644
--- a/monitor/hmp-cmds.c
+++ b/monitor/hmp-cmds.c
@@ -120,7 +120,7 @@  void hmp_info_version(Monitor *mon, const QDict *qdict)
 
 void hmp_info_kvm(Monitor *mon, const QDict *qdict)
 {
-    KvmInfo *info;
+    AccelInfo *info;
 
     info = qmp_query_kvm(NULL);
     monitor_printf(mon, "kvm support: ");
@@ -130,7 +130,7 @@  void hmp_info_kvm(Monitor *mon, const QDict *qdict)
         monitor_printf(mon, "not compiled\n");
     }
 
-    qapi_free_KvmInfo(info);
+    qapi_free_AccelInfo(info);
 }
 
 void hmp_info_status(Monitor *mon, const QDict *qdict)
diff --git a/monitor/qmp-cmds.c b/monitor/qmp-cmds.c
index 0454394e76..f5d50afa9c 100644
--- a/monitor/qmp-cmds.c
+++ b/monitor/qmp-cmds.c
@@ -52,9 +52,9 @@  NameInfo *qmp_query_name(Error **errp)
     return info;
 }
 
-KvmInfo *qmp_query_kvm(Error **errp)
+AccelInfo *qmp_query_kvm(Error **errp)
 {
-    KvmInfo *info = g_malloc0(sizeof(*info));
+    AccelInfo *info = g_malloc0(sizeof(*info));
 
     info->enabled = kvm_enabled();
     info->present = kvm_available();
@@ -62,9 +62,9 @@  KvmInfo *qmp_query_kvm(Error **errp)
     return info;
 }
 
-KvmInfo *qmp_query_accel(const char *name, Error **errp)
+AccelInfo *qmp_query_accel(const char *name, Error **errp)
 {
-    KvmInfo *info = g_malloc0(sizeof(*info));
+    AccelInfo *info = g_malloc0(sizeof(*info));
 
     AccelClass *ac = accel_find(name);
 
diff --git a/qapi/machine.json b/qapi/machine.json
index 11f364fab4..5648d8d24d 100644
--- a/qapi/machine.json
+++ b/qapi/machine.json
@@ -562,24 +562,24 @@ 
 { 'command': 'inject-nmi' }
 
 ##
-# @KvmInfo:
+# @AccelInfo:
 #
-# Information about support for KVM acceleration
+# Information about support for an acceleration
 #
-# @enabled: true if KVM acceleration is active
+# @enabled: true if an acceleration is active
 #
-# @present: true if KVM acceleration is built into this executable
+# @present: true if an acceleration is built into this executable
 #
 # Since: 0.14.0
 ##
-{ 'struct': 'KvmInfo', 'data': {'enabled': 'bool', 'present': 'bool'} }
+{ 'struct': 'AccelInfo', 'data': {'enabled': 'bool', 'present': 'bool'} }
 
 ##
 # @query-kvm:
 #
 # Returns information about KVM acceleration
 #
-# Returns: @KvmInfo
+# Returns: @AccelInfo
 #
 # Since: 0.14.0
 #
@@ -589,14 +589,14 @@ 
 # <- { "return": { "enabled": true, "present": true } }
 #
 ##
-{ 'command': 'query-kvm', 'returns': 'KvmInfo' }
+{ 'command': 'query-kvm', 'returns': 'AccelInfo' }
 
 ##
 # @query-accel:
 #
 # Returns information about an accelerator
 #
-# Returns: @KvmInfo
+# Returns: @AccelInfo
 #
 # Since: 6.0.0
 #
@@ -608,7 +608,7 @@ 
 ##
 { 'command': 'query-accel',
   'data': { 'name': 'str' },
-  'returns': 'KvmInfo' }
+  'returns': 'AccelInfo' }
 
 ##
 # @NumaOptionsType: