@@ -26,11 +26,9 @@
#include "crypto/secret_common.h"
#define TYPE_QCRYPTO_SECRET "secret"
-typedef struct QCryptoSecret QCryptoSecret;
-DECLARE_INSTANCE_CHECKER(QCryptoSecret, QCRYPTO_SECRET,
- TYPE_QCRYPTO_SECRET)
-typedef struct QCryptoSecretClass QCryptoSecretClass;
+OBJECT_DECLARE_SIMPLE_TYPE(QCryptoSecret, qcrypto_secret,
+ QCRYPTO_SECRET, QCryptoSecretCommon)
/**
* QCryptoSecret:
@@ -125,9 +123,4 @@ struct QCryptoSecret {
char *file;
};
-
-struct QCryptoSecretClass {
- QCryptoSecretCommonClass parent_class;
-};
-
#endif /* QCRYPTO_SECRET_H */
@@ -25,6 +25,9 @@
#include "qemu/module.h"
#include "trace.h"
+OBJECT_DEFINE_TYPE_WITH_INTERFACES(QCryptoSecret, qcrypto_secret,
+ QCRYPTO_SECRET, QCRYPTO_SECRET_COMMON,
+ { TYPE_USER_CREATABLE }, { NULL })
static void
qcrypto_secret_load_data(QCryptoSecretCommon *sec_common,
@@ -140,21 +143,7 @@ qcrypto_secret_class_init(ObjectClass *oc, void *data)
qcrypto_secret_prop_set_file);
}
-
-static const TypeInfo qcrypto_secret_info = {
- .parent = TYPE_QCRYPTO_SECRET_COMMON,
- .name = TYPE_QCRYPTO_SECRET,
- .instance_size = sizeof(QCryptoSecret),
- .instance_finalize = qcrypto_secret_finalize,
- .class_size = sizeof(QCryptoSecretClass),
- .class_init = qcrypto_secret_class_init,
- .interfaces = (InterfaceInfo[]) {
- { TYPE_USER_CREATABLE },
- { }
- }
-};
-TYPE_INFO(qcrypto_secret_info)
-
-
-
-
+static void
+qcrypto_secret_init(Object *obj)
+{
+}
@@ -28,6 +28,9 @@
#include "trace.h"
+OBJECT_DEFINE_ABSTRACT_TYPE(QCryptoSecretCommon, qcrypto_secret_common,
+ QCRYPTO_SECRET_COMMON, OBJECT)
+
static void qcrypto_secret_decrypt(QCryptoSecretCommon *secret,
const uint8_t *input,
size_t inputlen,
@@ -269,7 +272,7 @@ qcrypto_secret_prop_get_keyid(Object *obj,
static void
-qcrypto_secret_finalize(Object *obj)
+qcrypto_secret_common_finalize(Object *obj)
{
QCryptoSecretCommon *secret = QCRYPTO_SECRET_COMMON(obj);
@@ -279,7 +282,7 @@ qcrypto_secret_finalize(Object *obj)
}
static void
-qcrypto_secret_class_init(ObjectClass *oc, void *data)
+qcrypto_secret_common_class_init(ObjectClass *oc, void *data)
{
object_class_property_add_bool(oc, "loaded",
qcrypto_secret_prop_get_loaded,
@@ -297,6 +300,10 @@ qcrypto_secret_class_init(ObjectClass *oc, void *data)
qcrypto_secret_prop_set_iv);
}
+static void
+qcrypto_secret_common_init(Object *obj)
+{
+}
int qcrypto_secret_lookup(const char *secretid,
uint8_t **data,
@@ -380,19 +387,3 @@ char *qcrypto_secret_lookup_as_base64(const char *secretid,
g_free(data);
return ret;
}
-
-
-static const TypeInfo qcrypto_secret_info = {
- .parent = TYPE_OBJECT,
- .name = TYPE_QCRYPTO_SECRET_COMMON,
- .instance_size = sizeof(QCryptoSecretCommon),
- .instance_finalize = qcrypto_secret_finalize,
- .class_size = sizeof(QCryptoSecretCommonClass),
- .class_init = qcrypto_secret_class_init,
- .abstract = true,
-};
-TYPE_INFO(qcrypto_secret_info)
-
-
-
-
@@ -26,6 +26,9 @@
#include "trace.h"
#include "crypto/secret_keyring.h"
+OBJECT_DEFINE_TYPE_WITH_INTERFACES(QCryptoSecretKeyring, qcrypto_secret_keyring,
+ QCRYPTO_SECRET_KEYRING, QCRYPTO_SECRET_COMMON,
+ { TYPE_USER_CREATABLE }, { NULL })
static inline
long keyctl_read(int32_t key, uint8_t *buffer, size_t buflen)
@@ -109,6 +112,11 @@ qcrypto_secret_keyring_complete(UserCreatable *uc, Error **errp)
}
+static void
+qcrypto_secret_keyring_finalize(Object *obj)
+{
+}
+
static void
qcrypto_secret_keyring_class_init(ObjectClass *oc, void *data)
{
@@ -124,20 +132,7 @@ qcrypto_secret_keyring_class_init(ObjectClass *oc, void *data)
NULL, NULL);
}
-
-static const TypeInfo qcrypto_secret_info = {
- .parent = TYPE_QCRYPTO_SECRET_COMMON,
- .name = TYPE_QCRYPTO_SECRET_KEYRING,
- .instance_size = sizeof(QCryptoSecretKeyring),
- .class_size = sizeof(QCryptoSecretKeyringClass),
- .class_init = qcrypto_secret_keyring_class_init,
- .interfaces = (InterfaceInfo[]) {
- { TYPE_USER_CREATABLE },
- { }
- }
-};
-TYPE_INFO(qcrypto_secret_info)
-
-
-
-
+static void
+qcrypto_secret_keyring_init(Object *obj)
+{
+}