提交 2f262e06 编写于 作者: P Paolo Bonzini 提交者: Andreas Färber

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: NPaolo Bonzini <pbonzini@redhat.com>
Signed-off-by: NAndreas Färber <afaerber@suse.de>
上级 edc92115
......@@ -515,11 +515,6 @@ char* qdev_get_fw_dev_path(DeviceState *dev)
return strdup(path);
}
static char *qdev_get_type(Object *obj, Error **errp)
{
return g_strdup(object_get_typename(obj));
}
/**
* Legacy property handling
*/
......@@ -638,7 +633,6 @@ static void device_initfn(Object *obj)
qdev_property_add_static(dev, prop, NULL);
}
object_property_add_str(OBJECT(dev), "type", qdev_get_type, NULL, NULL);
qdev_prop_set_defaults(dev, qdev_get_props(dev));
}
......
......@@ -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,
};
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册