aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2014-02-08 11:01:47 +0100
committerAndreas Färber <afaerber@suse.de>2014-02-14 21:12:02 +0100
commit03ff777048eda53eaf5bd95705418ae7e825ce56 (patch)
tree0fc4e9ab66c84848812161191734c8b1a0072edb /hw
parent9e4d9620c42649de7b6a0c5f5e1ed8fa0299b5c3 (diff)
qdev: Legacy properties are now read-only
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>
Diffstat (limited to 'hw')
-rw-r--r--hw/core/qdev-properties.c10
-rw-r--r--hw/core/qdev.c30
2 files changed, 3 insertions, 37 deletions
diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c
index e223ce1887..a60a1837c7 100644
--- a/hw/core/qdev-properties.c
+++ b/hw/core/qdev-properties.c
@@ -936,15 +936,7 @@ void error_set_from_qdev_prop_error(Error **errp, int ret, DeviceState *dev,
void qdev_prop_parse(DeviceState *dev, const char *name, const char *value,
Error **errp)
{
- char *legacy_name;
-
- legacy_name = g_strdup_printf("legacy-%s", name);
- if (object_property_get_type(OBJECT(dev), legacy_name, NULL)) {
- object_property_parse(OBJECT(dev), value, legacy_name, errp);
- } else {
- object_property_parse(OBJECT(dev), value, name, errp);
- }
- g_free(legacy_name);
+ object_property_parse(OBJECT(dev), value, name, errp);
}
void qdev_prop_set_bit(DeviceState *dev, const char *name, bool value)
diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index 82a9123038..7c1b7325ca 100644
--- a/hw/core/qdev.c
+++ b/hw/core/qdev.c
@@ -578,31 +578,6 @@ static void qdev_get_legacy_property(Object *obj, Visitor *v, void *opaque,
visit_type_str(v, &ptr, name, errp);
}
-static void qdev_set_legacy_property(Object *obj, Visitor *v, void *opaque,
- const char *name, Error **errp)
-{
- DeviceState *dev = DEVICE(obj);
- Property *prop = opaque;
- Error *local_err = NULL;
- char *ptr = NULL;
- int ret;
-
- if (dev->realized) {
- qdev_prop_set_after_realize(dev, name, errp);
- return;
- }
-
- visit_type_str(v, &ptr, name, &local_err);
- if (local_err) {
- error_propagate(errp, local_err);
- return;
- }
-
- ret = prop->info->parse(dev, prop, ptr);
- error_set_from_qdev_prop_error(errp, ret, dev, prop, ptr);
- g_free(ptr);
-}
-
/**
* @qdev_add_legacy_property - adds a legacy property
*
@@ -618,8 +593,7 @@ void qdev_property_add_legacy(DeviceState *dev, Property *prop,
gchar *name, *type;
/* Register pointer properties as legacy properties */
- if (!prop->info->print && !prop->info->parse &&
- (prop->info->set || prop->info->get)) {
+ if (!prop->info->print && prop->info->get) {
return;
}
@@ -629,7 +603,7 @@ void qdev_property_add_legacy(DeviceState *dev, Property *prop,
object_property_add(OBJECT(dev), name, type,
prop->info->print ? qdev_get_legacy_property : prop->info->get,
- prop->info->parse ? qdev_set_legacy_property : prop->info->set,
+ NULL,
NULL,
prop, errp);