mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 08:13:54 -06:00
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>
This commit is contained in:
parent
edc92115a9
commit
2f262e06f0
2 changed files with 11 additions and 6 deletions
11
qom/object.c
11
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,
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue