mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-07-27 04:13:53 -06:00
qapi: Implement deprecated-output=hide for QMP command results
This policy suppresses deprecated bits in output, and thus permits "testing the future". Implement it for QMP command results. Example: when QEMU is run with -compat deprecated-output=hide, then {"execute": "query-cpus-fast"} yields {"return": [{"thread-id": 9805, "props": {"core-id": 0, "thread-id": 0, "socket-id": 0}, "qom-path": "/machine/unattached/device[0]", "cpu-index": 0, "target": "x86_64"}]} instead of {"return": [{"arch": "x86", "thread-id": 22436, "props": {"core-id": 0, "thread-id": 0, "socket-id": 0}, "qom-path": "/machine/unattached/device[0]", "cpu-index": 0, "target": "x86_64"}]} Note the suppression of deprecated member "arch". Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <20210318155519.1224118-4-armbru@redhat.com>
This commit is contained in:
parent
6dd75472d5
commit
91fa93e516
13 changed files with 132 additions and 24 deletions
|
@ -77,6 +77,7 @@ bool visit_type_%(c_name)s_members(Visitor *v, %(c_name)s *obj, Error **errp)
|
|||
c_type=base.c_name())
|
||||
|
||||
for memb in members:
|
||||
deprecated = 'deprecated' in [f.name for f in memb.features]
|
||||
ret += gen_if(memb.ifcond)
|
||||
if memb.optional:
|
||||
ret += mcgen('''
|
||||
|
@ -84,6 +85,12 @@ bool visit_type_%(c_name)s_members(Visitor *v, %(c_name)s *obj, Error **errp)
|
|||
''',
|
||||
name=memb.name, c_name=c_name(memb.name))
|
||||
indent.increase()
|
||||
if deprecated:
|
||||
ret += mcgen('''
|
||||
if (visit_deprecated(v, "%(name)s")) {
|
||||
''',
|
||||
name=memb.name)
|
||||
indent.increase()
|
||||
ret += mcgen('''
|
||||
if (!visit_type_%(c_type)s(v, "%(name)s", &obj->%(c_name)s, errp)) {
|
||||
return false;
|
||||
|
@ -91,6 +98,11 @@ bool visit_type_%(c_name)s_members(Visitor *v, %(c_name)s *obj, Error **errp)
|
|||
''',
|
||||
c_type=memb.type.c_name(), name=memb.name,
|
||||
c_name=c_name(memb.name))
|
||||
if deprecated:
|
||||
indent.decrease()
|
||||
ret += mcgen('''
|
||||
}
|
||||
''')
|
||||
if memb.optional:
|
||||
indent.decrease()
|
||||
ret += mcgen('''
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue