Daniel P. Berrangé <[email protected]> writes:

> On Fri, Jun 05, 2026 at 11:44:47AM -0300, Fabiano Rosas wrote:
>> Daniel P. Berrangé <[email protected]> writes:
>> 
>> > On Thu, Jun 04, 2026 at 07:11:16PM -0400, Peter Xu wrote:
>> >> The helper allows one object to apply anything from -global command lines
>> >> to an object.
>> >> 
>> >> Signed-off-by: Peter Xu <[email protected]>
>> >> ---
>> >>  include/hw/core/qdev-properties.h | 1 +
>> >>  hw/core/qdev-properties.c         | 5 +++++
>> >>  2 files changed, 6 insertions(+)
>> >> 
>> >> diff --git a/include/hw/core/qdev-properties.h 
>> >> b/include/hw/core/qdev-properties.h
>> >> index eba5436e53..779acb31b6 100644
>> >> --- a/include/hw/core/qdev-properties.h
>> >> +++ b/include/hw/core/qdev-properties.h
>> >> @@ -268,6 +268,7 @@ const GlobalProperty *qdev_find_global_prop(Object 
>> >> *obj,
>> >>                                              const char *name);
>> >>  int qdev_prop_check_globals(void);
>> >>  void qdev_prop_set_globals(DeviceState *dev);
>> >> +void object_apply_globals(Object *obj);
>> >>  void error_set_from_qdev_prop_error(Error **errp, int ret, Object *obj,
>> >>                                      const char *name, const char *value);
>> >>  
>> >> diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c
>> >> index 8f870c85fc..a91c2ad101 100644
>> >> --- a/hw/core/qdev-properties.c
>> >> +++ b/hw/core/qdev-properties.c
>> >> @@ -1045,6 +1045,11 @@ void qdev_prop_set_globals(DeviceState *dev)
>> >>                                dev->hotplugged ? NULL : &error_fatal);
>> >>  }
>> >>  
>> >> +void object_apply_globals(Object *obj)
>> >> +{
>> >> +    object_apply_global_props(obj, global_props(), &error_fatal);
>> >> +}
>> >
>> > If a method has the "object_" prefix and takex "Object *" as its
>> > instance, then it needs to live in qom/object.c / include/qom/object.h
>> > but this again has the complexity of relying on the qdev Property
>> > struct.  This is really mixing qdev & qom layers together which I
>> > find pretty unpleasant.
>> >
>> 
>> True, but code like qdev_property_add_static() already mixes things up
>> quite a bit. Not that this is justification to mix it even more, of
>> course.
>
> That's not the same scenario as it is exclusively qdev code, using
> qdev_ name prefix and taking "Device *" not "Object *".
>

Reading your message again, I misinterpreted you as arguing against the
overall coupling of ObjectProperty and Property. I agree with the
specific point of the abstraction layers.

> With regards,
> Daniel

Reply via email to