summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorEduardo Habkost <ehabkost@redhat.com>2020-09-03 16:43:22 -0400
committerEduardo Habkost <ehabkost@redhat.com>2020-09-09 09:26:43 -0400
commitdb1015e92e04835c9eb50c29625fe566d1202dbd (patch)
tree41fbc0bf3e3f29b7ecb339224a049e3f2a7db8fa /net
parent1c8eef0227e2942264063f22f10a06b84e0d3fa9 (diff)
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>
Diffstat (limited to 'net')
-rw-r--r--net/can/can_socketcan.c6
-rw-r--r--net/colo-compare.c5
-rw-r--r--net/dump.c3
-rw-r--r--net/filter-buffer.c5
-rw-r--r--net/filter-mirror.c9
-rw-r--r--net/filter-replay.c3
-rw-r--r--net/filter-rewriter.c7
7 files changed, 23 insertions, 15 deletions
diff --git a/net/can/can_socketcan.c b/net/can/can_socketcan.c
index b7ef63ec0e..0082aa6c3e 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"
+typedef struct CanHostSocketCAN CanHostSocketCAN;
#define CAN_HOST_SOCKETCAN(obj) \
OBJECT_CHECK(CanHostSocketCAN, (obj), 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 2c20de1537..be3ca5f8c5 100644
--- a/net/colo-compare.c
+++ b/net/colo-compare.c
@@ -36,6 +36,7 @@
#include "qemu/coroutine.h"
#define TYPE_COLO_COMPARE "colo-compare"
+typedef struct CompareState CompareState;
#define COLO_COMPARE(obj) \
OBJECT_CHECK(CompareState, (obj), TYPE_COLO_COMPARE)
@@ -100,7 +101,7 @@ typedef struct SendEntry {
uint8_t *buf;
} SendEntry;
-typedef struct CompareState {
+struct CompareState {
Object parent;
char *pri_indev;
@@ -136,7 +137,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..454672d73d 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,6 +140,7 @@ static int net_dump_state_init(DumpState *s, const char *filename,
#define TYPE_FILTER_DUMP "filter-dump"
+typedef struct NetFilterDumpState NetFilterDumpState;
#define FILTER_DUMP(obj) \
OBJECT_CHECK(NetFilterDumpState, (obj), TYPE_FILTER_DUMP)
@@ -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..78f7f0b36b 100644
--- a/net/filter-buffer.c
+++ b/net/filter-buffer.c
@@ -18,16 +18,17 @@
#define TYPE_FILTER_BUFFER "filter-buffer"
+typedef struct FilterBufferState FilterBufferState;
#define FILTER_BUFFER(obj) \
OBJECT_CHECK(FilterBufferState, (obj), 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..3fd3b90d1d 100644
--- a/net/filter-mirror.c
+++ b/net/filter-mirror.c
@@ -21,17 +21,18 @@
#include "qemu/iov.h"
#include "qemu/sockets.h"
+#define TYPE_FILTER_MIRROR "filter-mirror"
+typedef struct MirrorState MirrorState;
#define FILTER_MIRROR(obj) \
OBJECT_CHECK(MirrorState, (obj), TYPE_FILTER_MIRROR)
+#define TYPE_FILTER_REDIRECTOR "filter-redirector"
#define FILTER_REDIRECTOR(obj) \
OBJECT_CHECK(MirrorState, (obj), TYPE_FILTER_REDIRECTOR)
-#define TYPE_FILTER_MIRROR "filter-mirror"
-#define TYPE_FILTER_REDIRECTOR "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..a0b99aaf86 100644
--- a/net/filter-replay.c
+++ b/net/filter-replay.c
@@ -19,9 +19,11 @@
#include "qapi/visitor.h"
#include "net/filter.h"
#include "sysemu/replay.h"
+#include "qom/object.h"
#define TYPE_FILTER_REPLAY "filter-replay"
+typedef struct NetFilterReplayState NetFilterReplayState;
#define FILTER_REPLAY(obj) \
OBJECT_CHECK(NetFilterReplayState, (obj), TYPE_FILTER_REPLAY)
@@ -29,7 +31,6 @@ 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 1aaad101b6..c28d959942 100644
--- a/net/filter-rewriter.c
+++ b/net/filter-rewriter.c
@@ -23,21 +23,22 @@
#include "migration/colo.h"
#include "util.h"
+#define TYPE_FILTER_REWRITER "filter-rewriter"
+typedef struct RewriterState RewriterState;
#define FILTER_COLO_REWRITER(obj) \
OBJECT_CHECK(RewriterState, (obj), TYPE_FILTER_REWRITER)
-#define TYPE_FILTER_REWRITER "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)
{