vport: Move 'extern' declarations of vports to header.
authorJesse Gross <jesse@nicira.com>
Thu, 10 Jun 2010 20:48:08 +0000 (13:48 -0700)
committerJesse Gross <jesse@nicira.com>
Thu, 10 Jun 2010 21:29:30 +0000 (14:29 -0700)
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
datapath/vport-internal_dev.c
datapath/vport-netdev.c
datapath/vport-patch.c
datapath/vport.c
datapath/vport.h

index 237835b..cd0f3e8 100644 (file)
@@ -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;
 
index d8e57fe..eb7ddf9 100644 (file)
@@ -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);
index 50c51ac..8e7847e 100644 (file)
@@ -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 *);
 
 /*
index 96e1a10..ff94be0 100644 (file)
@@ -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
index 83b42d5..1bd4243 100644 (file)
 #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,
index e84c4e3..fc2c176 100644 (file)
@@ -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 */