summaryrefslogtreecommitdiffstats
path: root/qom
diff options
context:
space:
mode:
authorLin Ma2015-03-30 10:36:28 +0200
committerPaolo Bonzini2015-04-01 10:06:38 +0200
commitd6edb15576643ab348a9f73e115c2e037edf7460 (patch)
tree54365e3a269416ad3fac1efee0a9c320754f9185 /qom
parentMerge remote-tracking branch 'remotes/afaerber/tags/qom-devices-for-peter' in... (diff)
downloadqemu-d6edb15576643ab348a9f73e115c2e037edf7460.tar.gz
qemu-d6edb15576643ab348a9f73e115c2e037edf7460.tar.xz
qemu-d6edb15576643ab348a9f73e115c2e037edf7460.zip
qom: Add can_be_deleted callback to UserCreatableClass
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>
Diffstat (limited to 'qom')
-rw-r--r--qom/object_interfaces.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/qom/object_interfaces.c b/qom/object_interfaces.c
index 6360818397..a66cd6026c 100644
--- a/qom/object_interfaces.c
+++ b/qom/object_interfaces.c
@@ -18,6 +18,18 @@ void user_creatable_complete(Object *obj, Error **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 = {