datapath: Use static where possible.
authorJesse Gross <jesse@nicira.com>
Sat, 4 Dec 2010 21:52:25 +0000 (13:52 -0800)
committerJesse Gross <jesse@nicira.com>
Fri, 10 Dec 2010 01:43:36 +0000 (17:43 -0800)
Mark functions and global variables used only in a single file as
static.

Found with sparse.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
datapath/datapath.c
datapath/dp_sysfs_dp.c
datapath/flow.c
datapath/tunnel.c

index c8b50889a4937e9cb6dc64b683f07718dabd4ce0..65d25c2a2f313c9ef7d5ba90baa194dbb717f327 100644 (file)
@@ -1838,8 +1838,8 @@ fault:
        return -EFAULT;
 }
 
-ssize_t openvswitch_read(struct file *f, char __user *buf, size_t nbytes,
-                     loff_t *ppos)
+static ssize_t openvswitch_read(struct file *f, char __user *buf,
+                               size_t nbytes, loff_t *ppos)
 {
        /* XXX is there sufficient synchronization here? */
        int listeners = get_listen_mask(f);
@@ -1941,7 +1941,7 @@ static unsigned int openvswitch_poll(struct file *file, poll_table *wait)
        return mask;
 }
 
-struct file_operations openvswitch_fops = {
+static struct file_operations openvswitch_fops = {
        /* XXX .aio_read = openvswitch_aio_read, */
        .read  = openvswitch_read,
        .poll  = openvswitch_poll,
index 413dfc31c232a3c2ddfc084ee99450e7fb8eae99..6cbd864180fb57b3eba5f7c9370888263892bb70 100644 (file)
@@ -43,7 +43,7 @@
 #define DEV_ATTR(NAME) dev_attr_##NAME
 #endif
 
-struct datapath *sysfs_get_dp(struct net_device *netdev)
+static struct datapath *sysfs_get_dp(struct net_device *netdev)
 {
        struct vport *vport = internal_dev_get_vport(netdev);
        return vport ? vport->dp : NULL;
index d30fb73fa21595a154112bdd527bd9ee51e20776..a3ed9e83310d3d92ea9f0b6a09d34c1b03cc5d09 100644 (file)
@@ -31,7 +31,7 @@
 
 #include "compat.h"
 
-struct kmem_cache *flow_cache;
+static struct kmem_cache *flow_cache;
 static unsigned int hash_seed __read_mostly;
 
 static inline bool arphdr_ok(struct sk_buff *skb)
index d8bcb0ff3bfc9579c2af11c648e46d4b996ae477..271651bfcbbfdfbf2859ff825fa3225c3265f361 100644 (file)
@@ -72,7 +72,7 @@
 static struct tbl *port_table __read_mostly;
 
 static void cache_cleaner(struct work_struct *work);
-DECLARE_DELAYED_WORK(cache_cleaner_wq, cache_cleaner);
+static DECLARE_DELAYED_WORK(cache_cleaner_wq, cache_cleaner);
 
 /*
  * These are just used as an optimization: they don't require any kind of