mirror of
https://github.com/izzy2lost/xemu.git
synced 2026-07-06 00:20:22 -07:00
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é <berrange@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Message-Id: <20200831210740.126168-9-ehabkost@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Message-Id: <20200831210740.126168-10-ehabkost@redhat.com>
Message-Id: <20200831210740.126168-11-ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
This commit is contained in:
+3
-2
@@ -36,12 +36,13 @@
|
||||
#include "hw/boards.h"
|
||||
#include "qapi/qapi-builtin-visit.h"
|
||||
|
||||
typedef struct TCGState {
|
||||
struct TCGState {
|
||||
AccelState parent_obj;
|
||||
|
||||
bool mttcg_enabled;
|
||||
unsigned long tb_size;
|
||||
} TCGState;
|
||||
};
|
||||
typedef struct TCGState TCGState;
|
||||
|
||||
#define TYPE_TCG_ACCEL ACCEL_CLASS_NAME("tcg")
|
||||
|
||||
|
||||
@@ -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,12 @@
|
||||
*/
|
||||
#define TYPE_CRYPTODEV_BACKEND_BUILTIN "cryptodev-backend-builtin"
|
||||
|
||||
typedef struct CryptoDevBackendBuiltin
|
||||
CryptoDevBackendBuiltin;
|
||||
#define CRYPTODEV_BACKEND_BUILTIN(obj) \
|
||||
OBJECT_CHECK(CryptoDevBackendBuiltin, \
|
||||
(obj), TYPE_CRYPTODEV_BACKEND_BUILTIN)
|
||||
|
||||
typedef struct CryptoDevBackendBuiltin
|
||||
CryptoDevBackendBuiltin;
|
||||
|
||||
typedef struct CryptoDevBackendBuiltinSession {
|
||||
QCryptoCipher *cipher;
|
||||
|
||||
@@ -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,13 @@
|
||||
*/
|
||||
#define TYPE_CRYPTODEV_BACKEND_VHOST_USER "cryptodev-vhost-user"
|
||||
|
||||
typedef struct CryptoDevBackendVhostUser CryptoDevBackendVhostUser;
|
||||
#define CRYPTODEV_BACKEND_VHOST_USER(obj) \
|
||||
OBJECT_CHECK(CryptoDevBackendVhostUser, \
|
||||
(obj), TYPE_CRYPTODEV_BACKEND_VHOST_USER)
|
||||
|
||||
|
||||
typedef struct CryptoDevBackendVhostUser {
|
||||
struct CryptoDevBackendVhostUser {
|
||||
CryptoDevBackend parent_obj;
|
||||
|
||||
VhostUserState vhost_user;
|
||||
@@ -51,7 +53,7 @@ typedef struct CryptoDevBackendVhostUser {
|
||||
char *chr_name;
|
||||
bool opened;
|
||||
CryptoDevBackendVhost *vhost_crypto[MAX_CRYPTO_QUEUE_NUM];
|
||||
} CryptoDevBackendVhostUser;
|
||||
};
|
||||
|
||||
static int
|
||||
cryptodev_vhost_user_running(
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "qapi/qmp/qerror.h"
|
||||
#include "migration/vmstate.h"
|
||||
#include "trace.h"
|
||||
#include "qom/object.h"
|
||||
|
||||
typedef struct DBusVMState DBusVMState;
|
||||
typedef struct DBusVMStateClass DBusVMStateClass;
|
||||
|
||||
@@ -17,11 +17,12 @@
|
||||
#include "sysemu/hostmem.h"
|
||||
#include "sysemu/sysemu.h"
|
||||
#include "qom/object_interfaces.h"
|
||||
#include "qom/object.h"
|
||||
|
||||
typedef struct HostMemoryBackendFile HostMemoryBackendFile;
|
||||
#define MEMORY_BACKEND_FILE(obj) \
|
||||
OBJECT_CHECK(HostMemoryBackendFile, (obj), TYPE_MEMORY_BACKEND_FILE)
|
||||
|
||||
typedef struct HostMemoryBackendFile HostMemoryBackendFile;
|
||||
|
||||
struct HostMemoryBackendFile {
|
||||
HostMemoryBackend parent_obj;
|
||||
|
||||
@@ -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"
|
||||
|
||||
typedef struct HostMemoryBackendMemfd HostMemoryBackendMemfd;
|
||||
#define MEMORY_BACKEND_MEMFD(obj) \
|
||||
OBJECT_CHECK(HostMemoryBackendMemfd, (obj), TYPE_MEMORY_BACKEND_MEMFD)
|
||||
|
||||
typedef struct HostMemoryBackendMemfd HostMemoryBackendMemfd;
|
||||
|
||||
struct HostMemoryBackendMemfd {
|
||||
HostMemoryBackend parent_obj;
|
||||
|
||||
@@ -9,13 +9,15 @@
|
||||
#include "sysemu/rng.h"
|
||||
#include "qemu/main-loop.h"
|
||||
#include "qemu/guest-random.h"
|
||||
#include "qom/object.h"
|
||||
|
||||
typedef struct RngBuiltin RngBuiltin;
|
||||
#define RNG_BUILTIN(obj) OBJECT_CHECK(RngBuiltin, (obj), TYPE_RNG_BUILTIN)
|
||||
|
||||
typedef struct RngBuiltin {
|
||||
struct RngBuiltin {
|
||||
RngBackend parent;
|
||||
QEMUBH *bh;
|
||||
} RngBuiltin;
|
||||
};
|
||||
|
||||
static void rng_builtin_receive_entropy_bh(void *opaque)
|
||||
{
|
||||
|
||||
+4
-3
@@ -16,17 +16,18 @@
|
||||
#include "qapi/error.h"
|
||||
#include "qapi/qmp/qerror.h"
|
||||
#include "qemu/module.h"
|
||||
#include "qom/object.h"
|
||||
|
||||
#define TYPE_RNG_EGD "rng-egd"
|
||||
typedef struct RngEgd RngEgd;
|
||||
#define RNG_EGD(obj) OBJECT_CHECK(RngEgd, (obj), 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)
|
||||
{
|
||||
|
||||
@@ -42,8 +42,10 @@
|
||||
#include "qapi/qapi-visit-tpm.h"
|
||||
#include "chardev/char-fe.h"
|
||||
#include "trace.h"
|
||||
#include "qom/object.h"
|
||||
|
||||
#define TYPE_TPM_EMULATOR "tpm-emulator"
|
||||
typedef struct TPMEmulator TPMEmulator;
|
||||
#define TPM_EMULATOR(obj) \
|
||||
OBJECT_CHECK(TPMEmulator, (obj), TYPE_TPM_EMULATOR)
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -33,8 +33,10 @@
|
||||
#include "qapi/clone-visitor.h"
|
||||
#include "qapi/qapi-visit-tpm.h"
|
||||
#include "trace.h"
|
||||
#include "qom/object.h"
|
||||
|
||||
#define TYPE_TPM_PASSTHROUGH "tpm-passthrough"
|
||||
typedef struct TPMPassthruState TPMPassthruState;
|
||||
#define TPM_PASSTHROUGH(obj) \
|
||||
OBJECT_CHECK(TPMPassthruState, (obj), TYPE_TPM_PASSTHROUGH)
|
||||
|
||||
@@ -53,7 +55,6 @@ struct TPMPassthruState {
|
||||
size_t tpm_buffersize;
|
||||
};
|
||||
|
||||
typedef struct TPMPassthruState TPMPassthruState;
|
||||
|
||||
#define TPM_PASSTHROUGH_DEFAULT_DEVICE "/dev/tpm0"
|
||||
|
||||
|
||||
+4
-2
@@ -33,6 +33,7 @@
|
||||
#include <brlapi.h>
|
||||
#include <brlapi_constants.h>
|
||||
#include <brlapi_keycodes.h>
|
||||
#include "qom/object.h"
|
||||
|
||||
#if 0
|
||||
#define DPRINTF(fmt, ...) \
|
||||
@@ -86,7 +87,7 @@
|
||||
|
||||
#define BUF_SIZE 256
|
||||
|
||||
typedef struct {
|
||||
struct BaumChardev {
|
||||
Chardev parent;
|
||||
|
||||
brlapi_handle_t *brlapi;
|
||||
@@ -100,7 +101,8 @@ typedef struct {
|
||||
uint8_t out_buf_used, out_buf_ptr;
|
||||
|
||||
QEMUTimer *cellCount_timer;
|
||||
} BaumChardev;
|
||||
};
|
||||
typedef struct BaumChardev BaumChardev;
|
||||
|
||||
#define TYPE_CHARDEV_BRAILLE "chardev-braille"
|
||||
#define BAUM_CHARDEV(obj) OBJECT_CHECK(BaumChardev, (obj), TYPE_CHARDEV_BRAILLE)
|
||||
|
||||
+4
-2
@@ -33,15 +33,17 @@
|
||||
#include "qemu/qemu-print.h"
|
||||
|
||||
#include "chardev/char-io.h"
|
||||
#include "qom/object.h"
|
||||
|
||||
typedef struct {
|
||||
struct PtyChardev {
|
||||
Chardev parent;
|
||||
QIOChannel *ioc;
|
||||
int read_bytes;
|
||||
|
||||
int connected;
|
||||
GSource *timer_src;
|
||||
} PtyChardev;
|
||||
};
|
||||
typedef struct PtyChardev PtyChardev;
|
||||
|
||||
#define PTY_CHARDEV(obj) OBJECT_CHECK(PtyChardev, (obj), TYPE_CHARDEV_PTY)
|
||||
|
||||
|
||||
@@ -29,16 +29,18 @@
|
||||
#include "qemu/base64.h"
|
||||
#include "qemu/module.h"
|
||||
#include "qemu/option.h"
|
||||
#include "qom/object.h"
|
||||
|
||||
/* Ring buffer chardev */
|
||||
|
||||
typedef struct {
|
||||
struct RingBufChardev {
|
||||
Chardev parent;
|
||||
size_t size;
|
||||
size_t prod;
|
||||
size_t cons;
|
||||
uint8_t *cbuf;
|
||||
} RingBufChardev;
|
||||
};
|
||||
typedef struct RingBufChardev RingBufChardev;
|
||||
|
||||
#define RINGBUF_CHARDEV(obj) \
|
||||
OBJECT_CHECK(RingBufChardev, (obj), TYPE_CHARDEV_RINGBUF)
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
#include "qapi/qapi-visit-sockets.h"
|
||||
|
||||
#include "chardev/char-io.h"
|
||||
#include "qom/object.h"
|
||||
|
||||
/***********************************************************/
|
||||
/* TCP Net console */
|
||||
@@ -53,7 +54,7 @@ typedef enum {
|
||||
TCP_CHARDEV_STATE_CONNECTED,
|
||||
} TCPChardevState;
|
||||
|
||||
typedef struct {
|
||||
struct SocketChardev {
|
||||
Chardev parent;
|
||||
QIOChannel *ioc; /* Client I/O channel */
|
||||
QIOChannelSocket *sioc; /* Client master channel */
|
||||
@@ -84,7 +85,8 @@ typedef struct {
|
||||
bool connect_err_reported;
|
||||
|
||||
QIOTask *connect_task;
|
||||
} SocketChardev;
|
||||
};
|
||||
typedef struct SocketChardev SocketChardev;
|
||||
|
||||
#define SOCKET_CHARDEV(obj) \
|
||||
OBJECT_CHECK(SocketChardev, (obj), TYPE_CHARDEV_SOCKET)
|
||||
|
||||
+4
-2
@@ -30,18 +30,20 @@
|
||||
#include "qemu/option.h"
|
||||
|
||||
#include "chardev/char-io.h"
|
||||
#include "qom/object.h"
|
||||
|
||||
/***********************************************************/
|
||||
/* UDP Net console */
|
||||
|
||||
typedef struct {
|
||||
struct UdpChardev {
|
||||
Chardev parent;
|
||||
QIOChannel *ioc;
|
||||
uint8_t buf[CHR_READ_BUF_LEN];
|
||||
int bufcnt;
|
||||
int bufptr;
|
||||
int max_size;
|
||||
} UdpChardev;
|
||||
};
|
||||
typedef struct UdpChardev UdpChardev;
|
||||
|
||||
#define UDP_CHARDEV(obj) OBJECT_CHECK(UdpChardev, (obj), TYPE_CHARDEV_UDP)
|
||||
|
||||
|
||||
@@ -28,15 +28,17 @@
|
||||
#include "qemu/module.h"
|
||||
#include "chardev/char-win.h"
|
||||
#include "chardev/char-win-stdio.h"
|
||||
#include "qom/object.h"
|
||||
|
||||
typedef struct {
|
||||
struct WinStdioChardev {
|
||||
Chardev parent;
|
||||
HANDLE hStdIn;
|
||||
HANDLE hInputReadyEvent;
|
||||
HANDLE hInputDoneEvent;
|
||||
HANDLE hInputThread;
|
||||
uint8_t win_stdio_buf;
|
||||
} WinStdioChardev;
|
||||
};
|
||||
typedef struct WinStdioChardev WinStdioChardev;
|
||||
|
||||
#define WIN_STDIO_CHARDEV(obj) \
|
||||
OBJECT_CHECK(WinStdioChardev, (obj), TYPE_CHARDEV_WIN_STDIO)
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
#define MUX_BUFFER_SIZE 32 /* Must be a power of 2. */
|
||||
#define MUX_BUFFER_MASK (MUX_BUFFER_SIZE - 1)
|
||||
|
||||
typedef struct MuxChardev {
|
||||
struct MuxChardev {
|
||||
Chardev parent;
|
||||
CharBackend *backends[MAX_MUX];
|
||||
CharBackend chr;
|
||||
@@ -51,7 +51,8 @@ typedef struct MuxChardev {
|
||||
/* Protected by the Chardev chr_write_lock. */
|
||||
int linestart;
|
||||
int64_t timestamps_start;
|
||||
} MuxChardev;
|
||||
};
|
||||
typedef struct MuxChardev MuxChardev;
|
||||
|
||||
#define MUX_CHARDEV(obj) OBJECT_CHECK(MuxChardev, (obj), TYPE_CHARDEV_MUX)
|
||||
#define CHARDEV_IS_MUX(chr) \
|
||||
|
||||
+4
-2
@@ -27,11 +27,12 @@
|
||||
#include "chardev/char.h"
|
||||
#include "ui/console.h"
|
||||
#include "ui/input.h"
|
||||
#include "qom/object.h"
|
||||
|
||||
#define MSMOUSE_LO6(n) ((n) & 0x3f)
|
||||
#define MSMOUSE_HI2(n) (((n) & 0xc0) >> 6)
|
||||
|
||||
typedef struct {
|
||||
struct MouseChardev {
|
||||
Chardev parent;
|
||||
|
||||
QemuInputHandlerState *hs;
|
||||
@@ -40,7 +41,8 @@ typedef struct {
|
||||
bool btnc[INPUT_BUTTON__MAX];
|
||||
uint8_t outbuf[32];
|
||||
int outlen;
|
||||
} MouseChardev;
|
||||
};
|
||||
typedef struct MouseChardev MouseChardev;
|
||||
|
||||
#define TYPE_CHARDEV_MSMOUSE "chardev-msmouse"
|
||||
#define MOUSE_CHARDEV(obj) \
|
||||
|
||||
+4
-2
@@ -27,15 +27,17 @@
|
||||
#include "qemu/osdep.h"
|
||||
#include "qemu/module.h"
|
||||
#include "chardev/char.h"
|
||||
#include "qom/object.h"
|
||||
|
||||
#define BUF_SIZE 32
|
||||
|
||||
typedef struct {
|
||||
struct TestdevChardev {
|
||||
Chardev parent;
|
||||
|
||||
uint8_t in_buf[32];
|
||||
int in_buf_used;
|
||||
} TestdevChardev;
|
||||
};
|
||||
typedef struct TestdevChardev TestdevChardev;
|
||||
|
||||
#define TYPE_CHARDEV_TESTDEV "chardev-testdev"
|
||||
#define TESTDEV_CHARDEV(obj) \
|
||||
|
||||
+4
-2
@@ -32,6 +32,7 @@
|
||||
#include "ui/console.h"
|
||||
#include "ui/input.h"
|
||||
#include "trace.h"
|
||||
#include "qom/object.h"
|
||||
|
||||
|
||||
#define WC_OUTPUT_BUF_MAX_LEN 512
|
||||
@@ -64,7 +65,7 @@ uint8_t WC_FULL_CONFIG_STRING[WC_FULL_CONFIG_STRING_LENGTH + 1] = {
|
||||
};
|
||||
|
||||
/* This structure is used to save private info for Wacom Tablet. */
|
||||
typedef struct {
|
||||
struct TabletChardev {
|
||||
Chardev parent;
|
||||
QemuInputHandlerState *hs;
|
||||
|
||||
@@ -81,7 +82,8 @@ typedef struct {
|
||||
int axis[INPUT_AXIS__MAX];
|
||||
bool btns[INPUT_BUTTON__MAX];
|
||||
|
||||
} TabletChardev;
|
||||
};
|
||||
typedef struct TabletChardev TabletChardev;
|
||||
|
||||
#define TYPE_CHARDEV_WCTABLET "chardev-wctablet"
|
||||
#define WCTABLET_CHARDEV(obj) \
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user