qdev: Legacy properties are just strings
prop->info->legacy_name is still used by "-device foo,?". Reviewed-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
This commit is contained in:
parent
03ff777048
commit
7ce7ffe027
@ -590,7 +590,7 @@ static void qdev_get_legacy_property(Object *obj, Visitor *v, void *opaque,
|
|||||||
void qdev_property_add_legacy(DeviceState *dev, Property *prop,
|
void qdev_property_add_legacy(DeviceState *dev, Property *prop,
|
||||||
Error **errp)
|
Error **errp)
|
||||||
{
|
{
|
||||||
gchar *name, *type;
|
gchar *name;
|
||||||
|
|
||||||
/* Register pointer properties as legacy properties */
|
/* Register pointer properties as legacy properties */
|
||||||
if (!prop->info->print && prop->info->get) {
|
if (!prop->info->print && prop->info->get) {
|
||||||
@ -598,16 +598,12 @@ void qdev_property_add_legacy(DeviceState *dev, Property *prop,
|
|||||||
}
|
}
|
||||||
|
|
||||||
name = g_strdup_printf("legacy-%s", prop->name);
|
name = g_strdup_printf("legacy-%s", prop->name);
|
||||||
type = g_strdup_printf("legacy<%s>",
|
object_property_add(OBJECT(dev), name, "str",
|
||||||
prop->info->legacy_name ?: prop->info->name);
|
|
||||||
|
|
||||||
object_property_add(OBJECT(dev), name, type,
|
|
||||||
prop->info->print ? qdev_get_legacy_property : prop->info->get,
|
prop->info->print ? qdev_get_legacy_property : prop->info->get,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
prop, errp);
|
prop, errp);
|
||||||
|
|
||||||
g_free(type);
|
|
||||||
g_free(name);
|
g_free(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user