[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH qom-next v2 2/5] qom/object: Add object_class_get_pa
From: |
peter . crosthwaite |
Subject: |
[Qemu-devel] [PATCH qom-next v2 2/5] qom/object: Add object_class_get_parent_by_name |
Date: |
Thu, 11 Jul 2013 11:46:36 +1000 |
From: Peter Crosthwaite <address@hidden>
Function for looking up a class by name then getting its parent.
Signed-off-by: Peter Crosthwaite <address@hidden>
---
include/qom/object.h | 9 +++++++++
qom/object.c | 5 +++++
2 files changed, 14 insertions(+)
diff --git a/include/qom/object.h b/include/qom/object.h
index 23fc048..f5ce2e8 100644
--- a/include/qom/object.h
+++ b/include/qom/object.h
@@ -706,6 +706,15 @@ ObjectClass *object_class_dynamic_cast(ObjectClass *klass,
ObjectClass *object_class_get_parent(ObjectClass *klass);
/**
+ * object_class_get_parent_by_name:
+ * Lookup a class by name and get its parent.
+ * @typename: The class to lookup and obtain the parent for.
+ *
+ * Returns: The parent for @typename's class or %NULL if none.
+ */
+ObjectClass *object_class_get_parent_by_name(const char *typename);
+
+/**
* object_class_get_name:
* @klass: The class to obtain the QOM typename for.
*
diff --git a/qom/object.c b/qom/object.c
index cbd7e86..4a3197d 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -608,6 +608,11 @@ ObjectClass *object_class_get_parent(ObjectClass *class)
return type->class;
}
+ObjectClass *object_class_get_parent_by_name(const char *typename)
+{
+ return object_class_get_parent(object_class_by_name(typename));
+}
+
typedef struct OCFData
{
void (*fn)(ObjectClass *klass, void *opaque);
--
1.8.3.rc1.44.gb387c77.dirty
[Qemu-devel] [PATCH qom-next v2 4/5] target-microblaze: Use parent class for reset + realize, peter . crosthwaite, 2013/07/10
[Qemu-devel] [PATCH qom-next v2 5/5] i8254: Use parent class for realize, peter . crosthwaite, 2013/07/10