mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 08:13:54 -06:00
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) -----BEGIN PGP SIGNATURE----- iQJIBAABCAAyFiEEWjIv1avE09usz9GqKAeTb5hNxaYFAl9abc0UHGVoYWJrb3N0 QHJlZGhhdC5jb20ACgkQKAeTb5hNxaYU9Q/8CyK1w2SlItxBhos7zojqnZ9TP1Jt b1YCApQJ+bKSPAUDyefajQA0D9HeR9bFlreiOprQnmZWOqeOvnRIxNGvelJRqRRu KcIA5DIfVMJRkKJQEXairrGdnPmFLWSLEb7AmwxyAhp5G51PCP/3kbudi3T/vrNr OaccUejs5UgImPfO8Fm+0zqZPmblq/xmtU0p77FvDxGNFPPG8ddpu7eKksGD7FYd 5bTJTtUhONYG9EJMUD2TBxnJoy1pi6AYUu4+2T211RpBcxeiyNSSitI8fZTk6BGl 33VwQib9SXjGaE8VsSvHDHhLLec7sqqr2JH3rfvyKF6BOptKWzmSzFdbo2mrRkSy 8jfCImQgTBBMAHBWP+MFTeKuzfhikZx2DbBLzpppHMMvCca6Zc+oYgR2FbVwuPsw H2YL+8Wx4Ws6RXe147toNDRbv75vnS7F3fU800Pcur5VHJWTgSpT/tggzmVPWsdU GeUgceYlXyVk5/fC89ZhhtD9eurfBSzQR4eN7/nie2wD6PFMpZkOjHwLn40uWsyq xRO0F4uYghNU1N8z6NBhEYLTBtEcS1HFEisSLQrnTQH9W0I7mBx3MaZib/uK7NLC b2gT0hossTT8Z46Z8ynoZarwO5EquAMWEQtc9hfZGWacrQEpjVm2DMYMfu83krWb xhgl+mpKqVasAPk= =RjXc -----END PGP SIGNATURE----- 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>
This commit is contained in:
commit
f4ef8c9cc1
827 changed files with 7851 additions and 4406 deletions
|
@ -40,17 +40,19 @@
|
|||
#include <net/if.h>
|
||||
#include <linux/can.h>
|
||||
#include <linux/can/raw.h>
|
||||
#include "qom/object.h"
|
||||
|
||||
#ifndef DEBUG_CAN
|
||||
#define DEBUG_CAN 0
|
||||
#endif /*DEBUG_CAN*/
|
||||
|
||||
#define TYPE_CAN_HOST_SOCKETCAN "can-host-socketcan"
|
||||
#define CAN_HOST_SOCKETCAN(obj) \
|
||||
OBJECT_CHECK(CanHostSocketCAN, (obj), TYPE_CAN_HOST_SOCKETCAN)
|
||||
typedef struct CanHostSocketCAN CanHostSocketCAN;
|
||||
DECLARE_INSTANCE_CHECKER(CanHostSocketCAN, CAN_HOST_SOCKETCAN,
|
||||
TYPE_CAN_HOST_SOCKETCAN)
|
||||
|
||||
#define CAN_READ_BUF_LEN 5
|
||||
typedef struct CanHostSocketCAN {
|
||||
struct CanHostSocketCAN {
|
||||
CanHostState parent;
|
||||
char *ifname;
|
||||
|
||||
|
@ -63,7 +65,7 @@ typedef struct CanHostSocketCAN {
|
|||
int bufptr;
|
||||
|
||||
int fd;
|
||||
} CanHostSocketCAN;
|
||||
};
|
||||
|
||||
/* Check that QEMU and Linux kernel flags encoding and structure matches */
|
||||
QEMU_BUILD_BUG_ON(QEMU_CAN_EFF_FLAG != CAN_EFF_FLAG);
|
||||
|
|
|
@ -36,8 +36,9 @@
|
|||
#include "qemu/coroutine.h"
|
||||
|
||||
#define TYPE_COLO_COMPARE "colo-compare"
|
||||
#define COLO_COMPARE(obj) \
|
||||
OBJECT_CHECK(CompareState, (obj), TYPE_COLO_COMPARE)
|
||||
typedef struct CompareState CompareState;
|
||||
DECLARE_INSTANCE_CHECKER(CompareState, COLO_COMPARE,
|
||||
TYPE_COLO_COMPARE)
|
||||
|
||||
static QTAILQ_HEAD(, CompareState) net_compares =
|
||||
QTAILQ_HEAD_INITIALIZER(net_compares);
|
||||
|
@ -102,7 +103,7 @@ typedef struct SendEntry {
|
|||
uint8_t *buf;
|
||||
} SendEntry;
|
||||
|
||||
typedef struct CompareState {
|
||||
struct CompareState {
|
||||
Object parent;
|
||||
|
||||
char *pri_indev;
|
||||
|
@ -138,7 +139,7 @@ typedef struct CompareState {
|
|||
enum colo_event event;
|
||||
|
||||
QTAILQ_ENTRY(CompareState) next;
|
||||
} CompareState;
|
||||
};
|
||||
|
||||
typedef struct CompareClass {
|
||||
ObjectClass parent_class;
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include "qemu/timer.h"
|
||||
#include "qapi/visitor.h"
|
||||
#include "net/filter.h"
|
||||
#include "qom/object.h"
|
||||
|
||||
typedef struct DumpState {
|
||||
int64_t start_ts;
|
||||
|
@ -139,8 +140,9 @@ static int net_dump_state_init(DumpState *s, const char *filename,
|
|||
|
||||
#define TYPE_FILTER_DUMP "filter-dump"
|
||||
|
||||
#define FILTER_DUMP(obj) \
|
||||
OBJECT_CHECK(NetFilterDumpState, (obj), TYPE_FILTER_DUMP)
|
||||
typedef struct NetFilterDumpState NetFilterDumpState;
|
||||
DECLARE_INSTANCE_CHECKER(NetFilterDumpState, FILTER_DUMP,
|
||||
TYPE_FILTER_DUMP)
|
||||
|
||||
struct NetFilterDumpState {
|
||||
NetFilterState nfs;
|
||||
|
@ -148,7 +150,6 @@ struct NetFilterDumpState {
|
|||
char *filename;
|
||||
uint32_t maxlen;
|
||||
};
|
||||
typedef struct NetFilterDumpState NetFilterDumpState;
|
||||
|
||||
static ssize_t filter_dump_receive_iov(NetFilterState *nf, NetClientState *sndr,
|
||||
unsigned flags, const struct iovec *iov,
|
||||
|
|
|
@ -18,16 +18,17 @@
|
|||
|
||||
#define TYPE_FILTER_BUFFER "filter-buffer"
|
||||
|
||||
#define FILTER_BUFFER(obj) \
|
||||
OBJECT_CHECK(FilterBufferState, (obj), TYPE_FILTER_BUFFER)
|
||||
typedef struct FilterBufferState FilterBufferState;
|
||||
DECLARE_INSTANCE_CHECKER(FilterBufferState, FILTER_BUFFER,
|
||||
TYPE_FILTER_BUFFER)
|
||||
|
||||
typedef struct FilterBufferState {
|
||||
struct FilterBufferState {
|
||||
NetFilterState parent_obj;
|
||||
|
||||
NetQueue *incoming_queue;
|
||||
uint32_t interval;
|
||||
QEMUTimer release_timer;
|
||||
} FilterBufferState;
|
||||
};
|
||||
|
||||
static void filter_buffer_flush(NetFilterState *nf)
|
||||
{
|
||||
|
|
|
@ -21,17 +21,18 @@
|
|||
#include "qemu/iov.h"
|
||||
#include "qemu/sockets.h"
|
||||
|
||||
#define FILTER_MIRROR(obj) \
|
||||
OBJECT_CHECK(MirrorState, (obj), TYPE_FILTER_MIRROR)
|
||||
|
||||
#define FILTER_REDIRECTOR(obj) \
|
||||
OBJECT_CHECK(MirrorState, (obj), TYPE_FILTER_REDIRECTOR)
|
||||
|
||||
#define TYPE_FILTER_MIRROR "filter-mirror"
|
||||
typedef struct MirrorState MirrorState;
|
||||
DECLARE_INSTANCE_CHECKER(MirrorState, FILTER_MIRROR,
|
||||
TYPE_FILTER_MIRROR)
|
||||
|
||||
#define TYPE_FILTER_REDIRECTOR "filter-redirector"
|
||||
DECLARE_INSTANCE_CHECKER(MirrorState, FILTER_REDIRECTOR,
|
||||
TYPE_FILTER_REDIRECTOR)
|
||||
|
||||
#define REDIRECTOR_MAX_LEN NET_BUFSIZE
|
||||
|
||||
typedef struct MirrorState {
|
||||
struct MirrorState {
|
||||
NetFilterState parent_obj;
|
||||
char *indev;
|
||||
char *outdev;
|
||||
|
@ -39,7 +40,7 @@ typedef struct MirrorState {
|
|||
CharBackend chr_out;
|
||||
SocketReadState rs;
|
||||
bool vnet_hdr;
|
||||
} MirrorState;
|
||||
};
|
||||
|
||||
static int filter_send(MirrorState *s,
|
||||
const struct iovec *iov,
|
||||
|
|
|
@ -19,17 +19,18 @@
|
|||
#include "qapi/visitor.h"
|
||||
#include "net/filter.h"
|
||||
#include "sysemu/replay.h"
|
||||
#include "qom/object.h"
|
||||
|
||||
#define TYPE_FILTER_REPLAY "filter-replay"
|
||||
|
||||
#define FILTER_REPLAY(obj) \
|
||||
OBJECT_CHECK(NetFilterReplayState, (obj), TYPE_FILTER_REPLAY)
|
||||
typedef struct NetFilterReplayState NetFilterReplayState;
|
||||
DECLARE_INSTANCE_CHECKER(NetFilterReplayState, FILTER_REPLAY,
|
||||
TYPE_FILTER_REPLAY)
|
||||
|
||||
struct NetFilterReplayState {
|
||||
NetFilterState nfs;
|
||||
ReplayNetState *rns;
|
||||
};
|
||||
typedef struct NetFilterReplayState NetFilterReplayState;
|
||||
|
||||
static ssize_t filter_replay_receive_iov(NetFilterState *nf,
|
||||
NetClientState *sndr,
|
||||
|
|
|
@ -23,21 +23,22 @@
|
|||
#include "migration/colo.h"
|
||||
#include "util.h"
|
||||
|
||||
#define FILTER_COLO_REWRITER(obj) \
|
||||
OBJECT_CHECK(RewriterState, (obj), TYPE_FILTER_REWRITER)
|
||||
|
||||
#define TYPE_FILTER_REWRITER "filter-rewriter"
|
||||
typedef struct RewriterState RewriterState;
|
||||
DECLARE_INSTANCE_CHECKER(RewriterState, FILTER_REWRITER,
|
||||
TYPE_FILTER_REWRITER)
|
||||
|
||||
#define FAILOVER_MODE_ON true
|
||||
#define FAILOVER_MODE_OFF false
|
||||
|
||||
typedef struct RewriterState {
|
||||
struct RewriterState {
|
||||
NetFilterState parent_obj;
|
||||
NetQueue *incoming_queue;
|
||||
/* hashtable to save connection */
|
||||
GHashTable *connection_track_table;
|
||||
bool vnet_hdr;
|
||||
bool failover_mode;
|
||||
} RewriterState;
|
||||
};
|
||||
|
||||
static void filter_rewriter_failover_mode(RewriterState *s)
|
||||
{
|
||||
|
@ -46,7 +47,7 @@ static void filter_rewriter_failover_mode(RewriterState *s)
|
|||
|
||||
static void filter_rewriter_flush(NetFilterState *nf)
|
||||
{
|
||||
RewriterState *s = FILTER_COLO_REWRITER(nf);
|
||||
RewriterState *s = FILTER_REWRITER(nf);
|
||||
|
||||
if (!qemu_net_queue_flush(s->incoming_queue)) {
|
||||
/* Unable to empty the queue, purge remaining packets */
|
||||
|
@ -257,7 +258,7 @@ static ssize_t colo_rewriter_receive_iov(NetFilterState *nf,
|
|||
int iovcnt,
|
||||
NetPacketSent *sent_cb)
|
||||
{
|
||||
RewriterState *s = FILTER_COLO_REWRITER(nf);
|
||||
RewriterState *s = FILTER_REWRITER(nf);
|
||||
Connection *conn;
|
||||
ConnectionKey key;
|
||||
Packet *pkt;
|
||||
|
@ -355,7 +356,7 @@ static gboolean offset_is_nonzero(gpointer key,
|
|||
static void colo_rewriter_handle_event(NetFilterState *nf, int event,
|
||||
Error **errp)
|
||||
{
|
||||
RewriterState *rs = FILTER_COLO_REWRITER(nf);
|
||||
RewriterState *rs = FILTER_REWRITER(nf);
|
||||
|
||||
switch (event) {
|
||||
case COLO_EVENT_CHECKPOINT:
|
||||
|
@ -375,7 +376,7 @@ static void colo_rewriter_handle_event(NetFilterState *nf, int event,
|
|||
|
||||
static void colo_rewriter_cleanup(NetFilterState *nf)
|
||||
{
|
||||
RewriterState *s = FILTER_COLO_REWRITER(nf);
|
||||
RewriterState *s = FILTER_REWRITER(nf);
|
||||
|
||||
/* flush packets */
|
||||
if (s->incoming_queue) {
|
||||
|
@ -386,7 +387,7 @@ static void colo_rewriter_cleanup(NetFilterState *nf)
|
|||
|
||||
static void colo_rewriter_setup(NetFilterState *nf, Error **errp)
|
||||
{
|
||||
RewriterState *s = FILTER_COLO_REWRITER(nf);
|
||||
RewriterState *s = FILTER_REWRITER(nf);
|
||||
|
||||
s->connection_track_table = g_hash_table_new_full(connection_key_hash,
|
||||
connection_key_equal,
|
||||
|
@ -397,7 +398,7 @@ static void colo_rewriter_setup(NetFilterState *nf, Error **errp)
|
|||
|
||||
static bool filter_rewriter_get_vnet_hdr(Object *obj, Error **errp)
|
||||
{
|
||||
RewriterState *s = FILTER_COLO_REWRITER(obj);
|
||||
RewriterState *s = FILTER_REWRITER(obj);
|
||||
|
||||
return s->vnet_hdr;
|
||||
}
|
||||
|
@ -406,14 +407,14 @@ static void filter_rewriter_set_vnet_hdr(Object *obj,
|
|||
bool value,
|
||||
Error **errp)
|
||||
{
|
||||
RewriterState *s = FILTER_COLO_REWRITER(obj);
|
||||
RewriterState *s = FILTER_REWRITER(obj);
|
||||
|
||||
s->vnet_hdr = value;
|
||||
}
|
||||
|
||||
static void filter_rewriter_init(Object *obj)
|
||||
{
|
||||
RewriterState *s = FILTER_COLO_REWRITER(obj);
|
||||
RewriterState *s = FILTER_REWRITER(obj);
|
||||
|
||||
s->vnet_hdr = false;
|
||||
s->failover_mode = FAILOVER_MODE_OFF;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue