[ovs-dev] [PATCH 12/19] datapath: Use static where possible.

Jesse Gross jesse at nicira.com
Thu Dec 9 06:14:10 UTC 2010


Mark functions and global variables used only in a single file as
static.

Found with sparse.

Signed-off-by: Jesse Gross <jesse at nicira.com>
---
 datapath/datapath.c    |    6 +++---
 datapath/dp_sysfs_dp.c |    2 +-
 datapath/flow.c        |    2 +-
 datapath/tunnel.c      |    2 +-
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/datapath/datapath.c b/datapath/datapath.c
index c8b5088..65d25c2 100644
--- a/datapath/datapath.c
+++ b/datapath/datapath.c
@@ -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,
diff --git a/datapath/dp_sysfs_dp.c b/datapath/dp_sysfs_dp.c
index 413dfc3..6cbd864 100644
--- a/datapath/dp_sysfs_dp.c
+++ b/datapath/dp_sysfs_dp.c
@@ -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;
diff --git a/datapath/flow.c b/datapath/flow.c
index d30fb73..a3ed9e8 100644
--- a/datapath/flow.c
+++ b/datapath/flow.c
@@ -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)
diff --git a/datapath/tunnel.c b/datapath/tunnel.c
index 387597f..f5afe0b 100644
--- a/datapath/tunnel.c
+++ b/datapath/tunnel.c
@@ -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
-- 
1.7.1





More information about the dev mailing list