From 5953c70e61897996e8b05fadea988b3289e133de Mon Sep 17 00:00:00 2001 From: Jesse Gross Date: Thu, 10 Jun 2010 13:48:08 -0700 Subject: [PATCH] vport: Move 'extern' declarations of vports to header. Since vport implementations have no header files they needed to be declared as extern before being used. They are currently declared in vport.c but this isn't safe because the compiler will silently accept it if the type is incorrect. This moves those declarations into vport.h, which is included by all implementations and will cause errors about conflicting types if there is a mismatch. --- datapath/vport-gre.c | 2 -- datapath/vport-internal_dev.c | 2 -- datapath/vport-netdev.c | 2 -- datapath/vport-patch.c | 2 -- datapath/vport.c | 7 ++----- datapath/vport.h | 7 +++++++ 6 files changed, 9 insertions(+), 13 deletions(-) diff --git a/datapath/vport-gre.c b/datapath/vport-gre.c index 237835ba..cd0f3e8d 100644 --- a/datapath/vport-gre.c +++ b/datapath/vport-gre.c @@ -63,8 +63,6 @@ struct gre_vport { struct mutable_config *mutable; }; -struct vport_ops gre_vport_ops; - /* Protected by RCU. */ static struct tbl *port_table; diff --git a/datapath/vport-internal_dev.c b/datapath/vport-internal_dev.c index d8e57fef..eb7ddf96 100644 --- a/datapath/vport-internal_dev.c +++ b/datapath/vport-internal_dev.c @@ -40,8 +40,6 @@ struct internal_dev { struct pcpu_lstats extra_stats; }; -struct vport_ops internal_vport_ops; - static inline struct internal_dev *internal_dev_priv(struct net_device *netdev) { return netdev_priv(netdev); diff --git a/datapath/vport-netdev.c b/datapath/vport-netdev.c index 50c51ac0..8e7847ef 100644 --- a/datapath/vport-netdev.c +++ b/datapath/vport-netdev.c @@ -22,8 +22,6 @@ #include "compat.h" -struct vport_ops netdev_vport_ops; - static void netdev_port_receive(struct net_bridge_port *, struct sk_buff *); /* diff --git a/datapath/vport-patch.c b/datapath/vport-patch.c index 96e1a10f..ff94be00 100644 --- a/datapath/vport-patch.c +++ b/datapath/vport-patch.c @@ -35,8 +35,6 @@ struct patch_vport { struct device_config *devconf; }; -struct vport_ops patch_vport_ops; - /* Protected by RTNL lock. */ static struct hlist_head *peer_table; #define PEER_HASH_BUCKETS 256 diff --git a/datapath/vport.c b/datapath/vport.c index 83b42d55..1bd42431 100644 --- a/datapath/vport.c +++ b/datapath/vport.c @@ -19,11 +19,8 @@ #include "vport.h" #include "vport-internal_dev.h" -extern struct vport_ops netdev_vport_ops; -extern struct vport_ops internal_vport_ops; -extern struct vport_ops patch_vport_ops; -extern struct vport_ops gre_vport_ops; - +/* List of statically compiled vport implementations. Don't forget to also + * add yours to the list at the bottom of vport.h. */ static struct vport_ops *base_vport_ops_list[] = { &netdev_vport_ops, &internal_vport_ops, diff --git a/datapath/vport.h b/datapath/vport.h index e84c4e36..fc2c1761 100644 --- a/datapath/vport.h +++ b/datapath/vport.h @@ -237,4 +237,11 @@ vport_from_priv(const void *priv) void vport_receive(struct vport *, struct sk_buff *); void vport_record_error(struct vport *, enum vport_err_type err_type); +/* List of statically compiled vport implementations. Don't forget to also + * add yours to the list at the top of vport.c. */ +extern struct vport_ops netdev_vport_ops; +extern struct vport_ops internal_vport_ops; +extern struct vport_ops patch_vport_ops; +extern struct vport_ops gre_vport_ops; + #endif /* vport.h */ -- 2.30.2