Re: [PATCH v2 10/13] qdev: make properties array "const"

2024-10-23 Thread Paolo Bonzini
Il mar 22 ott 2024, 23:43 Philippe Mathieu-Daudé ha scritto: > On 22/10/24 02:23, Paolo Bonzini wrote: > > At least keeping the const > > within qdev properties makes things "safer" within that realm. > > Since it is only within qdev-properties.c, it is indeed reasonable to > accept. Maybe make i

Re: [PATCH v2 10/13] qdev: make properties array "const"

2024-10-22 Thread Philippe Mathieu-Daudé
On 22/10/24 02:23, Paolo Bonzini wrote: On Tue, Oct 22, 2024 at 6:31 AM Philippe Mathieu-Daudé wrote: -void qdev_property_add_static(DeviceState *dev, Property *prop) +void qdev_property_add_static(DeviceState *dev, const Property *prop) { Object *obj = OBJECT(dev); ObjectPrope

Re: [PATCH v2 10/13] qdev: make properties array "const"

2024-10-21 Thread Paolo Bonzini
On Tue, Oct 22, 2024 at 6:31 AM Philippe Mathieu-Daudé wrote: > > -void qdev_property_add_static(DeviceState *dev, Property *prop) > > +void qdev_property_add_static(DeviceState *dev, const Property *prop) > > { > > Object *obj = OBJECT(dev); > > ObjectProperty *op; > > @@ -980,7 +98

Re: [PATCH v2 10/13] qdev: make properties array "const"

2024-10-21 Thread Philippe Mathieu-Daudé
Hi, On 21/10/24 13:35, Paolo Bonzini wrote: Constify all accesses to qdev properties, except for the ObjectPropertyAccessor itself. This makes it possible to place them in read-only memory, and also lets Rust bindings switch from "static mut" arrays to "static"; which is advantageous, because m

[PATCH v2 10/13] qdev: make properties array "const"

2024-10-21 Thread Paolo Bonzini
Constify all accesses to qdev properties, except for the ObjectPropertyAccessor itself. This makes it possible to place them in read-only memory, and also lets Rust bindings switch from "static mut" arrays to "static"; which is advantageous, because mutable statics are highly discouraged. Signed-