aboutsummaryrefslogtreecommitdiff
path: root/qom
diff options
context:
space:
mode:
authorIgor Mammedov <imammedo@redhat.com>2017-07-14 10:14:50 +0800
committerPaolo Bonzini <pbonzini@redhat.com>2017-07-14 12:04:42 +0200
commit8f5d58ef2c92d7b82d9a6eeefd7c8854a183ba4a (patch)
treee2829b8ca3d04cdee2f37cc1a01419786ac494c9 /qom
parentd40d3da00c10f0169a26985ecb65033bff536f2c (diff)
downloadqemu-8f5d58ef2c92d7b82d9a6eeefd7c8854a183ba4a.zip
qemu-8f5d58ef2c92d7b82d9a6eeefd7c8854a183ba4a.tar.gz
qemu-8f5d58ef2c92d7b82d9a6eeefd7c8854a183ba4a.tar.bz2
qom: enforce readonly nature of link's check callback
link's check callback is supposed to verify/permit setting it, however currently nothing restricts it from misusing it and modifying target object from within. Make sure that readonly semantics are checked by compiler to prevent callback's misuse. Signed-off-by: Igor Mammedov <imammedo@redhat.com> Signed-off-by: Fam Zheng <famz@redhat.com> Message-Id: <20170714021509.23681-2-famz@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'qom')
-rw-r--r--qom/object.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/qom/object.c b/qom/object.c
index 5f6fdfa..dfdbd50 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -740,7 +740,7 @@ out:
return ret;
}
-const char *object_get_typename(Object *obj)
+const char *object_get_typename(const Object *obj)
{
return obj->class->type->name;
}
@@ -1428,7 +1428,7 @@ out:
g_free(type);
}
-void object_property_allow_set_link(Object *obj, const char *name,
+void object_property_allow_set_link(const Object *obj, const char *name,
Object *val, Error **errp)
{
/* Allow the link to be set, always */
@@ -1436,7 +1436,7 @@ void object_property_allow_set_link(Object *obj, const char *name,
typedef struct {
Object **child;
- void (*check)(Object *, const char *, Object *, Error **);
+ void (*check)(const Object *, const char *, Object *, Error **);
ObjectPropertyLinkFlags flags;
} LinkProperty;
@@ -1552,7 +1552,7 @@ static void object_release_link_property(Object *obj, const char *name,
void object_property_add_link(Object *obj, const char *name,
const char *type, Object **child,
- void (*check)(Object *, const char *,
+ void (*check)(const Object *, const char *,
Object *, Error **),
ObjectPropertyLinkFlags flags,
Error **errp)