提交 42fa1b92 编写于 作者: S Sven Eckelmann 提交者: Greg Kroah-Hartman

Staging: batman-adv: Mark locally used symbols as static

Functions and variables which are used only inside one object file can
be declared as static. This helped to find unused functions/variables

 * mainIfAddr_default
 * main_if_was_up

and functions with declarations but missing definitions

 * hash_debug
 * orig_find
 * send_own_packet_work
Signed-off-by: NSven Eckelmann <sven.eckelmann@gmx.de>
Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
上级 516c9a77
...@@ -63,7 +63,7 @@ void bit_mark(TYPE_OF_WORD *seq_bits, int32_t n) ...@@ -63,7 +63,7 @@ void bit_mark(TYPE_OF_WORD *seq_bits, int32_t n)
} }
/* shift the packet array by n places. */ /* shift the packet array by n places. */
void bit_shift(TYPE_OF_WORD *seq_bits, int32_t n) static void bit_shift(TYPE_OF_WORD *seq_bits, int32_t n)
{ {
int32_t word_offset, word_num; int32_t word_offset, word_num;
int32_t i; int32_t i;
......
...@@ -32,9 +32,6 @@ uint8_t get_bit_status(TYPE_OF_WORD *seq_bits, uint16_t last_seqno, ...@@ -32,9 +32,6 @@ uint8_t get_bit_status(TYPE_OF_WORD *seq_bits, uint16_t last_seqno,
/* turn corresponding bit on, so we can remember that we got the packet */ /* turn corresponding bit on, so we can remember that we got the packet */
void bit_mark(TYPE_OF_WORD *seq_bits, int32_t n); void bit_mark(TYPE_OF_WORD *seq_bits, int32_t n);
/* shift the packet array by n places. */
void bit_shift(TYPE_OF_WORD *seq_bits, int32_t n);
/* receive and process one packet, returns 1 if received seq_num is considered /* receive and process one packet, returns 1 if received seq_num is considered
* new, 0 if old */ * new, 0 if old */
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
#include "hash.h" #include "hash.h"
/* clears the hash */ /* clears the hash */
void hash_init(struct hashtable_t *hash) static void hash_init(struct hashtable_t *hash)
{ {
int i; int i;
......
...@@ -56,9 +56,6 @@ struct hashtable_t { ...@@ -56,9 +56,6 @@ struct hashtable_t {
* argument and the size the second */ * argument and the size the second */
}; };
/* clears the hash */
void hash_init(struct hashtable_t *hash);
/* allocates and clears the hash */ /* allocates and clears the hash */
struct hashtable_t *hash_new(int size, hashdata_compare_cb compare, struct hashtable_t *hash_new(int size, hashdata_compare_cb compare,
hashdata_choose_cb choose); hashdata_choose_cb choose);
...@@ -98,7 +95,4 @@ struct hashtable_t *hash_resize(struct hashtable_t *hash, int size); ...@@ -98,7 +95,4 @@ struct hashtable_t *hash_resize(struct hashtable_t *hash, int size);
* the returned iterator to access the elements until hash_it_t returns NULL. */ * the returned iterator to access the elements until hash_it_t returns NULL. */
struct hash_it_t *hash_iterate(struct hashtable_t *hash, struct hash_it_t *hash_iterate(struct hashtable_t *hash,
struct hash_it_t *iter_in); struct hash_it_t *iter_in);
/* print the hash table for debugging */
void hash_debug(struct hashtable_t *hash);
#endif #endif
...@@ -56,21 +56,6 @@ int originator_init(void) ...@@ -56,21 +56,6 @@ int originator_init(void)
return 0; return 0;
} }
void originator_free(void)
{
unsigned long flags;
if (!orig_hash)
return;
cancel_delayed_work_sync(&purge_orig_wq);
spin_lock_irqsave(&orig_hash_lock, flags);
hash_delete(orig_hash, free_orig_node);
orig_hash = NULL;
spin_unlock_irqrestore(&orig_hash_lock, flags);
}
struct neigh_node * struct neigh_node *
create_neighbor(struct orig_node *orig_node, struct orig_node *orig_neigh_node, create_neighbor(struct orig_node *orig_node, struct orig_node *orig_neigh_node,
uint8_t *neigh, struct batman_if *if_incoming) uint8_t *neigh, struct batman_if *if_incoming)
...@@ -93,7 +78,7 @@ create_neighbor(struct orig_node *orig_node, struct orig_node *orig_neigh_node, ...@@ -93,7 +78,7 @@ create_neighbor(struct orig_node *orig_node, struct orig_node *orig_neigh_node,
return neigh_node; return neigh_node;
} }
void free_orig_node(void *data) static void free_orig_node(void *data)
{ {
struct list_head *list_pos, *list_pos_tmp; struct list_head *list_pos, *list_pos_tmp;
struct neigh_node *neigh_node; struct neigh_node *neigh_node;
...@@ -114,6 +99,21 @@ void free_orig_node(void *data) ...@@ -114,6 +99,21 @@ void free_orig_node(void *data)
kfree(orig_node); kfree(orig_node);
} }
void originator_free(void)
{
unsigned long flags;
if (!orig_hash)
return;
cancel_delayed_work_sync(&purge_orig_wq);
spin_lock_irqsave(&orig_hash_lock, flags);
hash_delete(orig_hash, free_orig_node);
orig_hash = NULL;
spin_unlock_irqrestore(&orig_hash_lock, flags);
}
/* this function finds or creates an originator entry for the given /* this function finds or creates an originator entry for the given
* address if it does not exits */ * address if it does not exits */
struct orig_node *get_orig_node(uint8_t *addr) struct orig_node *get_orig_node(uint8_t *addr)
......
...@@ -20,10 +20,8 @@ ...@@ -20,10 +20,8 @@
*/ */
int originator_init(void); int originator_init(void);
void free_orig_node(void *data);
void originator_free(void); void originator_free(void);
void purge_orig(struct work_struct *work); void purge_orig(struct work_struct *work);
struct orig_node *orig_find(char *mac);
struct orig_node *get_orig_node(uint8_t *addr); struct orig_node *get_orig_node(uint8_t *addr);
struct neigh_node * struct neigh_node *
create_neighbor(struct orig_node *orig_node, struct orig_node *orig_neigh_node, create_neighbor(struct orig_node *orig_node, struct orig_node *orig_neigh_node,
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
#include "vis.h" #include "vis.h"
#include "aggregation.h" #include "aggregation.h"
DECLARE_WAIT_QUEUE_HEAD(thread_wait); static DECLARE_WAIT_QUEUE_HEAD(thread_wait);
void slide_own_bcast_window(struct batman_if *batman_if) void slide_own_bcast_window(struct batman_if *batman_if)
{ {
......
...@@ -21,8 +21,6 @@ ...@@ -21,8 +21,6 @@
#include "types.h" #include "types.h"
extern wait_queue_head_t thread_wait;
void slide_own_bcast_window(struct batman_if *batman_if); void slide_own_bcast_window(struct batman_if *batman_if);
void receive_bat_packet(struct ethhdr *ethhdr, void receive_bat_packet(struct ethhdr *ethhdr,
struct batman_packet *batman_packet, struct batman_packet *batman_packet,
......
...@@ -31,6 +31,8 @@ ...@@ -31,6 +31,8 @@
#include <linux/netfilter_bridge.h> #include <linux/netfilter_bridge.h>
static void send_outstanding_bcast_packet(struct work_struct *work);
/* apply hop penalty for a normal link */ /* apply hop penalty for a normal link */
static uint8_t hop_penalty(const uint8_t tq) static uint8_t hop_penalty(const uint8_t tq)
{ {
...@@ -431,7 +433,7 @@ int add_bcast_packet_to_list(struct sk_buff *skb) ...@@ -431,7 +433,7 @@ int add_bcast_packet_to_list(struct sk_buff *skb)
return NETDEV_TX_BUSY; return NETDEV_TX_BUSY;
} }
void send_outstanding_bcast_packet(struct work_struct *work) static void send_outstanding_bcast_packet(struct work_struct *work)
{ {
struct batman_if *batman_if; struct batman_if *batman_if;
struct delayed_work *delayed_work = struct delayed_work *delayed_work =
......
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
#include "types.h" #include "types.h"
void send_own_packet_work(struct work_struct *work);
int send_skb_packet(struct sk_buff *skb, int send_skb_packet(struct sk_buff *skb,
struct batman_if *batman_if, struct batman_if *batman_if,
uint8_t *dst_addr); uint8_t *dst_addr);
...@@ -34,6 +33,5 @@ void schedule_forward_packet(struct orig_node *orig_node, ...@@ -34,6 +33,5 @@ void schedule_forward_packet(struct orig_node *orig_node,
uint8_t directlink, int hna_buff_len, uint8_t directlink, int hna_buff_len,
struct batman_if *if_outgoing); struct batman_if *if_outgoing);
int add_bcast_packet_to_list(struct sk_buff *skb); int add_bcast_packet_to_list(struct sk_buff *skb);
void send_outstanding_bcast_packet(struct work_struct *work);
void send_outstanding_bat_packet(struct work_struct *work); void send_outstanding_bat_packet(struct work_struct *work);
void purge_outstanding_packets(struct batman_if *batman_if); void purge_outstanding_packets(struct batman_if *batman_if);
...@@ -36,7 +36,6 @@ static int32_t skb_packets; ...@@ -36,7 +36,6 @@ static int32_t skb_packets;
static int32_t skb_bad_packets; static int32_t skb_bad_packets;
unsigned char mainIfAddr[ETH_ALEN]; unsigned char mainIfAddr[ETH_ALEN];
static unsigned char mainIfAddr_default[ETH_ALEN];
static int bat_get_settings(struct net_device *dev, struct ethtool_cmd *cmd); static int bat_get_settings(struct net_device *dev, struct ethtool_cmd *cmd);
static void bat_get_drvinfo(struct net_device *dev, static void bat_get_drvinfo(struct net_device *dev,
struct ethtool_drvinfo *info); struct ethtool_drvinfo *info);
...@@ -61,11 +60,6 @@ void set_main_if_addr(uint8_t *addr) ...@@ -61,11 +60,6 @@ void set_main_if_addr(uint8_t *addr)
memcpy(mainIfAddr, addr, ETH_ALEN); memcpy(mainIfAddr, addr, ETH_ALEN);
} }
int main_if_was_up(void)
{
return (memcmp(mainIfAddr, mainIfAddr_default, ETH_ALEN) != 0 ? 1 : 0);
}
int my_skb_push(struct sk_buff *skb, unsigned int len) int my_skb_push(struct sk_buff *skb, unsigned int len)
{ {
int result = 0; int result = 0;
...@@ -83,69 +77,25 @@ int my_skb_push(struct sk_buff *skb, unsigned int len) ...@@ -83,69 +77,25 @@ int my_skb_push(struct sk_buff *skb, unsigned int len)
return 0; return 0;
} }
#ifdef HAVE_NET_DEVICE_OPS static int interface_open(struct net_device *dev)
static const struct net_device_ops bat_netdev_ops = {
.ndo_open = interface_open,
.ndo_stop = interface_release,
.ndo_get_stats = interface_stats,
.ndo_set_mac_address = interface_set_mac_addr,
.ndo_change_mtu = interface_change_mtu,
.ndo_start_xmit = interface_tx,
.ndo_validate_addr = eth_validate_addr
};
#endif
void interface_setup(struct net_device *dev)
{
struct bat_priv *priv = netdev_priv(dev);
char dev_addr[ETH_ALEN];
ether_setup(dev);
#ifdef HAVE_NET_DEVICE_OPS
dev->netdev_ops = &bat_netdev_ops;
#else
dev->open = interface_open;
dev->stop = interface_release;
dev->get_stats = interface_stats;
dev->set_mac_address = interface_set_mac_addr;
dev->change_mtu = interface_change_mtu;
dev->hard_start_xmit = interface_tx;
#endif
dev->destructor = free_netdev;
dev->mtu = hardif_min_mtu();
dev->hard_header_len = BAT_HEADER_LEN; /* reserve more space in the
* skbuff for our header */
/* generate random address */
random_ether_addr(dev_addr);
memcpy(dev->dev_addr, dev_addr, ETH_ALEN);
SET_ETHTOOL_OPS(dev, &bat_ethtool_ops);
memset(priv, 0, sizeof(struct bat_priv));
}
int interface_open(struct net_device *dev)
{ {
netif_start_queue(dev); netif_start_queue(dev);
return 0; return 0;
} }
int interface_release(struct net_device *dev) static int interface_release(struct net_device *dev)
{ {
netif_stop_queue(dev); netif_stop_queue(dev);
return 0; return 0;
} }
struct net_device_stats *interface_stats(struct net_device *dev) static struct net_device_stats *interface_stats(struct net_device *dev)
{ {
struct bat_priv *priv = netdev_priv(dev); struct bat_priv *priv = netdev_priv(dev);
return &priv->stats; return &priv->stats;
} }
int interface_set_mac_addr(struct net_device *dev, void *p) static int interface_set_mac_addr(struct net_device *dev, void *p)
{ {
struct sockaddr *addr = p; struct sockaddr *addr = p;
...@@ -163,7 +113,7 @@ int interface_set_mac_addr(struct net_device *dev, void *p) ...@@ -163,7 +113,7 @@ int interface_set_mac_addr(struct net_device *dev, void *p)
return 0; return 0;
} }
int interface_change_mtu(struct net_device *dev, int new_mtu) static int interface_change_mtu(struct net_device *dev, int new_mtu)
{ {
/* check ranges */ /* check ranges */
if ((new_mtu < 68) || (new_mtu > hardif_min_mtu())) if ((new_mtu < 68) || (new_mtu > hardif_min_mtu()))
...@@ -315,6 +265,50 @@ void interface_rx(struct sk_buff *skb, int hdr_size) ...@@ -315,6 +265,50 @@ void interface_rx(struct sk_buff *skb, int hdr_size)
netif_rx(skb); netif_rx(skb);
} }
#ifdef HAVE_NET_DEVICE_OPS
static const struct net_device_ops bat_netdev_ops = {
.ndo_open = interface_open,
.ndo_stop = interface_release,
.ndo_get_stats = interface_stats,
.ndo_set_mac_address = interface_set_mac_addr,
.ndo_change_mtu = interface_change_mtu,
.ndo_start_xmit = interface_tx,
.ndo_validate_addr = eth_validate_addr
};
#endif
void interface_setup(struct net_device *dev)
{
struct bat_priv *priv = netdev_priv(dev);
char dev_addr[ETH_ALEN];
ether_setup(dev);
#ifdef HAVE_NET_DEVICE_OPS
dev->netdev_ops = &bat_netdev_ops;
#else
dev->open = interface_open;
dev->stop = interface_release;
dev->get_stats = interface_stats;
dev->set_mac_address = interface_set_mac_addr;
dev->change_mtu = interface_change_mtu;
dev->hard_start_xmit = interface_tx;
#endif
dev->destructor = free_netdev;
dev->mtu = hardif_min_mtu();
dev->hard_header_len = BAT_HEADER_LEN; /* reserve more space in the
* skbuff for our header */
/* generate random address */
random_ether_addr(dev_addr);
memcpy(dev->dev_addr, dev_addr, ETH_ALEN);
SET_ETHTOOL_OPS(dev, &bat_ethtool_ops);
memset(priv, 0, sizeof(struct bat_priv));
}
/* ethtool */ /* ethtool */
static int bat_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) static int bat_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
{ {
......
...@@ -20,13 +20,7 @@ ...@@ -20,13 +20,7 @@
*/ */
void set_main_if_addr(uint8_t *addr); void set_main_if_addr(uint8_t *addr);
int main_if_was_up(void);
void interface_setup(struct net_device *dev); void interface_setup(struct net_device *dev);
int interface_open(struct net_device *dev);
int interface_release(struct net_device *dev);
struct net_device_stats *interface_stats(struct net_device *dev);
int interface_set_mac_addr(struct net_device *dev, void *addr);
int interface_change_mtu(struct net_device *dev, int new_mtu);
int interface_tx(struct sk_buff *skb, struct net_device *dev); int interface_tx(struct sk_buff *skb, struct net_device *dev);
void interface_rx(struct sk_buff *skb, int hdr_size); void interface_rx(struct sk_buff *skb, int hdr_size);
int my_skb_push(struct sk_buff *skb, unsigned int len); int my_skb_push(struct sk_buff *skb, unsigned int len);
......
...@@ -32,7 +32,10 @@ atomic_t hna_local_changed; ...@@ -32,7 +32,10 @@ atomic_t hna_local_changed;
DEFINE_SPINLOCK(hna_local_hash_lock); DEFINE_SPINLOCK(hna_local_hash_lock);
static DEFINE_SPINLOCK(hna_global_hash_lock); static DEFINE_SPINLOCK(hna_global_hash_lock);
static void hna_local_purge(struct work_struct *work);
static DECLARE_DELAYED_WORK(hna_local_purge_wq, hna_local_purge); static DECLARE_DELAYED_WORK(hna_local_purge_wq, hna_local_purge);
static void _hna_global_del_orig(struct hna_global_entry *hna_global_entry,
char *message);
static void hna_local_start_timer(void) static void hna_local_start_timer(void)
{ {
...@@ -242,7 +245,7 @@ void hna_local_remove(uint8_t *addr, char *message) ...@@ -242,7 +245,7 @@ void hna_local_remove(uint8_t *addr, char *message)
spin_unlock_irqrestore(&hna_local_hash_lock, flags); spin_unlock_irqrestore(&hna_local_hash_lock, flags);
} }
void hna_local_purge(struct work_struct *work) static void hna_local_purge(struct work_struct *work)
{ {
struct hna_local_entry *hna_local_entry; struct hna_local_entry *hna_local_entry;
HASHIT(hashit); HASHIT(hashit);
...@@ -423,7 +426,7 @@ int hna_global_seq_print_text(struct seq_file *seq, void *offset) ...@@ -423,7 +426,7 @@ int hna_global_seq_print_text(struct seq_file *seq, void *offset)
return 0; return 0;
} }
void _hna_global_del_orig(struct hna_global_entry *hna_global_entry, static void _hna_global_del_orig(struct hna_global_entry *hna_global_entry,
char *message) char *message)
{ {
bat_dbg(DBG_ROUTES, "Deleting global hna entry %pM (via %pM): %s\n", bat_dbg(DBG_ROUTES, "Deleting global hna entry %pM (via %pM): %s\n",
......
...@@ -26,14 +26,11 @@ void hna_local_add(uint8_t *addr); ...@@ -26,14 +26,11 @@ void hna_local_add(uint8_t *addr);
void hna_local_remove(uint8_t *addr, char *message); void hna_local_remove(uint8_t *addr, char *message);
int hna_local_fill_buffer(unsigned char *buff, int buff_len); int hna_local_fill_buffer(unsigned char *buff, int buff_len);
int hna_local_seq_print_text(struct seq_file *seq, void *offset); int hna_local_seq_print_text(struct seq_file *seq, void *offset);
void hna_local_purge(struct work_struct *work);
void hna_local_free(void); void hna_local_free(void);
int hna_global_init(void); int hna_global_init(void);
void hna_global_add_orig(struct orig_node *orig_node, unsigned char *hna_buff, void hna_global_add_orig(struct orig_node *orig_node, unsigned char *hna_buff,
int hna_buff_len); int hna_buff_len);
int hna_global_seq_print_text(struct seq_file *seq, void *offset); int hna_global_seq_print_text(struct seq_file *seq, void *offset);
void _hna_global_del_orig(struct hna_global_entry *hna_global_entry,
char *orig_str);
void hna_global_del_orig(struct orig_node *orig_node, char *message); void hna_global_del_orig(struct orig_node *orig_node, char *message);
void hna_global_free(void); void hna_global_free(void);
struct orig_node *transtable_search(uint8_t *addr); struct orig_node *transtable_search(uint8_t *addr);
......
...@@ -43,8 +43,8 @@ ...@@ -43,8 +43,8 @@
_dummy > smallest_signed_int(_dummy); }) _dummy > smallest_signed_int(_dummy); })
#define seq_after(x, y) seq_before(y, x) #define seq_after(x, y) seq_before(y, x)
struct hashtable_t *vis_hash; static struct hashtable_t *vis_hash;
DEFINE_SPINLOCK(vis_hash_lock); static DEFINE_SPINLOCK(vis_hash_lock);
static DEFINE_SPINLOCK(recv_list_lock); static DEFINE_SPINLOCK(recv_list_lock);
static struct vis_info *my_vis_info; static struct vis_info *my_vis_info;
static struct list_head send_list; /* always locked with vis_hash_lock */ static struct list_head send_list; /* always locked with vis_hash_lock */
......
...@@ -44,9 +44,6 @@ struct recvlist_node { ...@@ -44,9 +44,6 @@ struct recvlist_node {
uint8_t mac[ETH_ALEN]; uint8_t mac[ETH_ALEN];
}; };
extern struct hashtable_t *vis_hash;
extern spinlock_t vis_hash_lock;
int vis_seq_print_text(struct seq_file *seq, void *offset); int vis_seq_print_text(struct seq_file *seq, void *offset);
void receive_server_sync_packet(struct bat_priv *bat_priv, void receive_server_sync_packet(struct bat_priv *bat_priv,
struct vis_packet *vis_packet, struct vis_packet *vis_packet,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册