diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2020-09-11 19:26:51 +0100 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2020-09-11 19:26:51 +0100 |
commit | f4ef8c9cc10b3bee829b9775879d4ff9f77c2442 (patch) | |
tree | 8245341c3ebfe98b9673bf7a8cb818b6d494c76f /net | |
parent | 2499453eb1cbb68a45d7562a180afd7659007fd4 (diff) | |
parent | b84bf23c88699098973de3bdec316c796f1b3794 (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 'net')
-rw-r--r-- | net/can/can_socketcan.c | 10 | ||||
-rw-r--r-- | net/colo-compare.c | 9 | ||||
-rw-r--r-- | net/dump.c | 7 | ||||
-rw-r--r-- | net/filter-buffer.c | 9 | ||||
-rw-r--r-- | net/filter-mirror.c | 17 | ||||
-rw-r--r-- | net/filter-replay.c | 7 | ||||
-rw-r--r-- | net/filter-rewriter.c | 27 |
7 files changed, 47 insertions, 39 deletions
diff --git a/net/can/can_socketcan.c b/net/can/can_socketcan.c index b7ef63ec0e..f933bd2db2 100644 --- a/net/can/can_socketcan.c +++ b/net/can/can_socketcan.c @@ -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); diff --git a/net/colo-compare.c b/net/colo-compare.c index 0b3215dee0..0b1201d2ba 100644 --- a/net/colo-compare.c +++ b/net/colo-compare.c @@ -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; diff --git a/net/dump.c b/net/dump.c index 11a737a4bc..42e64a6f29 100644 --- a/net/dump.c +++ b/net/dump.c @@ -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, diff --git a/net/filter-buffer.c b/net/filter-buffer.c index dfa211794b..6ade7a19b8 100644 --- a/net/filter-buffer.c +++ b/net/filter-buffer.c @@ -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) { diff --git a/net/filter-mirror.c b/net/filter-mirror.c index e9379ce248..088d4dcace 100644 --- a/net/filter-mirror.c +++ b/net/filter-mirror.c @@ -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, diff --git a/net/filter-replay.c b/net/filter-replay.c index 9dda193928..78696c162e 100644 --- a/net/filter-replay.c +++ b/net/filter-replay.c @@ -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, diff --git a/net/filter-rewriter.c b/net/filter-rewriter.c index 576b019d09..3070b6d59e 100644 --- a/net/filter-rewriter.c +++ b/net/filter-rewriter.c @@ -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; |