aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesse Gross <jesse@nicira.com>2010-06-10 13:48:08 -0700
committerJesse Gross <jesse@nicira.com>2010-06-10 14:29:30 -0700
commit5953c70e61897996e8b05fadea988b3289e133de (patch)
tree1031b3816798a28a4ec38449c5c12b177b37f33e
parent61e89cd6d688b8ea2368a815dbe3516d731e77f0 (diff)
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.
-rw-r--r--datapath/vport-gre.c2
-rw-r--r--datapath/vport-internal_dev.c2
-rw-r--r--datapath/vport-netdev.c2
-rw-r--r--datapath/vport-patch.c2
-rw-r--r--datapath/vport.c7
-rw-r--r--datapath/vport.h7
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 */