From: Jesse Gross Date: Sat, 4 Dec 2010 21:52:25 +0000 (-0800) Subject: datapath: Use static where possible. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=33b38b63e42c1f5aa80d1d7b4ce79cfbe371fae3;p=openvswitch datapath: Use static where possible. Mark functions and global variables used only in a single file as static. Found with sparse. Signed-off-by: Jesse Gross Acked-by: Ben Pfaff --- diff --git a/datapath/datapath.c b/datapath/datapath.c index c8b50889..65d25c2a 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 413dfc31..6cbd8641 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 d30fb73f..a3ed9e83 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 d8bcb0ff..271651bf 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