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 c8b5088..65d25c2 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 413dfc3..6cbd864 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 d30fb73..a3ed9e8 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 d8bcb0f..271651b 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