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>
This commit is contained in:
Igor Mammedov 2017-07-14 10:14:50 +08:00 committed by Paolo Bonzini
parent d40d3da00c
commit 8f5d58ef2c
9 changed files with 16 additions and 14 deletions

View file

@ -889,7 +889,7 @@ static void virtio_crypto_class_init(ObjectClass *klass, void *data)
}
static void
virtio_crypto_check_cryptodev_is_used(Object *obj, const char *name,
virtio_crypto_check_cryptodev_is_used(const Object *obj, const char *name,
Object *val, Error **errp)
{
if (cryptodev_backend_is_used(CRYPTODEV_BACKEND(val))) {