mirror of
https://github.com/xemu-project/xemu.git
synced 2024-11-30 23:10:38 +00:00
d6edb15576
If backends implement the can_be_deleted and it returns false, Then the qmp_object_del won't delete the given backends. Signed-off-by: Lin Ma <lma@suse.com> Message-Id: <1427704589-7688-2-git-send-email-lma@suse.com> Reviewed-by: Igor Mammedov <imammedo@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
45 lines
946 B
C
45 lines
946 B
C
#include "qom/object_interfaces.h"
|
|
#include "qemu/module.h"
|
|
|
|
void user_creatable_complete(Object *obj, Error **errp)
|
|
{
|
|
|
|
UserCreatableClass *ucc;
|
|
UserCreatable *uc =
|
|
(UserCreatable *)object_dynamic_cast(obj, TYPE_USER_CREATABLE);
|
|
|
|
if (!uc) {
|
|
return;
|
|
}
|
|
|
|
ucc = USER_CREATABLE_GET_CLASS(uc);
|
|
if (ucc->complete) {
|
|
ucc->complete(uc, errp);
|
|
}
|
|
}
|
|
|
|
bool user_creatable_can_be_deleted(UserCreatable *uc, Error **errp)
|
|
{
|
|
|
|
UserCreatableClass *ucc = USER_CREATABLE_GET_CLASS(uc);
|
|
|
|
if (ucc->can_be_deleted) {
|
|
return ucc->can_be_deleted(uc, errp);
|
|
} else {
|
|
return true;
|
|
}
|
|
}
|
|
|
|
static void register_types(void)
|
|
{
|
|
static const TypeInfo uc_interface_info = {
|
|
.name = TYPE_USER_CREATABLE,
|
|
.parent = TYPE_INTERFACE,
|
|
.class_size = sizeof(UserCreatableClass),
|
|
};
|
|
|
|
type_register_static(&uc_interface_info);
|
|
}
|
|
|
|
type_init(register_types)
|