Il 02/07/2014 10:24, Alexander Graf ha scritto:
So this suggests your reasoning for side effected _ptr write is just
for validity checking. So another approach could be to add a "check"
function to the _ptr variants (rather than an open coded) setter. This
has the advantage of being consistent with what we already do for
object_property_add_link.
Heh, yes. Unfortunately "realized" is a field in DeviceStruct which we
don't have access to from object.c.
In fact, this is exactly what I wanted to do before this approach. I
introduced an enum that was either
* read-only
* read-write
* read-write-before-realize
and wanted to do all the checking in object.c.
But then I realized that object.c really shouldn't be aware of
DeviceState and threw away the idea.
I think your solution is pretty. However, it's probably time to split
qom/object.c and/or include/qom/object.h.
Paolo