Add qemu 2.4.0
[kvmfornfv.git] / qemu / qom / object_interfaces.c
1 #include "qom/object_interfaces.h"
2 #include "qemu/module.h"
3
4 void user_creatable_complete(Object *obj, Error **errp)
5 {
6
7     UserCreatableClass *ucc;
8     UserCreatable *uc =
9         (UserCreatable *)object_dynamic_cast(obj, TYPE_USER_CREATABLE);
10
11     if (!uc) {
12         return;
13     }
14
15     ucc = USER_CREATABLE_GET_CLASS(uc);
16     if (ucc->complete) {
17         ucc->complete(uc, errp);
18     }
19 }
20
21 bool user_creatable_can_be_deleted(UserCreatable *uc, Error **errp)
22 {
23
24     UserCreatableClass *ucc = USER_CREATABLE_GET_CLASS(uc);
25
26     if (ucc->can_be_deleted) {
27         return ucc->can_be_deleted(uc, errp);
28     } else {
29         return true;
30     }
31 }
32
33 static void register_types(void)
34 {
35     static const TypeInfo uc_interface_info = {
36         .name          = TYPE_USER_CREATABLE,
37         .parent        = TYPE_INTERFACE,
38         .class_size = sizeof(UserCreatableClass),
39     };
40
41     type_register_static(&uc_interface_info);
42 }
43
44 type_init(register_types)