acc4af3f | 03-Feb-2012 |
Paolo Bonzini <pbonzini@redhat.com> |
qom: clean up/optimize object_dynamic_cast
The interface loop can be performed only on the parent object. It does not need to be done on each interface. Similarly, we can simplify the code by swit
qom: clean up/optimize object_dynamic_cast
The interface loop can be performed only on the parent object. It does not need to be done on each interface. Similarly, we can simplify the code by switching early from the implementation object to the parent object.
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
db85b575 | 23-Dec-2011 |
Anthony Liguori <aliguori@us.ibm.com> |
object: sure up reference counting
Now we have the following behavior:
1) object_new() returns an object with ref = 1 2) object_initialize() does not increase the reference count (ref may be 0). 3)
object: sure up reference counting
Now we have the following behavior:
1) object_new() returns an object with ref = 1 2) object_initialize() does not increase the reference count (ref may be 0). 3) object_deref() will finalize the object when ref = 0. it does not free the memory associated with the object. 4) both link and child properties correctly set the reference count.
The expected usage is the following:
1) child devices should generally be created via object_initialize() using memory from the parent device. Adding the object as a child property will take ownership of the object and tie the child's life cycle to the parent.
2) If a child device is created via qdev_create() or some other form of object_new(), there must be an object_delete() call in the parent device's finalize function.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
show more ...
|
fe40e627 | 23-Dec-2011 |
Anthony Liguori <aliguori@us.ibm.com> |
qom: accept any compatible type when setting a link property
Links had limited utility before as they only allowed a concrete type to be specified. Now we can support abstract types and interfaces
qom: accept any compatible type when setting a link property
Links had limited utility before as they only allowed a concrete type to be specified. Now we can support abstract types and interfaces which means it's now possible to have a link<PCIDevice>.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
show more ...
|