Re: [PATCH v2 08/53] qapi/qom: add qapi-type field to ObjectPropertyInfo

Markus Armbruster <[email protected]>
Newsgroups gmane.comp.emulators.qemu
Message-ID <[email protected]>
Marc-André Lureau <[email protected]> writes:

> Add an optional 'qapi-type' field to ObjectPropertyInfo and
> ObjectPropertyValue. When present, it contains the masked type name that
> can be looked up in query-qmp-schema output. Absent for properties
> without a QAPI type association.

Always absent at this point, isn't it?

> Signed-off-by: Marc-André Lureau <[email protected]>
> ---
>  qapi/qom.json | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
>
> diff --git a/qapi/qom.json b/qapi/qom.json
> index dd45ac1087c..a655be0beaa 100644
> --- a/qapi/qom.json
> +++ b/qapi/qom.json
> @@ -35,6 +35,11 @@
   ##
   # @ObjectPropertyInfo:
   #
   # @name: the name of the property
   #
   # @type: the type of the property.  This will typically come in one of
   #     four forms:
   #
   #     1) A primitive type such as 'u8', 'u16', 'bool', 'str', or
   #        'double'.  These types are mapped to the appropriate JSON
   #        type.
   #
   #     2) A child type in the form 'child<subtype>' where subtype is a
   #        qdev device type name.  Child properties create the
   #        composition tree.
   #
   #     3) A link type in the form 'link<subtype>' where subtype is a
>  #        qdev device type name.  Link properties form the device model
>  #        graph.

The description of @type is problematic, and will need an update at some
time.

>  #
> +# @qapi-type: if the property was registered with a QAPI type
> +#     association, the type name as it appears in the output of
> +#     ``query-qmp-schema``.  Absent for properties without a QAPI
> +#     type association.  (since 11.1)

Whether "the property was registered with a QAPI type association" is
implementation detail.

Maybe

   # @qapi-type: the name of the property's type name as it appears in
   #     the output of ``query-qmp-schema``.  Absent if the type does not
   #     occur there.  (since 11.2)

This is inaccurate now --- it can also be absent when we haven't gotten
around to fix the property --- but it hopefully becomes accurate soon,
and should be good enough until then.

> +#
>  # @description: if specified, the description of the property.
>  #
>  # @default-value: the default value, if any (since 5.0)
> @@ -44,6 +49,7 @@
>  { 'struct': 'ObjectPropertyInfo',
>    'data': { 'name': 'str',
>              'type': 'str',
> +            '*qapi-type': 'str',
>              '*description': 'str',
>              '*default-value': 'any' } }
>  
> @@ -55,6 +61,11 @@
>  # @type: the type of the property, as described in
>  #     `ObjectPropertyInfo`.
>  #
> +# @qapi-type: if the property was registered with a QAPI type
> +#     association, the type name as it appears in the output of
> +#     ``query-qmp-schema``.  Absent for properties without a QAPI
> +#     type association.  (since 11.1)
> +#

Likewise.

>  # @value: the value of the property.  Absent when the property cannot
>  #     be read.
>  #
> @@ -63,6 +74,7 @@
>  { 'struct': 'ObjectPropertyValue',
>    'data': { 'name': 'str',
>              'type': 'str',
> +            '*qapi-type': 'str',
>              '*value': 'any' } }
>  
>  ##
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.