From 8f5d58ef2c92d7b82d9a6eeefd7c8854a183ba4a Mon Sep 17 00:00:00 2001 From: Igor Mammedov Date: Fri, 14 Jul 2017 10:14:50 +0800 Subject: 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 Signed-off-by: Fam Zheng Message-Id: <20170714021509.23681-2-famz@redhat.com> Signed-off-by: Paolo Bonzini --- include/qom/object.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'include/qom') diff --git a/include/qom/object.h b/include/qom/object.h index abaeb8cf4e..1b828994fa 100644 --- a/include/qom/object.h +++ b/include/qom/object.h @@ -764,7 +764,7 @@ ObjectClass *object_get_class(Object *obj); * * Returns: The QOM typename of @obj. */ -const char *object_get_typename(Object *obj); +const char *object_get_typename(const Object *obj); /** * type_register_static: @@ -1319,7 +1319,7 @@ typedef enum { * callback function. It allows the link property to be set and never returns * an error. */ -void object_property_allow_set_link(Object *, const char *, +void object_property_allow_set_link(const Object *, const char *, Object *, Error **); /** @@ -1352,7 +1352,7 @@ void object_property_allow_set_link(Object *, const char *, */ void object_property_add_link(Object *obj, const char *name, const char *type, Object **child, - void (*check)(Object *obj, const char *name, + void (*check)(const Object *obj, const char *name, Object *val, Error **errp), ObjectPropertyLinkFlags flags, Error **errp); -- cgit v1.2.3