summaryrefslogtreecommitdiffstats
path: root/include/qemu/object.h
Commit message (Collapse)AuthorAgeFilesLines
* qom: move include files to include/qom/Paolo Bonzini2012-12-191-1003/+0
| | | | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* qom: make object_finalize staticPaolo Bonzini2012-11-261-9/+0
| | | | | | | It is not used anymore, and there is no need to make it public. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* qom: make object_delete usable for statically-allocated objectsPaolo Bonzini2012-11-261-0/+9
| | | | | | | | | | | | Store in the object the freeing function that will be used at deletion time. This makes it possible to use object_delete on statically-allocated (embedded) objects. Dually, it makes it possible to use object_unparent and object_unref without leaking memory, when the lifetime of object might extend until after the call to object_delete. Reviewed-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* qdev: move bus removal to object_unparentPaolo Bonzini2012-11-261-0/+11
| | | | | | | | | | | | | Add an ObjectClass method that is done at object_unparent time. It should remove any backlinks to the object in the composition tree, so that object_delete will be able to drop the last reference and free the object. Use it for qdev buses. Reviewed-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* object: add object_property_add_bool (v2)Anthony Liguori2012-11-161-0/+16
| | | | | | | Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> --- v1 -> v2 - Fix whitespace (Andreas Faerber)
* qom: Reimplement InterfacesAnthony Liguori2012-08-131-16/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | The current implementation of Interfaces is poorly designed. Each interface that an object implements ends up being an object that's tracked by the implementing object. There's all sorts of gymnastics to deal with casting between these objects. But an interface shouldn't be associated with an Object. Interfaces are global to a class. This patch moves all Interface knowledge to ObjectClass eliminating the relationship between Object and Interfaces. Interfaces are now abstract (as they should be) but this is okay. Interfaces essentially act as additional parents for the classes and are treated as such. With this new implementation, we should fully support derived interfaces including reimplementing an inherited interface. PC: Rebased against qom-next merge Jun-2012. PC: Removed replication of cast logic for interfaces, i.e. there is only one cast function - object_dynamic_cast() (and object_dynamic_cast_assert()) Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Peter A. G. Crosthwaite <peter.crosthwaite@petalogix.com> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
* qom: Push error reporting to object_property_find()Paolo Bonzini2012-06-181-1/+3
| | | | | | | | Avoids duplicated error_set(). Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> [AF: Also drop error_set() in object_property_del().] Signed-off-by: Andreas Färber <afaerber@suse.de>
* qdev: Remove qdev_prop_exists()Paolo Bonzini2012-06-181-0/+9
| | | | | | | Can be replaced everywhere with object_property_find(). Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
* qom: Drop type_register_static_alias() macroPaolo Bonzini2012-06-181-2/+0
| | | | | | | It's unused. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
* qom: Make Object a typePaolo Bonzini2012-06-181-1/+1
| | | | | | | | | | Right now the base Object class has a special NULL type. Change this so that 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 really necessary. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
* qom: Add class_base_initPaolo Bonzini2012-06-181-2/+8
| | | | | | | | | | The class_base_init TypeInfo callback was present in one of the early QOM versions but removed (on my request...) before committing. We will need it soon, add it. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
* qom: Add object_child_foreach()Paolo Bonzini2012-06-181-0/+14
| | | | | | | | | | 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] [AF: Use new object_property_is_child() helper.] Signed-off-by: Andreas Färber <afaerber@suse.de>
* qom: Add object_class_get_parent()Paolo Bonzini2012-06-181-0/+8
| | | | | | | | | | 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] Signed-off-by: Andreas Färber <afaerber@suse.de>
* qom: Documentation addition for object_class_by_name()Paolo Bonzini2012-05-121-0/+6
| | | | | | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> [AF: Document the possible NULL return value] Signed-off-by: Andreas Färber <afaerber@suse.de>
* qom: Refine container_get() to allow using a custom rootAndreas Färber2012-04-241-1/+2
| | | | | | | | | | Specify the root to search from as argument. This avoids hardcoding "/machine" in some places and makes it more flexible. Signed-off-by: Andreas Färber <afaerber@suse.de> Cc: Paolo Bonzini <pbonzini@redhat.com> Cc: Anthony Liguori <anthony@codemonkey.ws> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* qom: add container_getPaolo Bonzini2012-04-021-0/+24
| | | | | | | | | This is QOM "mkdir -p". It is useful when referring to container 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: Introduce object_class_get_list()Andreas Färber2012-03-141-0/+11
| | | | | | | | | This function allows to obtain a singly-linked list of classes, which can 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>
* Spelling fixes in comments (it's -> its)Stefan Weil2012-03-081-2/+2
| | | | | | | | | | * it's -> its (fixed for all files) * dont -> don't (only fixed in a line which was touched by the previous fix) * distrub -> disturb (fixed in the same line) Reviewed-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
* qom: Fix spelling in documentationStefan Weil2012-03-071-1/+1
| | | | | | | This fixes a new spelling issue which was detected by codespell. Signed-off-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
* qom: Document ways to retrieve child object added by object_property_add_child()Alexander Barabash2012-02-221-0/+4
| | | | | | | | | object_property_add_child() creates a property whose values as a string is the child object's canonical path. Acked-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Alexander Barabash <alexander_barabash@mentor.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* qom: add generic string parsing/printingPaolo Bonzini2012-02-221-0/+24
| | | | | | | | Add generic property accessors that take a string and parse it appropriately for the property type. All the magic here is done by the new string-based visitors. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* qom: Fix identifiers in documentationAndreas Färber2012-02-171-2/+2
| | | | | | | Fixes gtk-doc warnings. Signed-off-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* qom: Fix typo in Object's documentationAndreas Färber2012-02-171-1/+1
| | | | | | | Fixes a warning from gtk-doc. Signed-off-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* qom: Unify type registrationAndreas Färber2012-02-151-2/+2
| | | | | | | | | | | | | 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 where necessary and don't put a semicolon after the closing brace. Signed-off-by: Andreas Färber <afaerber@suse.de> Cc: Anthony Liguori <anthony@codemonkey.ws> Cc: malc <av1474@comtv.ru> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* qom: add property get/set wrappers for linksPaolo Bonzini2012-02-071-0/+24
| | | | | | | | These can set a link to any object, as long as it is included in the composition tree. Reviewed-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* qom: add object_resolve_path_typePaolo Bonzini2012-02-071-2/+23
| | | | | Reviewed-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* qom: add property get/set wrappers for C typesPaolo Bonzini2012-02-071-0/+70
| | | | | | | 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: more documentation on subclassingPaolo Bonzini2012-02-071-3/+73
| | | | | Reviewed-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* qom: clean up cast macrosPaolo Bonzini2012-02-071-7/+15
| | | | | Reviewed-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* qom: move properties from qdev to objectAnthony Liguori2012-02-031-1/+224
| | | | | | | | This is mostly code movement although not entirely. This makes properties part of the Object base class which means that we can now start using Object in a meaningful way outside of qdev. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* qdev: register all types natively through QEMU Object ModelAnthony Liguori2012-02-031-0/+2
| | | | | | | | | | | | | | | | | | | | | This was done in a mostly automated fashion. I did it in three steps and then rebased it into a single step which avoids repeatedly touching every file in the tree. The first step was a sed-based addition of the parent type to the subclass registration functions. The second step was another sed-based removal of subclass registration functions while also adding virtual functions from the base class into a class_init function as appropriate. Finally, a python script was used to convert the DeviceInfo structures and qdev_register_subclass functions to TypeInfo structures, class_init functions, and type_register_static calls. We are almost fully converted to QOM after this commit. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* qom: allow object_class_foreach to take additional parameters to refine searchAnthony Liguori2012-02-031-0/+1
| | | | Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* qom: add the base Object class (v2)Anthony Liguori2012-01-271-0/+436
This class provides the main building block for QEMU Object Model and is extensively documented in the header file. It is largely inspired by GObject. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> --- v1 -> v2 - remove printf() in type registration - fix typo in comment (Paolo) - make Interface private - move object into a new directory and move header into include/qemu/ - don't make object.h depend on qemu-common.h - remove Type and replace it with TypeImpl * (Paolo) - use hash table to store types (Paolo) - aggressively cache parent type (Paolo) - make a type_register and use it with interfaces (Paolo) - fix interface cast comment (Paolo) - add a few more functions required in later series
OpenPOWER on IntegriCloud