diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2012-04-02 17:33:51 +0200 |
---|---|---|
committer | Andreas Färber <afaerber@suse.de> | 2012-06-18 15:14:37 +0200 |
commit | 2f262e06f01a38cb8a218b7c5ad71233883a6b55 (patch) | |
tree | 1d5f8a316a34d3e69174bc092f4e8accfa966cea /qom | |
parent | edc92115a9300cca65946d5b2d56bec637a38f26 (diff) | |
download | qemu-2f262e06f01a38cb8a218b7c5ad71233883a6b55.tar.gz qemu-2f262e06f01a38cb8a218b7c5ad71233883a6b55.tar.bz2 qemu-2f262e06f01a38cb8a218b7c5ad71233883a6b55.zip |
qdev: Push "type" property up to Object
Now that Object is a type, add an instance_init function and push
the "type" property from qdev to there.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Diffstat (limited to 'qom')
-rw-r--r-- | qom/object.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/qom/object.c b/qom/object.c index cec2d406b8..d5c6ff7471 100644 --- a/qom/object.c +++ b/qom/object.c @@ -1231,6 +1231,16 @@ void object_property_add_str(Object *obj, const char *name, prop, errp); } +static char *qdev_get_type(Object *obj, Error **errp) +{ + return g_strdup(object_get_typename(obj)); +} + +static void object_instance_init(Object *obj) +{ + object_property_add_str(obj, "type", qdev_get_type, NULL, NULL); +} + static void register_types(void) { static TypeInfo interface_info = { @@ -1242,6 +1252,7 @@ static void register_types(void) static TypeInfo object_info = { .name = TYPE_OBJECT, .instance_size = sizeof(Object), + .instance_init = object_instance_init, .abstract = true, }; |