vhost-user: Register "chardev" as class property

Class properties make QOM introspection simpler and easier, as
they don't require an object to be instantiated.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20200921221045.699690-6-ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
This commit is contained in:
Eduardo Habkost 2020-09-21 18:10:26 -04:00
parent 5949703709
commit abb9369805

View file

@ -175,9 +175,9 @@ static char *get_chardev(Object *obj, Error **errp)
return NULL;
}
static void vhost_user_backend_init(Object *obj)
static void vhost_user_backend_class_init(ObjectClass *oc, void *data)
{
object_property_add_str(obj, "chardev", get_chardev, set_chardev);
object_class_property_add_str(oc, "chardev", get_chardev, set_chardev);
}
static void vhost_user_backend_finalize(Object *obj)
@ -195,7 +195,7 @@ static const TypeInfo vhost_user_backend_info = {
.name = TYPE_VHOST_USER_BACKEND,
.parent = TYPE_OBJECT,
.instance_size = sizeof(VhostUserBackend),
.instance_init = vhost_user_backend_init,
.class_init = vhost_user_backend_class_init,
.instance_finalize = vhost_user_backend_finalize,
};