[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v7 06/65] qapi/introspect: Tweak integer type masking
- To: qemu-devel@xxxxxxxxxx
- From: marcandre.lureau@xxxxxxxxxx
- Date: Tue, 20 Oct 2026 14:45:23 +0400
- Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=mimecast20190719 header.d=redhat.com header.i="@redhat.com" header.h="From:Subject:Date:Message-Id:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding:In-Reply-To:References"
- Cc: Markus Armbruster <armbru@xxxxxxxxxx>, Michael Roth <michael.roth@xxxxxxx>, John Snow <jsnow@xxxxxxxxxx>, Peter Maydell <peter.maydell@xxxxxxxxxx>, Mauro Carvalho Chehab <mchehab+huawei@xxxxxxxxxx>, Pierrick Bouvier <pierrick.bouvier@xxxxxxxxxxxxxxxx>, Paolo Bonzini <pbonzini@xxxxxxxxxx>, Daniel P. Berrangé <berrange@xxxxxxxxxx>, Kostiantyn Kostiuk <kkostiuk@xxxxxxxxxx>, Eric Blake <eblake@xxxxxxxxxx>, David Hildenbrand <david@xxxxxxxxxx>, Igor Mammedov <imammedo@xxxxxxxxxx>, "Edgar E. Iglesias" <edgar.iglesias@xxxxxxxxx>, Jason Wang <jasowangio@xxxxxxxxx>, Marcelo Tosatti <mtosatti@xxxxxxxxxx>, kvm@xxxxxxxxxxxxxxx, Alberto Garcia <berto@xxxxxxxxxx>, Kevin Wolf <kwolf@xxxxxxxxxx>, Hanna Reitz <hreitz@xxxxxxxxxx>, Philippe Mathieu-Daudé <philmd@xxxxxxxxxxxxxxxx>, Zhao Liu <zhao1.liu@xxxxxxxxx>, Jonathan Cameron <jic23@xxxxxxxxxx>, Junjie Cao <junjie.cao@xxxxxxxxx>, Anisa Su <anisa.su@xxxxxxxxxxx>, Elena Ufimtseva <elena.ufimtseva@xxxxxxxxxx>, Jagannathan Raman <jag.raman@xxxxxxxxxx>, John Levon <john.levon@xxxxxxxxxxx>, Thanos Makatos <thanos.makatos@xxxxxxxxxxx>, Cédric Le Goater <clg@xxxxxxxxxx>, Cornelia Huck <cohuck@xxxxxxxxxx>, Eric Farman <farman@xxxxxxxxxxxxx>, Matthew Rosato <mjrosato@xxxxxxxxxxxxx>, Richard Henderson <richard.henderson@xxxxxxxxxx>, Ilya Leoshkevich <iii@xxxxxxxxxxxxx>, qemu-block@xxxxxxxxxx, linux-cxl@xxxxxxxxxxxxxxx, qemu-s390x@xxxxxxxxxx, "Michael S. Tsirkin" <mst@xxxxxxxxxx>, Sergio Lopez <slp@xxxxxxxxxx>, qemu-arm@xxxxxxxxxx, Palmer Dabbelt <palmer@xxxxxxxxxxx>, Alistair Francis <alistair.francis@xxxxxxx>, Weiwei Li <liwei1518@xxxxxxxxx>, Daniel Henrique Barboza <daniel.barboza@xxxxxxxxxxxxxxxx>, Liu Zhiwei <zhiwei_liu@xxxxxxxxxxxxxxxxx>, Chao Liu <chao.liu@xxxxxxxxxxxxxxxxxx>, qemu-riscv@xxxxxxxxxx, Song Gao <17746591750@xxxxxxx>, Bibo Mao <maobibo@xxxxxxxxxxx>, Xianglai Li <lixianglai@xxxxxxxxxxx>, Jiaxun Yang <jiaxun.yang@xxxxxxxxxxx>, Pedro Barbuda <pbarbuda@xxxxxxxxxxxxx>, Mohamed Mediouni <mohamed@xxxxxxxxxxxxxxxx>, Nicholas Piggin <npiggin@xxxxxxxxx>, Harsh Prateek Bora <harshpb@xxxxxxxxxxxxx>, Amit Machhiwal <amachhiw@xxxxxxxxxxxxx>, qemu-ppc@xxxxxxxxxx, Zhang Chen <zhangckid@xxxxxxxxx>, Li Zhijian <lizhijian@xxxxxxxxxxx>, Alistair Francis <alistair@xxxxxxxxxxxxx>, Alexander Graf <graf@xxxxxxxxxx>, "Gonglei (Arei)" <arei.gonglei@xxxxxxxxxx>, zhenwei pi <zhenwei.pi@xxxxxxxxx>, Ani Sinha <anisinha@xxxxxxxxxx>, Luc Michel <luc@xxxxxxxxxx>, Cédric Le Goater <clg@xxxxxxxx>, Jamin Lin <jamin_lin@xxxxxxxxxxxxxx>, Kane Chen <kane_chen@xxxxxxxxxxxxxx>, Samuel Tardieu <sam@xxxxxxxxxxx>, "Denis V. Lunev" <den@xxxxxxxxxx>, FangSheng Huang <FangSheng.Huang@xxxxxxx>, Tyrone Ting <kfting@xxxxxxxxxxx>, Hao Wu <wuhaotsh@xxxxxxxxxx>, Keith Busch <kbusch@xxxxxxxxxx>, Klaus Jensen <its@xxxxxxxxxxxxx>, Jesper Devantier <foss@xxxxxxxxxxx>, Aditya Gupta <adityag@xxxxxxxxxxxxx>, Glenn Miles <milesg@xxxxxxxxxxxxx>, Conor Dooley <conor@xxxxxxxxxx>, Sebastian Huber <sebastian.huber@xxxxxxxxxxxxxxxxxx>, Halil Pasic <pasic@xxxxxxxxxxxxx>, Christian Borntraeger <borntraeger@xxxxxxxxxxxxx>, Jason Herne <jjherne@xxxxxxxxxxxxx>, Titus Rwantare <titusr@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Anthony PERARD <anthony@xxxxxxxxxxxxxx>, Peter Xu <peterx@xxxxxxxxxx>, Chinmay Rath <rathc@xxxxxxxxxxxxx>, Hendrik Brueckner <brueckner@xxxxxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx, Roman Bolshakov <rbolshakov@xxxxxxx>, Phil Dennis-Jordan <phil@xxxxxxxxxxxxx>, Fam Zheng <fam@xxxxxxxxxx>, Farhan Ali <alifm@xxxxxxxxxxxxx>, Alex Williamson <alex@xxxxxxxxxxx>, Tao Tang <tangtao1634@xxxxxxxxxxxxxx>, Stefan Berger <stefanb@xxxxxxxxxxxxxxxxxx>, Fabiano Rosas <farosas@xxxxxxx>, Mark Cave-Ayland <mark.cave-ayland@xxxxxxxxxxxx>, Artyom Tarasenko <atar4qemu@xxxxxxxxx>, Yoshinori Sato <yoshinori.sato@xxxxxxxxx>, Jiri Pirko <jiri@xxxxxxxxxxx>, Eric Auger <eric.auger@xxxxxxxxxx>, Laurent Vivier <lvivier@xxxxxxxxxx>, Marc-André Lureau <marcandre.lureau@xxxxxxxxxx>
- Delivery-date: Tue, 20 Oct 2026 10:56:47 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
From: Markus Armbruster <armbru@xxxxxxxxxx>
Since introspection maps all integer types to 'int', we need to skip
all but one of them. Instead of filtering by hardcoded name, filter
out duplicates.
Signed-off-by: Markus Armbruster <armbru@xxxxxxxxxx>
Reviewed-by: Marc-André Lureau <marcandre.lureau@xxxxxxxxxx>
---
scripts/qapi/introspect.py | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/scripts/qapi/introspect.py b/scripts/qapi/introspect.py
index 15302ecf155a..dc6f70a6fe9e 100644
--- a/scripts/qapi/introspect.py
+++ b/scripts/qapi/introspect.py
@@ -172,7 +172,7 @@ def __init__(self, prefix: str, unmask: bool):
' * QAPI/QMP schema introspection', __doc__)
self._unmask = unmask
self._schema: Optional[QAPISchema] = None
- self._trees: List[Annotated[SchemaInfo]] = []
+ self._trees: Dict[str, Annotated[SchemaInfo]] = {}
self._genc.add(mcgen('''
#include "qemu/osdep.h"
#include "%(prefix)sqapi-introspect.h"
@@ -191,13 +191,14 @@ def visit_end(self) -> None:
extern const QLitObject %(c_name)s;
''',
c_name=c_name(name)))
+ trees = list(self._trees.values())
self._genc.add(mcgen('''
const QLitObject %(c_name)s = %(c_string)s;
''',
c_name=c_name(name),
- c_string=_tree_to_qlit(self._trees)))
+ c_string=_tree_to_qlit(trees)))
self._schema = None
- self._trees = []
+ self._trees = {}
def _name(self, name: str) -> str:
assert self._schema
@@ -235,7 +236,12 @@ def _gen_tree(self, name: str, mtype: str, obj: Dict[str,
object],
obj['meta-type'] = mtype
if features:
obj['features'] = self._gen_features(features)
- self._trees.append(Annotated(obj, ifcond, comment))
+ if introspection_name in self._trees:
+ # Duplicates are possible because
+ # QAPISchemaBuiltinType.introspection_name() returns 'int'
+ # for all integer types. Ignore them.
+ return
+ self._trees[introspection_name] = Annotated(obj, ifcond, comment)
def _gen_enum_member(self, member: QAPISchemaEnumMember
) -> Annotated[SchemaInfoEnumMember]:
@@ -268,8 +274,6 @@ def _gen_variant(self, variant: QAPISchemaVariant
def visit_builtin_type(self, name: str, info: Optional[QAPISourceInfo],
json_type: str) -> None:
- if json_type == 'int' and name != 'int':
- return
self._gen_tree(name, 'builtin', {'json-type': json_type})
def visit_enum_type(self, name: str, info: Optional[QAPISourceInfo],
@@ -287,8 +291,6 @@ def visit_enum_type(self, name: str, info:
Optional[QAPISourceInfo],
def visit_array_type(self, name: str, info: Optional[QAPISourceInfo],
ifcond: QAPISchemaIfCond,
element_type: QAPISchemaType) -> None:
- if element_type.json_type() == 'int' and name != 'intList':
- return
element = self._use_type(element_type)
self._gen_tree(name, 'array', {'element-type': element}, ifcond)
--
2.56.0.116.g6de20f6092dc
|