History | View | Annotate | Download (29.7 kB)
qom: Add class_base_init
The class_base_init TypeInfo callback was present in one of the earlyQOM versions but removed (on my request...) before committing. Wewill need it soon, add it.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>...
qom: Make Object a type
Right now the base Object class has a special NULL type. Change this sothat we will be able to add class_init and class_base_init callbacks.To do this, remove some special casing of ObjectClass that is not reallynecessary.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>...
qom: Assert that public types have a non-NULL parent field
This protects against unwanted effects of changing TYPE_OBJECT fromNULL to a string.
Suggested-by: Andreas Färber <afaerber@suse.de>Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Andreas Färber <afaerber@suse.de>
qdev: Push "type" property up to Object
Now that Object is a type, add an instance_init function and pushthe "type" property from qdev to there.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Andreas Färber <afaerber@suse.de>
qom: Add object_class_get_parent()
This simple bit of functionality was missing and we'll need it soon,so add it.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>[AF: Document possible NULL return value]...
qom: Introduce object_property_is_{child,link}()
Avoids hardcoding partial string comparisons.
Signed-off-by: Alexander Barabash <alexander_barabash@mentor.com>Signed-off-by: Andreas Färber <afaerber@suse.de>Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
qom: Add object_child_foreach()
A utility function that will be used to implement hierarchical realization.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>[AF: Drop unrelated whitespace change, add Returns: in documentation]...
qdev: Use object_property_print() in info qtree
Otherwise, non-string properties without a legacy counterpart are missed.Also fix error propagation in object_property_print() itself.
qom: add container_get
This is QOM "mkdir -p". It is useful when referring tocontainer objects such as "/machine".
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
qom/object.c: rename type_class_init() to type_initialize()
Function name type_class_init() gave us a wrong impression of separationof type's "class" and "object" entities initialization. Name type_initialize()is more appropriate for type_class_init() function (considering what operations...
qom: Introduce object_class_get_list()
This function allows to obtain a singly-linked list of classes, whichcan be sorted by the caller.
Signed-off-by: Andreas Färber <afaerber@suse.de>Cc: Anthony Liguori <anthony@codemonkey.ws>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
qom: if @instance_size==0, assign size of object to parent object size
QOM documentation states that for objects of type with @instance_size == 0 sizewill be assigned to match parent object's size. But currently this feauture isnot implemented and qemu asserts during creation of object with zero instance_size....
qom: fix device hot-unplug
Property removal modifies the list, so it is not safe to continueiteration. We know anyway that each object can have only oneparent (see object_property_add_child), so exit after findingthe requested object.
Reported-by: Michael S. Tsirkin <mst@redhat.com>...
qom: In function object_set_link_property(), first call object_ref(), then object_unref().
In the old implementation, if the new value of the property linksto the same object, as the old value, that object is first unref-ed,and then ref-ed. This leads to unintended deinitialization of that object....
qom: Fix object_initialize_with_type() assertion
Assert the object is at least sizeof(Object), not sizeof(ObjectClass).
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Andreas Färber <afaerber@suse.de>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
qom: add generic string parsing/printing
Add generic property accessors that take a string and parse itappropriately for the property type. All the magic here is doneby the new string-based visitors.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
qom: Unify type registration
Replace device_init() with generalized type_init().
While at it, unify naming convention: type_init([$prefix_]register_types)Also, type_init() is a function, so add preceding blank line wherenecessary and don't put a semicolon after the closing brace....
qom: fix off-by-one
qom: add object_resolve_path_type
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
qom: use object_resolve_path_type for links
This allows to restrict partial matches to objects of the expectedtype. It will let people use bare names to reference driveseven though their name might be the same as a device's (e.g.-drive id=hd0,if=none,... -device ...,drive=hd0,id=hd0)....
qom: fix canonical paths vs. interfaces
qom: add property get/set wrappers for links
These can set a link to any object, as long as it is included inthe composition tree.
qom: do not include qdev header file
qom: add property get/set wrappers for C types
Add wrappers that let you get/set properties using normal C data types.
Reviewed-by: Anthony Liguori <anthony@aliguori@us.ibm.com>Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
qom: avoid useless conversions from string to type
qom: clean up/optimize object_dynamic_cast
The interface loop can be performed only on the parent object. Itdoes not need to be done on each interface. Similarly, we cansimplify the code by switching early from the implementationobject to the parent object....
qom: move properties from qdev to object
This is mostly code movement although not entirely. This makes properties partof the Object base class which means that we can now start using Object in ameaningful way outside of qdev.
Signed-off-by: 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 bespecified. Now we can support abstract types and interfaces which means it'snow possible to have a link<PCIDevice>....
object: sure up reference counting
Now we have the following behavior:
1) object_new() returns an object with ref = 12) 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...
container: make a decendent of Object
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>---v1 -> v2 - Add license (Paolo)
qom: allow object_class_foreach to take additional parameters to refine search
qdev: change ambiguous qdev names
Reported-by: Blue Swirl <blauwirbel@gmail.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
qom: add the base Object class (v2)
This class provides the main building block for QEMU Object Model and isextensively documented in the header file. It is largely inspired by GObject.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>---v1 -> v2...