Skip to content

Commit db1015e

Browse files
committed
Move QOM typedefs and add missing includes
Some typedefs and macros are defined after the type check macros. This makes it difficult to automatically replace their definitions with OBJECT_DECLARE_TYPE. Patch generated using: $ ./scripts/codeconverter/converter.py -i \ --pattern=QOMStructTypedefSplit $(git grep -l '' -- '*.[ch]') which will split "typdef struct { ... } TypedefName" declarations. Followed by: $ ./scripts/codeconverter/converter.py -i --pattern=MoveSymbols \ $(git grep -l '' -- '*.[ch]') which will: - move the typedefs and #defines above the type check macros - add missing #include "qom/object.h" lines if necessary Reviewed-by: Daniel P. Berrangé <[email protected]> Reviewed-by: Juan Quintela <[email protected]> Message-Id: <[email protected]> Reviewed-by: Juan Quintela <[email protected]> Message-Id: <[email protected]> Message-Id: <[email protected]> Signed-off-by: Eduardo Habkost <[email protected]>
1 parent 1c8eef0 commit db1015e

File tree

796 files changed

+3378
-1823
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

796 files changed

+3378
-1823
lines changed

accel/tcg/tcg-all.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,13 @@
3636
#include "hw/boards.h"
3737
#include "qapi/qapi-builtin-visit.h"
3838

39-
typedef struct TCGState {
39+
struct TCGState {
4040
AccelState parent_obj;
4141

4242
bool mttcg_enabled;
4343
unsigned long tb_size;
44-
} TCGState;
44+
};
45+
typedef struct TCGState TCGState;
4546

4647
#define TYPE_TCG_ACCEL ACCEL_CLASS_NAME("tcg")
4748

backends/cryptodev-builtin.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include "qapi/error.h"
2727
#include "standard-headers/linux/virtio_crypto.h"
2828
#include "crypto/cipher.h"
29+
#include "qom/object.h"
2930

3031

3132
/**
@@ -34,12 +35,12 @@
3435
*/
3536
#define TYPE_CRYPTODEV_BACKEND_BUILTIN "cryptodev-backend-builtin"
3637

38+
typedef struct CryptoDevBackendBuiltin
39+
CryptoDevBackendBuiltin;
3740
#define CRYPTODEV_BACKEND_BUILTIN(obj) \
3841
OBJECT_CHECK(CryptoDevBackendBuiltin, \
3942
(obj), TYPE_CRYPTODEV_BACKEND_BUILTIN)
4043

41-
typedef struct CryptoDevBackendBuiltin
42-
CryptoDevBackendBuiltin;
4344

