diff options
author | Kevin Wolf <kwolf@redhat.com> | 2020-11-30 11:56:12 +0100 |
---|---|---|
committer | Daniel P. Berrangé <berrange@redhat.com> | 2021-01-29 17:07:53 +0000 |
commit | 31b6aefdbd9d2fe45c25e5236e1cc363229cb96c (patch) | |
tree | e32fd4218d5c65dbb1bd40f8b104b1a7679cceb5 /crypto/secret_common.c | |
parent | 8573431b9c83a18a35d69e74d14f5055a07b23fc (diff) |
crypto: Move USER_CREATABLE to secret_common base class
Instead of duplicating the code for user creatable objects in secret and
secret_keyring, move it to the common base clase secret_common. As the
base class is abstract, it won't become user creatable itself.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Diffstat (limited to 'crypto/secret_common.c')
-rw-r--r-- | crypto/secret_common.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/crypto/secret_common.c b/crypto/secret_common.c index b03d530867..35b82cb531 100644 --- a/crypto/secret_common.c +++ b/crypto/secret_common.c @@ -269,6 +269,13 @@ qcrypto_secret_prop_get_keyid(Object *obj, static void +qcrypto_secret_complete(UserCreatable *uc, Error **errp) +{ + object_property_set_bool(OBJECT(uc), "loaded", true, errp); +} + + +static void qcrypto_secret_finalize(Object *obj) { QCryptoSecretCommon *secret = QCRYPTO_SECRET_COMMON(obj); @@ -281,6 +288,10 @@ qcrypto_secret_finalize(Object *obj) static void qcrypto_secret_class_init(ObjectClass *oc, void *data) { + UserCreatableClass *ucc = USER_CREATABLE_CLASS(oc); + + ucc->complete = qcrypto_secret_complete; + object_class_property_add_bool(oc, "loaded", qcrypto_secret_prop_get_loaded, qcrypto_secret_prop_set_loaded); @@ -390,6 +401,10 @@ static const TypeInfo qcrypto_secret_info = { .class_size = sizeof(QCryptoSecretCommonClass), .class_init = qcrypto_secret_class_init, .abstract = true, + .interfaces = (InterfaceInfo[]) { + { TYPE_USER_CREATABLE }, + { } + } }; |