All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Peter Xu <peterx@redhat.com>
Cc: qemu-devel@nongnu.org,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>,
	"Fabiano Rosas" <farosas@suse.de>,
	"Juraj Marcin" <jmarcin@redhat.com>,
	"Vladimir Sementsov-Ogievskiy" <vsementsov@yandex-team.ru>,
	"Sana Sharma" <sansshar@redhat.com>,
	"Eric Blake" <eblake@redhat.com>,
	"Markus Armbruster" <armbru@redhat.com>,
	"Kevin Wolf" <kwolf@redhat.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Philippe Mathieu-Daudé" <philmd@mailo.com>,
	"Mark Cave-Ayland" <mark.caveayland@nutanix.com>,
	"Akihiko Odaki" <odaki@rsg.ci.i.u-tokyo.ac.jp>,
	"Cédric Le Goater" <clg@redhat.com>,
	"Dr . David Alan Gilbert" <dave@treblig.org>
Subject: Re: [PATCH 3/4] qdev: Refactor and rename of qdev_class_add_property()
Date: Fri, 5 Jun 2026 09:43:28 +0100	[thread overview]
Message-ID: <aiKMMMNrL97b3YzN@redhat.com> (raw)
In-Reply-To: <20260604231118.1584889-4-peterx@redhat.com>

On Thu, Jun 04, 2026 at 07:11:17PM -0400, Peter Xu wrote:
> Firstly, qdev_class_add_property() function almost has nothing to do with
> DeviceClass, it's a bridge between Property and object properties.
> 
> Change the 1st parameter of it, so that it can be used without DeviceClass
> context at all. When at it, remove the "name" field because it's always
> prop->name.
> 
> Export it for non-qdev use cases.
> 
> Signed-off-by: Peter Xu <peterx@redhat.com>
> ---
>  include/hw/core/qdev-properties.h | 10 ++++++++++
>  hw/core/qdev-properties.c         |  7 +++----
>  2 files changed, 13 insertions(+), 4 deletions(-)
> 
> diff --git a/include/hw/core/qdev-properties.h b/include/hw/core/qdev-properties.h
> index 779acb31b6..fec2aaac4d 100644
> --- a/include/hw/core/qdev-properties.h
> +++ b/include/hw/core/qdev-properties.h
> @@ -283,6 +283,16 @@ void error_set_from_qdev_prop_error(Error **errp, int ret, Object *obj,
>   */
>  void qdev_property_add_static(DeviceState *dev, const Property *prop);
>  
> +/**
> + * object_class_add_property:
> + * @oc: Object class to operate on.
> + * @prop: The qdev property definition.
> + *
> + * Add a Property to @oc.  This is the bridge to convert a Property into
> + * an object class property (as in ObjectClass.properties).
> + */
> +void object_class_add_property(ObjectClass *oc, const Property *prop);

I'm really not a fan of this.

Having both object_class_add_property and object_class_property_add
methods is horrendous naming.

Methods named with an "object_class_" prefix must live in qom/object.c &
include/qom/object.h not in qdev. If doing that though, then the entire
"Property" concept would need to live in QOM code too, but I don't think
that is either desirable or neccessary.

AFAICT, the MigrationState class init method could just call the
existing object_class_property_add methods as any other non-qdev
Object impl does.


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 :|



  reply	other threads:[~2026-06-05  8:44 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-04 23:11 [PATCH 0/4] migration/qdev: Remove TYPE_DEVICE dependency on migration object Peter Xu
2026-06-04 23:11 ` [PATCH 1/4] qdev: Pave way for exporting Property to be used in non-qdev Peter Xu
2026-06-05 10:53   ` Mark Cave-Ayland
2026-06-05 15:18     ` Fabiano Rosas
2026-06-05 14:39   ` Fabiano Rosas
2026-06-05 15:40     ` Peter Xu
2026-06-04 23:11 ` [PATCH 2/4] qdev: Introduce helper object_apply_globals() Peter Xu
2026-06-05  8:52   ` Daniel P. Berrangé
2026-06-05 14:44     ` Fabiano Rosas
2026-06-05 14:47       ` Daniel P. Berrangé
2026-06-05 15:06         ` Fabiano Rosas
2026-06-04 23:11 ` [PATCH 3/4] qdev: Refactor and rename of qdev_class_add_property() Peter Xu
2026-06-05  8:43   ` Daniel P. Berrangé [this message]
2026-06-05 15:21     ` Peter Xu
2026-06-04 23:11 ` [PATCH 4/4] migration: Remove dependency to TYPE_DEVICE Peter Xu
2026-06-05  8:30   ` Marc-André Lureau
2026-06-05  8:49     ` Daniel P. Berrangé
2026-06-05 15:36       ` Peter Xu

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=aiKMMMNrL97b3YzN@redhat.com \
    --to=berrange@redhat.com \
    --cc=armbru@redhat.com \
    --cc=clg@redhat.com \
    --cc=dave@treblig.org \
    --cc=eblake@redhat.com \
    --cc=farosas@suse.de \
    --cc=jmarcin@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=mark.caveayland@nutanix.com \
    --cc=odaki@rsg.ci.i.u-tokyo.ac.jp \
    --cc=pbonzini@redhat.com \
    --cc=peterx@redhat.com \
    --cc=philmd@mailo.com \
    --cc=qemu-devel@nongnu.org \
    --cc=sansshar@redhat.com \
    --cc=vsementsov@yandex-team.ru \
    /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.