aboutsummaryrefslogtreecommitdiff
path: root/backends
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2020-09-11 19:26:51 +0100
committerPeter Maydell <peter.maydell@linaro.org>2020-09-11 19:26:51 +0100
commitf4ef8c9cc10b3bee829b9775879d4ff9f77c2442 (patch)
tree8245341c3ebfe98b9673bf7a8cb818b6d494c76f /backends
parent2499453eb1cbb68a45d7562a180afd7659007fd4 (diff)
parentb84bf23c88699098973de3bdec316c796f1b3794 (diff)
Merge remote-tracking branch 'remotes/ehabkost/tags/machine-next-pull-request' into staging
QOM boilerplate cleanup Documentation build fix: * memory: Remove kernel-doc comment marker (Eduardo Habkost) QOM cleanups: * Rename QOM macros for consistency between TYPE_* and type checking constants (Eduardo Habkost) QOM new macros: * OBJECT_DECLARE_* and OBJECT_DEFINE_* macros (Daniel P. Berrangé) * DECLARE_*_CHECKER macros (Eduardo Habkost) Automated QOM boilerplate changes: * Automated changes to use DECLARE_*_CHECKER (Eduardo Habkost * Automated changes to use OBJECT_DECLARE* (Eduardo Habkost) # gpg: Signature made Thu 10 Sep 2020 19:17:49 BST # gpg: using RSA key 5A322FD5ABC4D3DBACCFD1AA2807936F984DC5A6 # gpg: issuer "ehabkost@redhat.com" # gpg: Good signature from "Eduardo Habkost <ehabkost@redhat.com>" [full] # Primary key fingerprint: 5A32 2FD5 ABC4 D3DB ACCF D1AA 2807 936F 984D C5A6 * remotes/ehabkost/tags/machine-next-pull-request: (33 commits) virtio-vga: Use typedef name for instance_size vhost-user-vga: Use typedef name for instance_size xilinx_axienet: Use typedef name for instance_size lpc_ich9: Use typedef name for instance_size omap_intc: Use typedef name for instance_size xilinx_axidma: Use typedef name for instance_size tusb6010: Rename TUSB to TUSB6010 pc87312: Rename TYPE_PC87312_SUPERIO to TYPE_PC87312 vfio: Rename PCI_VFIO to VFIO_PCI usb: Rename USB_SERIAL_DEV to USB_SERIAL sabre: Rename SABRE_DEVICE to SABRE rs6000_mc: Rename RS6000MC_DEVICE to RS6000MC filter-rewriter: Rename FILTER_COLO_REWRITER to FILTER_REWRITER esp: Rename ESP_STATE to ESP ahci: Rename ICH_AHCI to ICH9_AHCI vmgenid: Rename VMGENID_DEVICE to TYPE_VMGENID vfio: Rename VFIO_AP_DEVICE_TYPE to TYPE_VFIO_AP_DEVICE dev-smartcard-reader: Rename CCID_DEV_NAME to TYPE_USB_CCID_DEV ap-device: Rename AP_DEVICE_TYPE to TYPE_AP_DEVICE gpex: Fix type checking function name ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'backends')
-rw-r--r--backends/cryptodev-builtin.c8
-rw-r--r--backends/cryptodev-vhost-user.c11
-rw-r--r--backends/dbus-vmstate.c16
-rw-r--r--backends/hostmem-file.c7
-rw-r--r--backends/hostmem-memfd.c7
-rw-r--r--backends/rng-builtin.c9
-rw-r--r--backends/rng-egd.c10
-rw-r--r--backends/tpm/tpm_emulator.c10
-rw-r--r--backends/tpm/tpm_passthrough.c7
9 files changed, 44 insertions, 41 deletions
diff --git a/backends/cryptodev-builtin.c b/backends/cryptodev-builtin.c
index 14316333fe..f047ad0362 100644
--- a/backends/cryptodev-builtin.c
+++ b/backends/cryptodev-builtin.c
@@ -26,6 +26,7 @@
#include "qapi/error.h"
#include "standard-headers/linux/virtio_crypto.h"
#include "crypto/cipher.h"
+#include "qom/object.h"
/**
@@ -34,12 +35,11 @@
*/
#define TYPE_CRYPTODEV_BACKEND_BUILTIN "cryptodev-backend-builtin"
-#define CRYPTODEV_BACKEND_BUILTIN(obj) \
- OBJECT_CHECK(CryptoDevBackendBuiltin, \
- (obj), TYPE_CRYPTODEV_BACKEND_BUILTIN)
-
typedef struct CryptoDevBackendBuiltin
CryptoDevBackendBuiltin;
+DECLARE_INSTANCE_CHECKER(CryptoDevBackendBuiltin, CRYPTODEV_BACKEND_BUILTIN,
+ TYPE_CRYPTODEV_BACKEND_BUILTIN)
+
typedef struct CryptoDevBackendBuiltinSession {
QCryptoCipher *cipher;
diff --git a/backends/cryptodev-vhost-user.c b/backends/cryptodev-vhost-user.c
index dbe5a8aae6..41089dede1 100644
--- a/backends/cryptodev-vhost-user.c
+++ b/backends/cryptodev-vhost-user.c
@@ -30,6 +30,7 @@
#include "sysemu/cryptodev-vhost.h"
#include "chardev/char-fe.h"
#include "sysemu/cryptodev-vhost-user.h"
+#include "qom/object.h"
/**
@@ -38,12 +39,12 @@
*/
#define TYPE_CRYPTODEV_BACKEND_VHOST_USER "cryptodev-vhost-user"
-#define CRYPTODEV_BACKEND_VHOST_USER(obj) \
- OBJECT_CHECK(CryptoDevBackendVhostUser, \
- (obj), TYPE_CRYPTODEV_BACKEND_VHOST_USER)
+typedef struct CryptoDevBackendVhostUser CryptoDevBackendVhostUser;
+DECLARE_INSTANCE_CHECKER(CryptoDevBackendVhostUser, CRYPTODEV_BACKEND_VHOST_USER,
+ TYPE_CRYPTODEV_BACKEND_VHOST_USER)
-typedef struct CryptoDevBackendVhostUser {
+struct CryptoDevBackendVhostUser {
CryptoDevBackend parent_obj;
VhostUserState vhost_user;
@@ -51,7 +52,7 @@ typedef struct CryptoDevBackendVhostUser {
char *chr_name;
bool opened;
CryptoDevBackendVhost *vhost_crypto[MAX_CRYPTO_QUEUE_NUM];
-} CryptoDevBackendVhostUser;
+};
static int
cryptodev_vhost_user_running(
diff --git a/backends/dbus-vmstate.c b/backends/dbus-vmstate.c
index 56361a6272..a13461edea 100644
--- a/backends/dbus-vmstate.c
+++ b/backends/dbus-vmstate.c
@@ -19,21 +19,13 @@
#include "qapi/qmp/qerror.h"
#include "migration/vmstate.h"
#include "trace.h"
+#include "qom/object.h"
-typedef struct DBusVMState DBusVMState;
-typedef struct DBusVMStateClass DBusVMStateClass;
#define TYPE_DBUS_VMSTATE "dbus-vmstate"
-#define DBUS_VMSTATE(obj) \
- OBJECT_CHECK(DBusVMState, (obj), TYPE_DBUS_VMSTATE)
-#define DBUS_VMSTATE_GET_CLASS(obj) \
- OBJECT_GET_CLASS(DBusVMStateClass, (obj), TYPE_DBUS_VMSTATE)
-#define DBUS_VMSTATE_CLASS(klass) \
- OBJECT_CLASS_CHECK(DBusVMStateClass, (klass), TYPE_DBUS_VMSTATE)
-
-struct DBusVMStateClass {
- ObjectClass parent_class;
-};
+OBJECT_DECLARE_SIMPLE_TYPE(DBusVMState, dbus_vmstate,
+ DBUS_VMSTATE, ObjectClass)
+
struct DBusVMState {
Object parent;
diff --git a/backends/hostmem-file.c b/backends/hostmem-file.c
index 5b819020b4..a3b2e8209e 100644
--- a/backends/hostmem-file.c
+++ b/backends/hostmem-file.c
@@ -17,11 +17,12 @@
#include "sysemu/hostmem.h"
#include "sysemu/sysemu.h"
#include "qom/object_interfaces.h"
-
-#define MEMORY_BACKEND_FILE(obj) \
- OBJECT_CHECK(HostMemoryBackendFile, (obj), TYPE_MEMORY_BACKEND_FILE)
+#include "qom/object.h"
typedef struct HostMemoryBackendFile HostMemoryBackendFile;
+DECLARE_INSTANCE_CHECKER(HostMemoryBackendFile, MEMORY_BACKEND_FILE,
+ TYPE_MEMORY_BACKEND_FILE)
+
struct HostMemoryBackendFile {
HostMemoryBackend parent_obj;
diff --git a/backends/hostmem-memfd.c b/backends/hostmem-memfd.c
index 4c040a7541..8cf6bcbda2 100644
--- a/backends/hostmem-memfd.c
+++ b/backends/hostmem-memfd.c
@@ -17,13 +17,14 @@
#include "qemu/memfd.h"
#include "qemu/module.h"
#include "qapi/error.h"
+#include "qom/object.h"
#define TYPE_MEMORY_BACKEND_MEMFD "memory-backend-memfd"
-#define MEMORY_BACKEND_MEMFD(obj) \
- OBJECT_CHECK(HostMemoryBackendMemfd, (obj), TYPE_MEMORY_BACKEND_MEMFD)
-
typedef struct HostMemoryBackendMemfd HostMemoryBackendMemfd;
+DECLARE_INSTANCE_CHECKER(HostMemoryBackendMemfd, MEMORY_BACKEND_MEMFD,
+ TYPE_MEMORY_BACKEND_MEMFD)
+
struct HostMemoryBackendMemfd {
HostMemoryBackend parent_obj;
diff --git a/backends/rng-builtin.c b/backends/rng-builtin.c
index ba1b8d66b8..459be97a5a 100644
--- a/backends/rng-builtin.c
+++ b/backends/rng-builtin.c
@@ -9,13 +9,16 @@
#include "sysemu/rng.h"
#include "qemu/main-loop.h"
#include "qemu/guest-random.h"
+#include "qom/object.h"
-#define RNG_BUILTIN(obj) OBJECT_CHECK(RngBuiltin, (obj), TYPE_RNG_BUILTIN)
+typedef struct RngBuiltin RngBuiltin;
+DECLARE_INSTANCE_CHECKER(RngBuiltin, RNG_BUILTIN,
+ TYPE_RNG_BUILTIN)
-typedef struct RngBuiltin {
+struct RngBuiltin {
RngBackend parent;
QEMUBH *bh;
-} RngBuiltin;
+};
static void rng_builtin_receive_entropy_bh(void *opaque)
{
diff --git a/backends/rng-egd.c b/backends/rng-egd.c
index 7aaa6ee239..d905fe657c 100644
--- a/backends/rng-egd.c
+++ b/backends/rng-egd.c
@@ -16,17 +16,19 @@
#include "qapi/error.h"
#include "qapi/qmp/qerror.h"
#include "qemu/module.h"
+#include "qom/object.h"
#define TYPE_RNG_EGD "rng-egd"
-#define RNG_EGD(obj) OBJECT_CHECK(RngEgd, (obj), TYPE_RNG_EGD)
+typedef struct RngEgd RngEgd;
+DECLARE_INSTANCE_CHECKER(RngEgd, RNG_EGD,
+ TYPE_RNG_EGD)
-typedef struct RngEgd
-{
+struct RngEgd {
RngBackend parent;
CharBackend chr;
char *chr_name;
-} RngEgd;
+};
static void rng_egd_request_entropy(RngBackend *b, RngRequest *req)
{
diff --git a/backends/tpm/tpm_emulator.c b/backends/tpm/tpm_emulator.c
index a9b0f55e67..13657d9aba 100644
--- a/backends/tpm/tpm_emulator.c
+++ b/backends/tpm/tpm_emulator.c
@@ -42,10 +42,12 @@
#include "qapi/qapi-visit-tpm.h"
#include "chardev/char-fe.h"
#include "trace.h"
+#include "qom/object.h"
#define TYPE_TPM_EMULATOR "tpm-emulator"
-#define TPM_EMULATOR(obj) \
- OBJECT_CHECK(TPMEmulator, (obj), TYPE_TPM_EMULATOR)
+typedef struct TPMEmulator TPMEmulator;
+DECLARE_INSTANCE_CHECKER(TPMEmulator, TPM_EMULATOR,
+ TYPE_TPM_EMULATOR)
#define TPM_EMULATOR_IMPLEMENTS_ALL_CAPS(S, cap) (((S)->caps & (cap)) == (cap))
@@ -63,7 +65,7 @@ typedef struct TPMBlobBuffers {
TPMSizedBuffer savestate;
} TPMBlobBuffers;
-typedef struct TPMEmulator {
+struct TPMEmulator {
TPMBackend parent;
TPMEmulatorOptions *options;
@@ -80,7 +82,7 @@ typedef struct TPMEmulator {
unsigned int established_flag_cached:1;
TPMBlobBuffers state_blobs;
-} TPMEmulator;
+};
struct tpm_error {
uint32_t tpm_result;
diff --git a/backends/tpm/tpm_passthrough.c b/backends/tpm/tpm_passthrough.c
index 7403807ec4..10722e0a41 100644
--- a/backends/tpm/tpm_passthrough.c
+++ b/backends/tpm/tpm_passthrough.c
@@ -33,10 +33,12 @@
#include "qapi/clone-visitor.h"
#include "qapi/qapi-visit-tpm.h"
#include "trace.h"
+#include "qom/object.h"
#define TYPE_TPM_PASSTHROUGH "tpm-passthrough"
-#define TPM_PASSTHROUGH(obj) \
- OBJECT_CHECK(TPMPassthruState, (obj), TYPE_TPM_PASSTHROUGH)
+typedef struct TPMPassthruState TPMPassthruState;
+DECLARE_INSTANCE_CHECKER(TPMPassthruState, TPM_PASSTHROUGH,
+ TYPE_TPM_PASSTHROUGH)
/* data structures */
struct TPMPassthruState {
@@ -53,7 +55,6 @@ struct TPMPassthruState {
size_t tpm_buffersize;
};
-typedef struct TPMPassthruState TPMPassthruState;
#define TPM_PASSTHROUGH_DEFAULT_DEVICE "/dev/tpm0"