Skip to contentSkip to conversation

rocker: fix clang compiler errors

PATCH Applied David Ahern 3 participants 3 messages Mar 7, 2015 – Mar 12, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rocker: fix clang compiler errors

Consolidate all forward typedef declarations to rocker.h.

---
 hw/net/rocker/rocker.c        |  4 ++--
 hw/net/rocker/rocker.h        |  7 +++----
 hw/net/rocker/rocker_desc.c   | 10 ++++------
 hw/net/rocker/rocker_desc.h   |  4 ----
 hw/net/rocker/rocker_fp.c     |  4 ++--
 hw/net/rocker/rocker_fp.h     |  2 --
 hw/net/rocker/rocker_of_dpa.h |  3 ---
 hw/net/rocker/rocker_world.c  |  6 ++----
 hw/net/rocker/rocker_world.h  |  7 ++-----
 9 files changed, 15 insertions(+), 32 deletions(-)
hw/net/rocker/rocker.c +2 -2
index 41052750a434..de0f7b96c54e 100644
@@ -32,7 +32,7 @@
 #include "rocker_world.h"
 #include "rocker_of_dpa.h"
 
-typedef struct rocker {
+struct rocker {
     /* private */
     PCIDevice parent_obj;
     /* public */
@@ -65,7 +65,7 @@ typedef struct rocker {
     World *world_dflt;
 
     QLIST_ENTRY(rocker) next;
-} Rocker;
+};
 
 #define ROCKER "rocker"
 
hw/net/rocker/rocker.h +3 -4
index 656d7226746b..b3310b61ebc2 100644
@@ -21,8 +21,6 @@
 
 #include "qemu/sockets.h"
 
-#include "rocker_world.h"
-
 #if defined(DEBUG_ROCKER)
 #  define DPRINTF(fmt, ...) \
     do {                                                           \
@@ -68,11 +66,12 @@ static inline bool ipv6_addr_is_multicast(const Ipv6Addr *addr)
     return (addr->addr32[0] & htonl(0xFF000000)) == htonl(0xFF000000);
 }
 
-typedef struct world World;
 typedef struct rocker Rocker;
+typedef struct world World;
+typedef struct desc_info DescInfo;
+typedef struct desc_ring DescRing;
 
 Rocker *rocker_find(const char *name);
-World *rocker_get_world(Rocker *r, enum rocker_world_type type);
 uint32_t rocker_fp_ports(Rocker *r);
 int rocker_event_link_changed(Rocker *r, uint32_t pport, bool link_up);
 int rocker_event_mac_vlan_seen(Rocker *r, uint32_t pport, uint8_t *addr,
hw/net/rocker/rocker_desc.c +4 -6
index 0a6dfae63b26..9d896fe470d8 100644
@@ -22,9 +22,7 @@
 #include "rocker_hw.h"
 #include "rocker_desc.h"
 
-typedef struct desc_info DescInfo;
-
-typedef struct desc_ring {
+struct desc_ring {
     hwaddr base_addr;
     uint32_t size;
     uint32_t head;
@@ -36,14 +34,14 @@ typedef struct desc_ring {
     int index;
     desc_ring_consume *consume;
     unsigned msix_vector;
-} DescRing;
+};
 
-typedef struct desc_info {
+struct desc_info {
     DescRing *ring;
     RockerDesc desc;
     char *buf;
     size_t buf_size;
-} DescInfo;
+};
 
 uint16_t desc_buf_size(DescInfo *info)
 {
hw/net/rocker/rocker_desc.h +0 -4
index 0b57ba75275e..d4041f5c4c58 100644
@@ -20,10 +20,6 @@
 
 #include "rocker_hw.h"
 
-typedef struct rocker Rocker;
-typedef struct desc_ring DescRing;
-typedef struct desc_info DescInfo;
-
 typedef int (desc_ring_consume)(Rocker *r, DescInfo *info);
 
 uint16_t desc_buf_size(DescInfo *info);
hw/net/rocker/rocker_fp.c +2 -2
index 75513309f9a3..2f1e3b348a52 100644
@@ -26,7 +26,7 @@ enum duplex {
     DUPLEX_FULL
 };
 
-typedef struct fp_port {
+struct fp_port {
     Rocker *r;
     World *world;
     unsigned int index;
@@ -39,7 +39,7 @@ typedef struct fp_port {
     uint8_t learning;
     NICState *nic;
     NICConf conf;
-} FpPort;
+};
 
 bool fp_port_get_link_up(FpPort *port)
 {
hw/net/rocker/rocker_fp.h +0 -2
index eb67c64abeec..a5f28f120d5a 100644
@@ -22,9 +22,7 @@
 
 #define ROCKER_FP_PORTS_MAX 62
 
-typedef struct rocker Rocker;
 typedef struct fp_port FpPort;
-typedef struct world World;
 
 int fp_port_eg(FpPort *port, const struct iovec *iov, int iovcnt);
 
hw/net/rocker/rocker_of_dpa.h +0 -3
index 0af479085fa7..f3f6d77807a6 100644
@@ -17,9 +17,6 @@
 #ifndef _ROCKER_OF_DPA_H_
 #define _ROCKER_OF_DPA_H_
 
-typedef struct rocker Rocker;
-typedef struct world World;
-
 World *of_dpa_world_alloc(Rocker *r);
 
 #endif /* _ROCKER_OF_DPA_H_ */
hw/net/rocker/rocker_world.c +2 -4
index a21829071fbc..b991e871d3b6 100644
@@ -19,13 +19,11 @@
 #include "rocker.h"
 #include "rocker_world.h"
 
-typedef struct rocker Rocker;
-
-typedef struct world {
+struct world {
     Rocker *r;
     enum rocker_world_type type;
     WorldOps *ops;
-} World;
+};
 
 ssize_t world_ingress(World *world, uint32_t pport,
                       const struct iovec *iov, int iovcnt)
hw/net/rocker/rocker_world.h +2 -5
index a84419884c73..18d277b92720 100644
@@ -19,11 +19,6 @@
 
 #include "rocker_hw.h"
 
-typedef struct world World;
-typedef struct rocker Rocker;
-typedef struct rocker_tlv RockerTlv;
-typedef struct desc_info DescInfo;
-
 enum rocker_world_type {
     ROCKER_WORLD_TYPE_OF_DPA = ROCKER_PORT_MODE_OF_DPA,
     ROCKER_WORLD_TYPE_MAX,
@@ -60,4 +55,6 @@ Rocker *world_rocker(World *world);
 enum rocker_world_type world_type(World *world);
 const char *world_name(World *world);
 
+World *rocker_get_world(Rocker *r, enum rocker_world_type type);
+
 #endif /* _ROCKER_WORLD_H_ */
Signature · 1 line
2.1.0
#2 lore raw
In reply to David Ahern
Quoted 4 lines · David Ahern

Consolidate all forward typedef declarations to rocker.h.

Quoted 11 lines
---
 hw/net/rocker/rocker.c        |  4 ++--
 hw/net/rocker/rocker.h        |  7 +++----
 hw/net/rocker/rocker_desc.c   | 10 ++++------
 hw/net/rocker/rocker_desc.h   |  4 ----
 hw/net/rocker/rocker_fp.c     |  4 ++--
 hw/net/rocker/rocker_fp.h     |  2 --
 hw/net/rocker/rocker_of_dpa.h |  3 ---
 hw/net/rocker/rocker_world.c  |  6 ++----
 hw/net/rocker/rocker_world.h  |  7 ++-----
 9 files changed, 15 insertions(+), 32 deletions(-)

I've squashed this into "rocker: add new rocker switch device" so that git-bisect(1) does not see the source tree in a state where builds fail.

Thanks, applied to my net tree:
https://github.com/stefanha/qemu/commits/net

Stefan