diff mbox

[v2,18/19] qapi: Use anonymous base in CpuInfo

Message ID 1456443528-13901-19-git-send-email-eblake@redhat.com
State New
Headers show

Commit Message

Eric Blake Feb. 25, 2016, 11:38 p.m. UTC
Now that the generator supports it, we might as well use an
anonymous base rather than breaking out a single-use CpuInfoBase
structure.

Signed-off-by: Eric Blake <eblake@redhat.com>

---
v2: no change
v1: no change
Previously posted as part of qapi cleanup subset F:
v6: new patch
---
 scripts/qapi.py  |  2 +-
 qapi-schema.json | 20 ++++++--------------
 2 files changed, 7 insertions(+), 15 deletions(-)

Comments

Markus Armbruster March 3, 2016, 1:08 p.m. UTC | #1
Eric Blake <eblake@redhat.com> writes:

> Now that the generator supports it, we might as well use an
> anonymous base rather than breaking out a single-use CpuInfoBase
> structure.
>
> Signed-off-by: Eric Blake <eblake@redhat.com>

Again, introspection value remains the same.

Patch looks good.

Should we eliminate more base types?
Eric Blake March 4, 2016, 2:35 p.m. UTC | #2
On 03/03/2016 06:08 AM, Markus Armbruster wrote:
> Eric Blake <eblake@redhat.com> writes:
> 
>> Now that the generator supports it, we might as well use an
>> anonymous base rather than breaking out a single-use CpuInfoBase
>> structure.
>>
>> Signed-off-by: Eric Blake <eblake@redhat.com>
> 
> Again, introspection value remains the same.
> 
> Patch looks good.
> 
> Should we eliminate more base types?

At this point, we only have one other: BlockdevOptions.  Yes, I'll add
it to the list of cleanups.  I also have patches posted in the "subset
F" series that converts 'netdev_add' to be introspectible, and which
also uses the anonymous base.
diff mbox

Patch

diff --git a/scripts/qapi.py b/scripts/qapi.py
index 7c76442..d5f4e28 100644
--- a/scripts/qapi.py
+++ b/scripts/qapi.py
@@ -62,8 +62,8 @@  returns_whitelist = [
 # Whitelist of entities allowed to violate case conventions
 case_whitelist = [
     # From QMP:
+    ':obj-CpuInfo-base',    # CPU, visible through query-cpu
     'ACPISlotType',         # DIMM, visible through query-acpi-ospm-status
-    'CpuInfoBase',          # CPU, visible through query-cpu
     'CpuInfoMIPS',          # PC, visible through query-cpu
     'CpuInfoTricore',       # PC, visible through query-cpu
     'InputAxis',            # TODO: drop when x-input-send-event is fixed
diff --git a/qapi-schema.json b/qapi-schema.json
index 66cc364..967f8df 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -753,9 +753,9 @@ 
   'data': ['x86', 'sparc', 'ppc', 'mips', 'tricore', 'other' ] }

 ##
-# @CpuInfoBase:
+# @CpuInfo:
 #
-# Common information about a virtual CPU
+# Information about a virtual CPU
 #
 # @CPU: the index of the virtual CPU
 #
@@ -776,18 +776,10 @@ 
 # Notes: @halted is a transient state that changes frequently.  By the time the
 #        data is sent to the client, the guest may no longer be halted.
 ##
-{ 'struct': 'CpuInfoBase',
-  'data': {'CPU': 'int', 'current': 'bool', 'halted': 'bool',
-           'qom_path': 'str', 'thread_id': 'int', 'arch': 'CpuInfoArch' } }
-
-##
-# @CpuInfo:
-#
-# Information about a virtual CPU
-#
-# Since: 0.14.0
-##
-{ 'union': 'CpuInfo', 'base': 'CpuInfoBase', 'discriminator': 'arch',
+{ 'union': 'CpuInfo',
+  'base': {'CPU': 'int', 'current': 'bool', 'halted': 'bool',
+           'qom_path': 'str', 'thread_id': 'int', 'arch': 'CpuInfoArch' },
+  'discriminator': 'arch',
   'data': { 'x86': 'CpuInfoX86',
             'sparc': 'CpuInfoSPARC',
             'ppc': 'CpuInfoPPC',