aboutsummaryrefslogtreecommitdiff
path: root/qom
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2012-05-02 13:30:54 +0200
committerAndreas Färber <afaerber@suse.de>2012-06-18 15:14:36 +0200
commite7cce67f27bce49d8b6d09f4e66059d1fd117ebb (patch)
tree3f2326a6d93512115b94138424a162d29130ecd4 /qom
parenteb2aeacf983a2a88a2b31e8fee067c38bd10abd3 (diff)
downloadqemu-e7cce67f27bce49d8b6d09f4e66059d1fd117ebb.zip
qemu-e7cce67f27bce49d8b6d09f4e66059d1fd117ebb.tar.gz
qemu-e7cce67f27bce49d8b6d09f4e66059d1fd117ebb.tar.bz2
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] Signed-off-by: Andreas Färber <afaerber@suse.de>
Diffstat (limited to 'qom')
-rw-r--r--qom/object.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/qom/object.c b/qom/object.c
index 6f839ad..9582230 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -545,6 +545,19 @@ ObjectClass *object_class_by_name(const char *typename)
return type->class;
}
+ObjectClass *object_class_get_parent(ObjectClass *class)
+{
+ TypeImpl *type = type_get_parent(class->type);
+
+ if (!type) {
+ return NULL;
+ }
+
+ type_initialize(type);
+
+ return type->class;
+}
+
typedef struct OCFData
{
void (*fn)(ObjectClass *klass, void *opaque);