All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: marcandre.lureau@redhat.com,
Cc: qemu-devel@nongnu.org,  pbonzini@redhat.com,  berrange@redhat.com
Subject: Re: [PATCH 1/2] qdev: Convert array properties to QAPI-aware registration
Date: Thu, 05 Nov 2026 08:35:57 +0100	[thread overview]
Message-ID: <877birenmq.fsf@pond.sub.org> (raw)
In-Reply-To: <87cxsjepw6.fsf@pond.sub.org> (Markus Armbruster's message of "Thu, 05 Nov 2026 07:47:05 +0100")

Markus Armbruster <armbru@redhat.com> writes:

> marcandre.lureau@redhat.com writes:
>
>>> Add element_info and element_size fields to PropertyInfo.
>>> 
>>> Add typed array PropertyInfo definitions. Each one knows its element
>>> type at compile time through the new element_info and element_size
>>> fields of PropertyInfo.
>>> 
>>> Update DEFINE_PROP_ARRAY() to use them instead of the generic
>>> qdev_prop_array.
>>> 
>>> Use PropertyInfo fields element_info and element_size instead of
>>> Property fields arrayinfo and arrayfieldsize.  Remove arrayinfo and
>>> arrayfieldsize.
>>> 
>>> Infrastructure changes:
>>> - Make get_prop_array, set_prop_array, release_prop_array, and
>>>   default_prop_array non-static so they can be used by
>>>   DEFINE_PROP_ARRAY_INFO in other translation units
>>> - Add DEFINE_PROP_ARRAY_INFO macro in qdev-prop-internal.h
>>> 
>>> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
>>> Signed-off-by: Markus Armbruster <armbru@redhat.com>
>>> Message-ID: <20261104083816.1120306-2-armbru@redhat.com>
>
> [...]
>
>>> diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c
>>> index e2ea8945956c..7a7d4f9d7910 100644
>>> --- a/hw/core/qdev-properties.c
>>> +++ b/hw/core/qdev-properties.c
>
> [...]
>
>>> @@ -854,18 +860,24 @@ out_obj:
>>>      }
>>>  }
>>>  
>>> -static void default_prop_array(ObjectProperty *op, const Property *prop)
>>> +void default_prop_array(ObjectProperty *op, const Property *prop)
>>>  {
>>>      object_property_set_default_list(op);
>>>  }
>>>  
>>> -const PropertyInfo qdev_prop_array = {
>>> -    .type = "list",
>>> -    .get = get_prop_array,
>>> -    .set = set_prop_array,
>>> -    .release = release_prop_array,
>>> -    .set_default_value = default_prop_array,
>>> -};
>>> +const PropertyInfo qdev_prop_uint8_array =
>>> +    DEFINE_PROP_ARRAY_INFO(qdev_prop_uint8, uint8_t, &uint8List_type_info);
>>> +const PropertyInfo qdev_prop_uint16_array =
>>> +    DEFINE_PROP_ARRAY_INFO(qdev_prop_uint16, uint16_t, &uint16List_type_info);
>>> +const PropertyInfo qdev_prop_uint32_array =
>>> +    DEFINE_PROP_ARRAY_INFO(qdev_prop_uint32, uint32_t, &uint32List_type_info);
>>> +const PropertyInfo qdev_prop_uint64_array =
>>> +    DEFINE_PROP_ARRAY_INFO(qdev_prop_uint64, uint64_t, &uint64List_type_info);
>>> +const PropertyInfo qdev_prop_string_array =
>>> +    DEFINE_PROP_ARRAY_INFO(qdev_prop_string, char *, &strList_type_info);
>>> +
>>> +const PropertyInfo qdev_prop_link_array =
>>> +    DEFINE_PROP_ARRAY_INFO(qdev_prop_link, void *, NULL);
>>
>> It could use &strList_type_info, since qdev_prop_link uses
>> &str_type_info and serialize as object-path strings.
>
> Point.

qdev_prop_link's .qapi_type = &str_type_info is actually useless.

qdev_prop_link has .create = create_link_property, and
create_link_property() doesn't use prop->qapi_type.  It wraps around
object_class_property_add_link(), which passes null @qapi_type to
object_class_property_add().

I'll post a patch to make link and child property creation use
&str_type_info.

Once we have that, this patch can use &strList_type_info for
qdev_prop_link_array.



  reply	other threads:[~2026-11-05  7:36 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-04  8:38 [PATCH 0/2] qdev: Typed array properties for better QOM introspection Markus Armbruster
2026-11-04  8:38 ` [PATCH 1/2] qdev: Convert array properties to QAPI-aware registration Markus Armbruster
2026-11-04 10:27   ` marcandre.lureau
2026-11-05  6:47     ` Markus Armbruster
2026-11-05  7:35       ` Markus Armbruster [this message]
2026-11-04  8:38 ` [PATCH 2/2] qdev: Remove unused DEFINE_PROP_ARRAY parameter _arraytype Markus Armbruster
2026-11-04  8:40 ` [PATCH 0/2] qdev: Typed array properties for better QOM introspection Markus Armbruster

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=877birenmq.fsf@pond.sub.org \
    --to=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.