4445
typedef struct CryptoDevBackendBuiltinSession {
4546
QCryptoCipher *cipher;

backends/cryptodev-vhost-user.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include "sysemu/cryptodev-vhost.h"
3131
#include "chardev/char-fe.h"
3232
#include "sysemu/cryptodev-vhost-user.h"
33+
#include "qom/object.h"
3334

3435

3536
/**
@@ -38,20 +39,21 @@
3839
*/
3940
#define TYPE_CRYPTODEV_BACKEND_VHOST_USER "cryptodev-vhost-user"
4041

42+
typedef struct CryptoDevBackendVhostUser CryptoDevBackendVhostUser;
4143
#define CRYPTODEV_BACKEND_VHOST_USER(obj) \
4244
OBJECT_CHECK(CryptoDevBackendVhostUser, \
4345
(obj), TYPE_CRYPTODEV_BACKEND_VHOST_USER)
4446

4547

46-
typedef struct CryptoDevBackendVhostUser {
48+
struct CryptoDevBackendVhostUser {
4749
CryptoDevBackend parent_obj;
4850

4951
VhostUserState vhost_user;
5052
CharBackend chr;
5153
char *chr_name;
5254
bool opened;
5355
CryptoDevBackendVhost *vhost_crypto[MAX_CRYPTO_QUEUE_NUM];
54-
} CryptoDevBackendVhostUser;
56+
};
5557

5658
static int
5759
cryptodev_vhost_user_running(

backends/dbus-vmstate.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include "qapi/qmp/qerror.h"
2020
#include "migration/vmstate.h"
2121
#include "trace.h"
22+
#include "qom/object.h"
2223

2324
typedef struct DBusVMState DBusVMState;
2425
typedef struct DBusVMStateClass DBusVMStateClass;

backends/hostmem-file.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,12 @@
1717
#include "sysemu/hostmem.h"
1818
#include "sysemu/sysemu.h"
1919
#include "qom/object_interfaces.h"
20+
#include "qom/object.h"
2021

22+
typedef struct HostMemoryBackendFile HostMemoryBackendFile;
2123
#define MEMORY_BACKEND_FILE(obj) \
2224
OBJECT_CHECK(HostMemoryBackendFile, (obj), TYPE_MEMORY_BACKEND_FILE)
2325

24-
typedef struct HostMemoryBackendFile HostMemoryBackendFile;
2526

2627
struct HostMemoryBackendFile {
2728
HostMemoryBackend parent_obj;

backends/hostmem-memfd.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,14 @@
1717
#include "qemu/memfd.h"
1818
#include "qemu/module.h"
1919
#include "qapi/error.h"
20+
#include "qom/object.h"
2021

2122
#define TYPE_MEMORY_BACKEND_MEMFD "memory-backend-memfd"
2223

24+
typedef struct HostMemoryBackendMemfd HostMemoryBackendMemfd;
2325
#define MEMORY_BACKEND_MEMFD(obj) \
2426
OBJECT_CHECK(HostMemoryBackendMemfd, (obj), TYPE_MEMORY_BACKEND_MEMFD)
2527

26-
typedef struct HostMemoryBackendMemfd HostMemoryBackendMemfd;
2728

2829
struct HostMemoryBackendMemfd {
2930
HostMemoryBackend parent_obj;

backends/rng-builtin.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,15 @@
99
#include "sysemu/rng.h"
1010
#include "qemu/main-loop.h"
1111
#include "qemu/guest-random.h"
12+
#include "qom/object.h"
1213

14+
typedef struct RngBuiltin RngBuiltin;
1315
#define RNG_BUILTIN(obj) OBJECT_CHECK(RngBuiltin, (obj), TYPE_RNG_BUILTIN)
1416

15-
typedef struct RngBuiltin {
17+
struct RngBuiltin {
1618
RngBackend parent;
1719
QEMUBH *bh;
18-
} RngBuiltin;
20+
};
1921

2022
static void rng_builtin_receive_entropy_bh(void *opaque)
2123
{

backends/rng-egd.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,18 @@
1616
#include "qapi/error.h"
1717
#include "qapi/qmp/qerror.h"
1818
#include "qemu/module.h"
19+
#include "qom/object.h"
1920

2021
#define TYPE_RNG_EGD "rng-egd"
22+
typedef struct RngEgd RngEgd;
2123
#define RNG_EGD(obj) OBJECT_CHECK(RngEgd, (obj), TYPE_RNG_EGD)
2224

23-
typedef struct RngEgd
24-
{
25+
struct RngEgd {
2526
RngBackend parent;
2627

2728
CharBackend chr;
2829
char *chr_name;
29-
} RngEgd;
30+
};
3031

3132
static void rng_egd_request_entropy(RngBackend *b, RngRequest *req)
3233
{

backends/tpm/tpm_emulator.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,10 @@
4242
#include "qapi/qapi-visit-tpm.h"
4343
#include "chardev/char-fe.h"
4444
#include "trace.h"
45+
#include "qom/object.h"
4546

4647
#define TYPE_TPM_EMULATOR "tpm-emulator"
48+
typedef struct TPMEmulator TPMEmulator;
4749
#define TPM_EMULATOR(obj) \
4850
OBJECT_CHECK(TPMEmulator, (obj), TYPE_TPM_EMULATOR)
4951

@@ -63,7 +65,7 @@ typedef struct TPMBlobBuffers {
6365
TPMSizedBuffer savestate;
6466
} TPMBlobBuffers;
6567

66-
typedef struct TPMEmulator {
68+
struct TPMEmulator {
6769
TPMBackend parent;
6870

6971
TPMEmulatorOptions *options;
@@ -80,7 +82,7 @@ typedef struct TPMEmulator {
8082
unsigned int established_flag_cached:1;
8183

8284
TPMBlobBuffers state_blobs;
83-
} TPMEmulator;
85+
};
8486

8587
struct tpm_error {
8688
uint32_t tpm_result;

backends/tpm/tpm_passthrough.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,10 @@
3333
#include "qapi/clone-visitor.h"
3434
#include "qapi/qapi-visit-tpm.h"
3535
#include "trace.h"
36+
#include "qom/object.h"
3637

3738
#define TYPE_TPM_PASSTHROUGH "tpm-passthrough"
39+
typedef struct TPMPassthruState TPMPassthruState;
3840
#define TPM_PASSTHROUGH(obj) \
3941
OBJECT_CHECK(TPMPassthruState, (obj), TYPE_TPM_PASSTHROUGH)
4042

@@ -53,7 +55,6 @@ struct TPMPassthruState {
5355
size_t tpm_buffersize;
5456
};
5557

56-
typedef struct TPMPassthruState TPMPassthruState;
5758

5859
#define TPM_PASSTHROUGH_DEFAULT_DEVICE "/dev/tpm0"
5960

0 commit comments

Comments
 (0)