[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 03/12] qom: Make object_class_property_add_uint*_ptr() get of
From: |
Eduardo Habkost |
Subject: |
Re: [PATCH 03/12] qom: Make object_class_property_add_uint*_ptr() get offset |
Date: |
Fri, 9 Oct 2020 13:31:36 -0400 |
On Fri, Oct 09, 2020 at 12:24:19PM -0500, Eric Blake wrote:
> On 10/9/20 11:01 AM, Eduardo Habkost wrote:
> > The existing object_class_property_add_uint*_ptr() functions are
> > not very useful, because they need a pointer to the property
> > value, which can't really be provided before the object is
> > created.
> >
> > Replace the pointer parameter in those functions with a
> > `ptrdiff_t offset` parameter.
> >
> > Include a uint8 class property in check-qom-proplist unit tests,
> > to ensure the feature is working.
> >
> > Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> > ---
>
> > static void *pointer_property_get_ptr(Object *obj, PointerProperty *prop)
> > {
> > - return prop->ptr;
> > + if (prop->is_offset) {
> > + return (void *)obj + prop->offset;
>
> Addition on void* is a gcc extension. Does clang support it as well, or
> should you be casting to char* instead?
Both object_link_get_targetp() and object_link_get_targetp()
already use it, so it should be OK.
--
Eduardo
- [PATCH 00/12] qom: Make all -object types use only class properties, Eduardo Habkost, 2020/10/09
- [PATCH 01/12] qom: Helpers for pointer properties, Eduardo Habkost, 2020/10/09
- [PATCH 02/12] qom: Introduce PointerProperty struct, Eduardo Habkost, 2020/10/09
- [PATCH 04/12] sev: Use class properties, Eduardo Habkost, 2020/10/09
- [PATCH 03/12] qom: Make object_class_property_add_uint*_ptr() get offset, Eduardo Habkost, 2020/10/09
- Re: [PATCH 03/12] qom: Make object_class_property_add_uint*_ptr() get offset, Eric Blake, 2020/10/09
- Re: [PATCH 03/12] qom: Make object_class_property_add_uint*_ptr() get offset,
Eduardo Habkost <=
- Re: [PATCH 03/12] qom: Make object_class_property_add_uint*_ptr() get offset, Igor Mammedov, 2020/10/21
- Re: [PATCH 03/12] qom: Make object_class_property_add_uint*_ptr() get offset, Igor Mammedov, 2020/10/23
- Re: [PATCH 03/12] qom: Make object_class_property_add_uint*_ptr() get offset, Eduardo Habkost, 2020/10/27
- Re: [PATCH 03/12] qom: Make object_class_property_add_uint*_ptr() get offset, Paolo Bonzini, 2020/10/28
- Re: [PATCH 03/12] qom: Make object_class_property_add_uint*_ptr() get offset, Igor Mammedov, 2020/10/28
- Re: [PATCH 03/12] qom: Make object_class_property_add_uint*_ptr() get offset, Eduardo Habkost, 2020/10/29
- Re: [PATCH 03/12] qom: Make object_class_property_add_uint*_ptr() get offset, Igor Mammedov, 2020/10/29