From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Mark Cave-Ayland <mark.caveayland@nutanix.com>
Cc: palmer@dabbelt.com, alistair.francis@wdc.com,
liwei1518@gmail.com, daniel.barboza@oss.qualcomm.com,
zhiwei_liu@linux.alibaba.com, chao.liu@processmission.com,
pbonzini@redhat.com, qemu-riscv@nongnu.org,
qemu-devel@nongnu.org
Subject: Re: [PATCH 4/5] qom/object.h: add missing documentation for object_class_* property functions
Date: Fri, 17 Jul 2026 14:11:02 +0100 [thread overview]
Message-ID: <alop5gYJ1IX1uyMP@redhat.com> (raw)
In-Reply-To: <0f723410-d701-456f-b7e5-c51eec3a7573@nutanix.com>
On Fri, Jul 17, 2026 at 01:56:05PM +0100, Mark Cave-Ayland wrote:
> On 17/07/2026 13:26, Daniel P. Berrangé wrote:
>
> > On Fri, Jul 17, 2026 at 12:19:11PM +0100, Mark Cave-Ayland wrote:
> > > This is so that the object_class_* property functions appear in the generated
> > > QOM documentation at devel/qom-api.html.
> > >
> > > Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
> > > ---
> > > include/qom/object.h | 140 +++++++++++++++++++++++++++++++++++++++++++
> > > 1 file changed, 140 insertions(+)
> > >
> > > diff --git a/include/qom/object.h b/include/qom/object.h
> > > index 11f55613fc..95fdf01e30 100644
> > > --- a/include/qom/object.h
> > > +++ b/include/qom/object.h
> > > @@ -1818,6 +1818,37 @@ ObjectProperty *object_property_add_link(Object *obj, const char *name,
> > > Object *val, Error **errp),
> > > ObjectPropertyLinkFlags flags);
> > > +/**
> > > + * object_class_property_add_link:
> > > + * @oc: the object class to add a property to
> > > + * @name: the name of the property
> > > + * @type: the qobj type of the link
> > > + * @offset: the offset from the object instance where the link object reference
> > > + * is stored
> > > + * @check: callback to veto setting or NULL if the property is read-only
> > > + * @flags: additional options for the link
> > > + *
> > > + * Links establish relationships between objects. Links are unidirectional
> > > + * although two links can be combined to form a bidirectional relationship
> > > + * between objects.
> > > + *
> > > + * Links form the graph in the object model.
> > > + *
> > > + * The @check() callback is invoked when object_property_set_link() is called
> > > + * and can raise an error to prevent the link being set. If @check is NULL, the
> > > + * property is read-only and cannot be set. Care must be taken to handle NULL
> > > + * values for @val.
> > > + *
> > > + * Ownership of the pointer that @child points to is transferred to the
> > > + * link property. The reference count for *@child is
> > > + * managed by the property from after the function returns till the
> > > + * property is deleted with object_property_del(). If the
> > > + * @flags %OBJ_PROP_LINK_STRONG bit is set,
> > > + * the reference count is decremented when the property is deleted or
> > > + * modified.
> >
> > Copy+paste mistake I presume - object_class_property_add_link does not
> > have a @child property, as this is only declaring the property on the
> > class, not setting the link's value on the object.
>
> Interestingly enough I see that object_property_add_link() doesn't have a
> @child property either (it appears to have been changed to @targetp). I can
> easily fix that up in a separate patch.
>
> How would we describe the ownership in terms of a class property? I'm not
> sure the last paragraph makes any sense given that a class property always
> exists. From looking at the code I think the last paragraph should simply
> read something like:
>
> "If the @flags %OBJ_PROP_LINK_STRONG bit is set, the reference count of the
> linked object is incremented when the property is set, and decremented again
> when the property is modified."
Yeah that sounds reasonable..
With regards,
Daniel
--
|: https://berrange.com ~~ https://hachyderm.io/@berrange :|
|: https://libvirt.org ~~ https://entangle-photo.org :|
|: https://pixelfed.art/berrange ~~ https://fstop138.berrange.com :|
next prev parent reply other threads:[~2026-07-17 13:12 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-17 11:19 [PATCH 0/5] qom: tidy-ups and preparation for class property conversion Mark Cave-Ayland
2026-07-17 11:19 ` [PATCH 1/5] qom/object.c: introduce OBJECT_PROPERTY_SCALAR_GETTER(type) macro Mark Cave-Ayland
2026-07-17 12:22 ` Daniel P. Berrangé
2026-07-17 11:19 ` [PATCH 2/5] qom/object.c: introduce OBJECT_PROPERTY_SCALAR_SETTER(type) macro Mark Cave-Ayland
2026-07-17 12:23 ` Daniel P. Berrangé
2026-07-17 11:19 ` [PATCH 3/5] qom/object.c: introduce DEFINE_OBJECT_PROPERTY_SCALAR_METHODS() macro Mark Cave-Ayland
2026-07-17 12:23 ` Daniel P. Berrangé
2026-07-17 11:19 ` [PATCH 4/5] qom/object.h: add missing documentation for object_class_* property functions Mark Cave-Ayland
2026-07-17 12:26 ` Daniel P. Berrangé
2026-07-17 12:56 ` Mark Cave-Ayland
2026-07-17 13:11 ` Daniel P. Berrangé [this message]
2026-07-17 11:19 ` [PATCH 5/5] qom/object.c: rename object_class_property_uint*_ptr() to object_class_static_property_uint*_ptr() Mark Cave-Ayland
2026-07-17 12:32 ` Daniel P. Berrangé
2026-07-17 12:58 ` Mark Cave-Ayland
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=alop5gYJ1IX1uyMP@redhat.com \
--to=berrange@redhat.com \
--cc=alistair.francis@wdc.com \
--cc=chao.liu@processmission.com \
--cc=daniel.barboza@oss.qualcomm.com \
--cc=liwei1518@gmail.com \
--cc=mark.caveayland@nutanix.com \
--cc=palmer@dabbelt.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-riscv@nongnu.org \
--cc=zhiwei_liu@linux.alibaba.com \
/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.