batman-adv: Prefix bat_debugfs local static functions with batadv_
PATCH 1/18 batman-adv: Prefix bat_debugfs local static functions with batadv_
All non-static symbols of batman-adv were prefixed with batadv_ to avoid collisions with other symbols of the kernel. Other symbols of batman-adv should use the same prefix to keep the naming scheme consistent.
--- bat_debugfs.c | 143 +++++++++++++++++++++++++++++---------------------------- 1 file changed, 72 insertions(+), 71 deletions(-)
bat_debugfs.c +72 -71
@@ -32,25 +32,25 @@#include "icmp_socket.h" #include "bridge_loop_avoidance.h" -static struct dentry *bat_debugfs; +static struct dentry *batadv_debugfs;#ifdef CONFIG_BATMAN_ADV_DEBUG -#define LOG_BUFF_MASK (log_buff_len-1) +#define LOG_BUFF_MASK (batadv_log_buff_len - 1)#define LOG_BUFF (idx) (debug_log->log_buff[(idx) & LOG_BUFF_MASK]) -static int log_buff_len =LOG_BUF_LEN ; +static int batadv_log_buff_len =LOG_BUF_LEN ; -static void emit_log_char (struct debug_log *debug_log,char c) +static void batadv_emit_log_char (struct debug_log *debug_log,char c) {LOG_BUFF (debug_log->log_end) = c; debug_log->log_end++; -if (debug_log->log_end - debug_log->log_start > log_buff_len) - debug_log->log_start = debug_log->log_end - log_buff_len; +if (debug_log->log_end - debug_log->log_start > batadv_log_buff_len) + debug_log->log_start = debug_log->log_end - batadv_log_buff_len; } __printf(2, 3) -static int fdebug_log (struct debug_log *debug_log,const char *fmt, ...) +static int batadv_fdebug_log (struct debug_log *debug_log,const char *fmt, ...) {va_list args;static char debug_log_buf[256 ];
@@ -65,7 +65,7 @@ static int fdebug_log(struct debug_log *debug_log, const char *fmt, ...)va_end (args);for (p = debug_log_buf; *p !=0 ; p++) -emit_log_char (debug_log, *p); +batadv_emit_log_char (debug_log, *p);spin_unlock_bh (&debug_log->lock);
@@ -81,14 +81,14 @@ int batadv_debug_log(struct bat_priv *bat_priv, const char *fmt, ...)va_start (args, fmt);vscnprintf (tmp_log_buf,sizeof (tmp_log_buf), fmt, args); -fdebug_log (bat_priv->debug_log,"[%10u] %s" , -jiffies_to_msecs (jiffies), tmp_log_buf); +batadv_fdebug_log (bat_priv->debug_log,"[%10u] %s" , +jiffies_to_msecs (jiffies), tmp_log_buf);va_end (args);return 0 ; } -static int log_open (struct inode *inode,struct file *file) +static int batadv_log_open (struct inode *inode,struct file *file) {nonseekable_open (inode, file); file->private_data = inode->i_private;
@@ -96,14 +96,14 @@ static int log_open(struct inode *inode, struct file *file)return 0 ; } -static int log_release (struct inode *inode,struct file *file) +static int batadv_log_release (struct inode *inode,struct file *file) {batadv_dec_module_count ();return 0 ; } -static ssize_t log_read (struct file *file,char __user *buf, -size_t count,loff_t *ppos) +static ssize_t batadv_log_read (struct file *file,char __user *buf, +size_t count,loff_t *ppos) {struct bat_priv *bat_priv = file->private_data;struct debug_log *debug_log = bat_priv->debug_log;
@@ -156,7 +156,7 @@ static ssize_t log_read(struct file *file, char __user *buf,return error; } -static unsigned int log_poll (struct file *file,poll_table *wait) +static unsigned int batadv_log_poll (struct file *file,poll_table *wait) {struct bat_priv *bat_priv = file->private_data;struct debug_log *debug_log = bat_priv->debug_log;
@@ -169,15 +169,15 @@ static unsigned int log_poll(struct file *file, poll_table *wait)return 0 ; } -static const struct file_operations log_fops = { - .open = log_open, - .release = log_release, - .read = log_read, - .poll = log_poll, +static const struct file_operations batadv_log_fops = { + .open = batadv_log_open, + .release = batadv_log_release, + .read = batadv_log_read, + .poll = batadv_log_poll, .llseek = no_llseek, }; -static int debug_log_setup (struct bat_priv *bat_priv) +static int batadv_debug_log_setup (struct bat_priv *bat_priv) {struct dentry *d;
@@ -192,7 +192,8 @@ static int debug_log_setup(struct bat_priv *bat_priv)init_waitqueue_head (&bat_priv->debug_log->queue_wait); d =debugfs_create_file ("log" ,S_IFREG |S_IRUSR , - bat_priv->debug_dir, bat_priv, &log_fops); + bat_priv->debug_dir, bat_priv, + &batadv_log_fops);if (d) goto err;
@@ -202,49 +203,49 @@ err:return 1 ; } -static void debug_log_cleanup (struct bat_priv *bat_priv) +static void batadv_debug_log_cleanup (struct bat_priv *bat_priv) {kfree (bat_priv->debug_log); bat_priv->debug_log =NULL ; }#else /* CONFIG_BATMAN_ADV_DEBUG */ -static int debug_log_setup (struct bat_priv *bat_priv) +static int batadv_debug_log_setup (struct bat_priv *bat_priv) { bat_priv->debug_log =NULL ;return 0 ; } -static void debug_log_cleanup (struct bat_priv *bat_priv) +static void batadv_debug_log_cleanup (struct bat_priv *bat_priv) {return ; }#endif -static int bat_algorithms_open (struct inode *inode,struct file *file) +static int batadv_algorithms_open (struct inode *inode,struct file *file) {return single_open (file, batadv_algo_seq_print_text,NULL ); } -static int originators_open (struct inode *inode,struct file *file) +static int batadv_originators_open (struct inode *inode,struct file *file) {struct net_device *net_dev = (struct net_device *)inode->i_private;return single_open (file, batadv_orig_seq_print_text, net_dev); } -static int gateways_open (struct inode *inode,struct file *file) +static int batadv_gateways_open (struct inode *inode,struct file *file) {struct net_device *net_dev = (struct net_device *)inode->i_private;return single_open (file, batadv_gw_client_seq_print_text, net_dev); } -static int transtable_global_open (struct inode *inode,struct file *file) +static int batadv_transtable_global_open (struct inode *inode,struct file *file) {struct net_device *net_dev = (struct net_device *)inode->i_private;return single_open (file, batadv_tt_global_seq_print_text, net_dev); }#ifdef CONFIG_BATMAN_ADV_BLA -static int bla_claim_table_open (struct inode *inode,struct file *file) +static int batadv_bla_claim_table_open (struct inode *inode,struct file *file) {struct net_device *net_dev = (struct net_device *)inode->i_private; return single_open(file, batadv_bla_claim_table_seq_print_text,
@@ -252,13 +253,13 @@ static int bla_claim_table_open(struct inode *inode, struct file *file) }#endif -static int transtable_local_open (struct inode *inode,struct file *file) +static int batadv_transtable_local_open (struct inode *inode,struct file *file) {struct net_device *net_dev = (struct net_device *)inode->i_private;return single_open (file, batadv_tt_local_seq_print_text, net_dev); } -static int vis_data_open (struct inode *inode,struct file *file) +static int batadv_vis_data_open (struct inode *inode,struct file *file) {struct net_device *net_dev = (struct net_device *)inode->i_private;return single_open (file, batadv_vis_seq_print_text, net_dev);
@@ -269,37 +270,37 @@ struct bat_debuginfo {const struct file_operations fops; }; -#define BAT_DEBUGINFO (_name, _mode, _open) \ -struct bat_debuginfo bat_debuginfo_##_name = { \ - .attr = { .name = __stringify(_name), \ - .mode = _mode, }, \ - .fops = { .owner = THIS_MODULE, \ - .open = _open, \ - .read = seq_read, \ - .llseek = seq_lseek, \ - .release = single_release, \ - } \ +#define BAT_DEBUGINFO (_name, _mode, _open) \ +struct bat_debuginfo batadv_debuginfo_##_name = { \ + .attr = { .name = __stringify(_name), \ + .mode = _mode, }, \ + .fops = { .owner = THIS_MODULE, \ + .open = _open, \ + .read = seq_read, \ + .llseek = seq_lseek, \ + .release = single_release, \ + } \ }; -static BAT_DEBUGINFO(routing_algos, S_IRUGO, bat_algorithms_open); -static BAT_DEBUGINFO(originators, S_IRUGO, originators_open); -static BAT_DEBUGINFO(gateways, S_IRUGO, gateways_open); -static BAT_DEBUGINFO(transtable_global, S_IRUGO, transtable_global_open); +static BAT_DEBUGINFO(routing_algos, S_IRUGO, batadv_algorithms_open); +static BAT_DEBUGINFO(originators, S_IRUGO, batadv_originators_open); +static BAT_DEBUGINFO(gateways, S_IRUGO, batadv_gateways_open); +static BAT_DEBUGINFO(transtable_global, S_IRUGO, batadv_transtable_global_open);#ifdef CONFIG_BATMAN_ADV_BLA -static BAT_DEBUGINFO(bla_claim_table, S_IRUGO, bla_claim_table_open); +static BAT_DEBUGINFO(bla_claim_table, S_IRUGO, batadv_bla_claim_table_open);#endif -static BAT_DEBUGINFO(transtable_local, S_IRUGO, transtable_local_open); -static BAT_DEBUGINFO(vis_data, S_IRUGO, vis_data_open); +static BAT_DEBUGINFO(transtable_local, S_IRUGO, batadv_transtable_local_open); +static BAT_DEBUGINFO(vis_data, S_IRUGO, batadv_vis_data_open); -static struct bat_debuginfo *mesh_debuginfos[] = { - &bat_debuginfo_originators, - &bat_debuginfo_gateways, - &bat_debuginfo_transtable_global, +static struct bat_debuginfo *batadv_mesh_debuginfos[] = { + &batadv_debuginfo_originators, + &batadv_debuginfo_gateways, + &batadv_debuginfo_transtable_global, #ifdef CONFIG_BATMAN_ADV_BLA - &bat_debuginfo_bla_claim_table, + &batadv_debuginfo_bla_claim_table, #endif - &bat_debuginfo_transtable_local, - &bat_debuginfo_vis_data, + &batadv_debuginfo_transtable_local, + &batadv_debuginfo_vis_data,NULL , };
@@ -308,17 +309,17 @@ void batadv_debugfs_init(void)struct bat_debuginfo *bat_debug;struct dentry *file; - bat_debugfs =debugfs_create_dir (DEBUGFS_BAT_SUBDIR ,NULL ); -if (bat_debugfs ==ERR_PTR (-ENODEV )) - bat_debugfs =NULL ; + batadv_debugfs =debugfs_create_dir (DEBUGFS_BAT_SUBDIR ,NULL ); +if (batadv_debugfs ==ERR_PTR (-ENODEV )) + batadv_debugfs =NULL ; -if (!bat_debugfs) +if (!batadv_debugfs) goto out; - bat_debug = &bat_debuginfo_routing_algos; + bat_debug = &batadv_debuginfo_routing_algos; file =debugfs_create_file (bat_debug->attr.name,S_IFREG | bat_debug->attr.mode, - bat_debugfs,NULL , &bat_debug->fops); + batadv_debugfs,NULL , &bat_debug->fops);if (!file)pr_err ("Can't add debugfs file: %s\n" , bat_debug->attr.name);
@@ -328,9 +329,9 @@ out:void batadv_debugfs_destroy (void ) { -if (bat_debugfs) { -debugfs_remove_recursive (bat_debugfs); - bat_debugfs =NULL ; +if (batadv_debugfs) { +debugfs_remove_recursive (batadv_debugfs); + batadv_debugfs =NULL ; } }
@@ -340,17 +341,17 @@ int batadv_debugfs_add_meshif(struct net_device *dev)struct bat_debuginfo **bat_debug;struct dentry *file; -if (!bat_debugfs) +if (!batadv_debugfs) goto out; - bat_priv->debug_dir =debugfs_create_dir (dev->name, bat_debugfs); + bat_priv->debug_dir =debugfs_create_dir (dev->name, batadv_debugfs);if (!bat_priv->debug_dir) goto out;batadv_socket_setup (bat_priv); -debug_log_setup (bat_priv); +batadv_debug_log_setup (bat_priv); -for (bat_debug = mesh_debuginfos; *bat_debug; ++bat_debug) { +for (bat_debug = batadv_mesh_debuginfos; *bat_debug; ++bat_debug) { file = debugfs_create_file(((*bat_debug)->attr).name, S_IFREG | ((*bat_debug)->attr).mode, bat_priv->debug_dir,
@@ -378,9 +379,9 @@ void batadv_debugfs_del_meshif(struct net_device *dev) {struct bat_priv *bat_priv =netdev_priv (dev); -debug_log_cleanup (bat_priv); +batadv_debug_log_cleanup (bat_priv); -if (bat_debugfs) { +if (batadv_debugfs) {debugfs_remove_recursive (bat_priv->debug_dir); bat_priv->debug_dir =NULL ; }
Signature · 1 line
1.7.10
PATCH 2/18 batman-adv: Prefix bat_iv_ogm local static functions with batadv_
All non-static symbols of batman-adv were prefixed with batadv_ to avoid collisions with other symbols of the kernel. Other symbols of batman-adv should use the same prefix to keep the naming scheme consistent.
--- bat_iv_ogm.c | 255 +++++++++++++++++++++++++++++----------------------------- 1 file changed, 129 insertions(+), 126 deletions(-)
bat_iv_ogm.c +129 -126
@@ -28,11 +28,11 @@#include "send.h" #include "bat_algo.h" -static struct neigh_node *bat_iv_ogm_neigh_new (struct hard_iface *hard_iface, -const uint8_t *neigh_addr, -struct orig_node *orig_node, -struct orig_node *orig_neigh, -__be32 seqno) +static struct neigh_node *batadv_iv_ogm_neigh_new (struct hard_iface *hard_iface, +const uint8_t *neigh_addr, +struct orig_node *orig_node, +struct orig_node *orig_neigh, +__be32 seqno) {struct neigh_node *neigh_node;
@@ -54,7 +54,7 @@ out:return neigh_node; } -static int bat_iv_ogm_iface_enable (struct hard_iface *hard_iface) +static int batadv_iv_ogm_iface_enable (struct hard_iface *hard_iface) {struct batman_ogm_packet *batman_ogm_packet;uint32_t random_seqno;
@@ -85,13 +85,13 @@ out:return res; } -static void bat_iv_ogm_iface_disable (struct hard_iface *hard_iface) +static void batadv_iv_ogm_iface_disable (struct hard_iface *hard_iface) {kfree (hard_iface->packet_buff); hard_iface->packet_buff =NULL ; } -static void bat_iv_ogm_iface_update_mac (struct hard_iface *hard_iface) +static void batadv_iv_ogm_iface_update_mac (struct hard_iface *hard_iface) {struct batman_ogm_packet *batman_ogm_packet;
@@ -102,7 +102,7 @@ static void bat_iv_ogm_iface_update_mac(struct hard_iface *hard_iface) hard_iface->net_dev->dev_addr, ETH_ALEN); } -static void bat_iv_ogm_primary_iface_set (struct hard_iface *hard_iface) +static void batadv_iv_ogm_primary_iface_set (struct hard_iface *hard_iface) {struct batman_ogm_packet *batman_ogm_packet;
@@ -112,7 +112,8 @@ static void bat_iv_ogm_primary_iface_set(struct hard_iface *hard_iface) }/* when do we schedule our own ogm to be sent */ -static unsigned long bat_iv_ogm_emit_send_time (const struct bat_priv *bat_priv) +static unsigned long +batadv_iv_ogm_emit_send_time (const struct bat_priv *bat_priv) { return jiffies + msecs_to_jiffies( atomic_read(&bat_priv->orig_interval) -
@@ -120,20 +121,20 @@ static unsigned long bat_iv_ogm_emit_send_time(const struct bat_priv *bat_priv) }/* when do we schedule a ogm packet to be sent */ -static unsigned long bat_iv_ogm_fwd_send_time (void ) +static unsigned long batadv_iv_ogm_fwd_send_time (void ) {return jiffies +msecs_to_jiffies (random32 () % (JITTER /2 )); }/* apply hop penalty for a normal link */ -static uint8_t hop_penalty (uint8_t tq,const struct bat_priv *bat_priv) +static uint8_t batadv_hop_penalty (uint8_t tq,const struct bat_priv *bat_priv) {int hop_penalty =atomic_read (&bat_priv->hop_penalty);return (tq * (TQ_MAX_VALUE - hop_penalty)) / (TQ_MAX_VALUE ); }/* is there another aggregated packet here? */ -static int bat_iv_ogm_aggr_packet (int buff_pos,int packet_len, +static int batadv_iv_ogm_aggr_packet (int buff_pos,int packet_len,int tt_num_changes) {int next_buff_pos =0 ;
@@ -146,7 +147,7 @@ static int bat_iv_ogm_aggr_packet(int buff_pos, int packet_len, }/* send a batman ogm to a given interface */ -static void bat_iv_ogm_send_to_if (struct forw_packet *forw_packet, +static void batadv_iv_ogm_send_to_if (struct forw_packet *forw_packet,struct hard_iface *hard_iface) {struct bat_priv *bat_priv =netdev_priv (hard_iface->soft_iface);
@@ -164,8 +165,8 @@ static void bat_iv_ogm_send_to_if(struct forw_packet *forw_packet, batman_ogm_packet = (struct batman_ogm_packet *)forw_packet->skb->data;/* adjust all flags and log packets */ -while (bat_iv_ogm_aggr_packet (buff_pos, forw_packet->packet_len, - batman_ogm_packet->tt_num_changes)) { +while (batadv_iv_ogm_aggr_packet (buff_pos, forw_packet->packet_len, + batman_ogm_packet->tt_num_changes)) {/* we might have aggregated direct link packets with an * ordinary base packet
@@ -208,7 +209,7 @@ static void bat_iv_ogm_send_to_if(struct forw_packet *forw_packet, }/* send a batman ogm packet */ -static void bat_iv_ogm_emit (struct forw_packet *forw_packet) +static void batadv_iv_ogm_emit (struct forw_packet *forw_packet) {struct hard_iface *hard_iface;struct net_device *soft_iface;
@@ -267,7 +268,7 @@ static void bat_iv_ogm_emit(struct forw_packet *forw_packet)if (hard_iface->soft_iface != soft_iface)continue ; -bat_iv_ogm_send_to_if (forw_packet, hard_iface); +batadv_iv_ogm_send_to_if (forw_packet, hard_iface); }rcu_read_unlock ();
@@ -277,13 +278,13 @@ out: }/* return true if new_packet can be aggregated with forw_packet */ -static bool bat_iv_ogm_can_aggregate (const struct batman_ogm_packet - *new_batman_ogm_packet, -struct bat_priv *bat_priv, -int packet_len,unsigned long send_time, -bool directlink, -const struct hard_iface *if_incoming, -const struct forw_packet *forw_packet) +static bool +batadv_iv_ogm_can_aggregate (const struct batman_ogm_packet *new_bat_ogm_packet, +struct bat_priv *bat_priv, +int packet_len,unsigned long send_time, +bool directlink, +const struct hard_iface *if_incoming, +const struct forw_packet *forw_packet) {struct batman_ogm_packet *batman_ogm_packet;int aggregated_bytes = forw_packet->packet_len + packet_len;
@@ -335,7 +336,7 @@ static bool bat_iv_ogm_can_aggregate(const struct batman_ogm_packet* interface only - we still can aggregate */ if ((directlink) && - (new_batman_ogm_packet->header.ttl == 1) && + (new_bat_ogm_packet->header.ttl == 1) && (forw_packet->if_incoming == if_incoming) &&/* packets from direct neighbors or
@@ -357,11 +358,11 @@ out: }/* create a new aggregated packet and add this packet to it */ -static void bat_iv_ogm_aggregate_new (const unsigned char *packet_buff, -int packet_len,unsigned long send_time, -bool direct_link, -struct hard_iface *if_incoming, -int own_packet) +static void batadv_iv_ogm_aggregate_new (const unsigned char *packet_buff, +int packet_len,unsigned long send_time, +bool direct_link, +struct hard_iface *if_incoming, +int own_packet) {struct bat_priv *bat_priv =netdev_priv (if_incoming->soft_iface);struct forw_packet *forw_packet_aggr;
@@ -435,9 +436,9 @@ out: }/* aggregate a new packet into the existing ogm packet */ -static void bat_iv_ogm_aggregate (struct forw_packet *forw_packet_aggr, -const unsigned char *packet_buff, -int packet_len,bool direct_link) +static void batadv_iv_ogm_aggregate (struct forw_packet *forw_packet_aggr, +const unsigned char *packet_buff, +int packet_len,bool direct_link) {unsigned char *skb_buff;
@@ -452,10 +453,11 @@ static void bat_iv_ogm_aggregate(struct forw_packet *forw_packet_aggr, (1 << forw_packet_aggr->num_packets); } -static void bat_iv_ogm_queue_add (struct bat_priv *bat_priv, -unsigned char *packet_buff, -int packet_len,struct hard_iface *if_incoming, -int own_packet,unsigned long send_time) +static void batadv_iv_ogm_queue_add (struct bat_priv *bat_priv, +unsigned char *packet_buff, +int packet_len, +struct hard_iface *if_incoming, +int own_packet,unsigned long send_time) {/* _aggr -> pointer to the packet we want to aggregate with * _pos -> pointer to the position in the queue
@@ -474,11 +476,11 @@ static void bat_iv_ogm_queue_add(struct bat_priv *bat_priv,if ((atomic_read (&bat_priv->aggregated_ogms)) && (!own_packet)) {hlist_for_each_entry (forw_packet_pos, tmp_node, &bat_priv->forw_bat_list, list) { -if (bat_iv_ogm_can_aggregate (batman_ogm_packet, - bat_priv, packet_len, - send_time, direct_link, - if_incoming, - forw_packet_pos)) { +if (batadv_iv_ogm_can_aggregate (batman_ogm_packet, + bat_priv, packet_len, + send_time, direct_link, + if_incoming, + forw_packet_pos)) { forw_packet_aggr = forw_packet_pos;break ; }
@@ -500,22 +502,22 @@ static void bat_iv_ogm_queue_add(struct bat_priv *bat_priv, (atomic_read(&bat_priv->aggregated_ogms))) send_time +=msecs_to_jiffies (MAX_AGGREGATION_MS ); -bat_iv_ogm_aggregate_new (packet_buff, packet_len, - send_time, direct_link, - if_incoming, own_packet); +batadv_iv_ogm_aggregate_new (packet_buff, packet_len, + send_time, direct_link, + if_incoming, own_packet); }else { -bat_iv_ogm_aggregate (forw_packet_aggr, packet_buff, - packet_len, direct_link); +batadv_iv_ogm_aggregate (forw_packet_aggr, packet_buff, + packet_len, direct_link);spin_unlock_bh (&bat_priv->forw_bat_list_lock); } } -static void bat_iv_ogm_forward (struct orig_node *orig_node, -const struct ethhdr *ethhdr, -struct batman_ogm_packet *batman_ogm_packet, -bool is_single_hop_neigh, -bool is_from_best_next_hop, -struct hard_iface *if_incoming) +static void batadv_iv_ogm_forward (struct orig_node *orig_node, +const struct ethhdr *ethhdr, +struct batman_ogm_packet *batman_ogm_packet, +bool is_single_hop_neigh, +bool is_from_best_next_hop, +struct hard_iface *if_incoming) {struct bat_priv *bat_priv =netdev_priv (if_incoming->soft_iface);uint8_t tt_num_changes;
@@ -544,7 +546,8 @@ static void bat_iv_ogm_forward(struct orig_node *orig_node,memcpy (batman_ogm_packet->prev_sender, ethhdr->h_source,ETH_ALEN );/* apply hop penalty */ - batman_ogm_packet->tq =hop_penalty (batman_ogm_packet->tq, bat_priv); + batman_ogm_packet->tq =batadv_hop_penalty (batman_ogm_packet->tq, + bat_priv); batadv_dbg(DBG_BATMAN, bat_priv, "Forwarding packet: tq: %i, ttl: %i\n",
@@ -557,12 +560,12 @@ static void bat_iv_ogm_forward(struct orig_node *orig_node,else batman_ogm_packet->flags &= ~DIRECTLINK ; -bat_iv_ogm_queue_add (bat_priv, (unsigned char *)batman_ogm_packet, -BATMAN_OGM_HLEN +batadv_tt_len (tt_num_changes), - if_incoming,0 ,bat_iv_ogm_fwd_send_time ()); +batadv_iv_ogm_queue_add (bat_priv, (unsigned char *)batman_ogm_packet, +BATMAN_OGM_HLEN +batadv_tt_len (tt_num_changes), + if_incoming,0 ,batadv_iv_ogm_fwd_send_time ()); } -static void bat_iv_ogm_schedule (struct hard_iface *hard_iface) +static void batadv_iv_ogm_schedule (struct hard_iface *hard_iface) {struct bat_priv *bat_priv =netdev_priv (hard_iface->soft_iface);struct batman_ogm_packet *batman_ogm_packet;
@@ -603,22 +606,22 @@ static void bat_iv_ogm_schedule(struct hard_iface *hard_iface) batman_ogm_packet->gw_flags =NO_FLAGS ;batadv_slide_own_bcast_window (hard_iface); -bat_iv_ogm_queue_add (bat_priv, hard_iface->packet_buff, - hard_iface->packet_len, hard_iface,1 , -bat_iv_ogm_emit_send_time (bat_priv)); +batadv_iv_ogm_queue_add (bat_priv, hard_iface->packet_buff, + hard_iface->packet_len, hard_iface,1 , +batadv_iv_ogm_emit_send_time (bat_priv));if (primary_if)batadv_hardif_free_ref (primary_if); } -static void bat_iv_ogm_orig_update (struct bat_priv *bat_priv, -struct orig_node *orig_node, -const struct ethhdr *ethhdr, -const struct batman_ogm_packet - *batman_ogm_packet, -struct hard_iface *if_incoming, -const unsigned char *tt_buff, -int is_duplicate) +static void +batadv_iv_ogm_orig_update (struct bat_priv *bat_priv, +struct orig_node *orig_node, +const struct ethhdr *ethhdr, +const struct batman_ogm_packet *batman_ogm_packet, +struct hard_iface *if_incoming, +const unsigned char *tt_buff, +int is_duplicate) {struct neigh_node *neigh_node =NULL , *tmp_neigh_node =NULL ;struct neigh_node *router =NULL ;
@@ -661,9 +664,10 @@ static void bat_iv_ogm_orig_update(struct bat_priv *bat_priv,if (!orig_tmp) goto unlock; - neigh_node =bat_iv_ogm_neigh_new (if_incoming, ethhdr->h_source, - orig_node, orig_tmp, - batman_ogm_packet->seqno); + neigh_node =batadv_iv_ogm_neigh_new (if_incoming, + ethhdr->h_source, + orig_node, orig_tmp, + batman_ogm_packet->seqno);batadv_orig_node_free_ref (orig_tmp);if (!neigh_node)
@@ -759,10 +763,10 @@ out:batadv_neigh_node_free_ref (router); } -static int bat_iv_ogm_calc_tq (struct orig_node *orig_node, -struct orig_node *orig_neigh_node, -struct batman_ogm_packet *batman_ogm_packet, -struct hard_iface *if_incoming) +static int batadv_iv_ogm_calc_tq (struct orig_node *orig_node, +struct orig_node *orig_neigh_node, +struct batman_ogm_packet *batman_ogm_packet, +struct hard_iface *if_incoming) {struct bat_priv *bat_priv =netdev_priv (if_incoming->soft_iface);struct neigh_node *neigh_node =NULL , *tmp_neigh_node;
@@ -792,11 +796,11 @@ static int bat_iv_ogm_calc_tq(struct orig_node *orig_node,rcu_read_unlock ();if (!neigh_node) - neigh_node =bat_iv_ogm_neigh_new (if_incoming, - orig_neigh_node->orig, - orig_neigh_node, - orig_neigh_node, - batman_ogm_packet->seqno); + neigh_node =batadv_iv_ogm_neigh_new (if_incoming, + orig_neigh_node->orig, + orig_neigh_node, + orig_neigh_node, + batman_ogm_packet->seqno);if (!neigh_node) goto out;
@@ -873,10 +877,10 @@ out:* -1 the packet is old and has been received while the seqno window * was protected. Caller should drop it. */ -static int bat_iv_ogm_update_seqnos (const struct ethhdr *ethhdr, -const struct batman_ogm_packet - *batman_ogm_packet, -const struct hard_iface *if_incoming) +static int +batadv_iv_ogm_update_seqnos (const struct ethhdr *ethhdr, +const struct batman_ogm_packet *batman_ogm_packet, +const struct hard_iface *if_incoming) {struct bat_priv *bat_priv =netdev_priv (if_incoming->soft_iface);struct orig_node *orig_node;
@@ -943,10 +947,10 @@ out:return ret; } -static void bat_iv_ogm_process (const struct ethhdr *ethhdr, -struct batman_ogm_packet *batman_ogm_packet, -const unsigned char *tt_buff, -struct hard_iface *if_incoming) +static void batadv_iv_ogm_process (const struct ethhdr *ethhdr, +struct batman_ogm_packet *batman_ogm_packet, +const unsigned char *tt_buff, +struct hard_iface *if_incoming) {struct bat_priv *bat_priv =netdev_priv (if_incoming->soft_iface);struct hard_iface *hard_iface;
@@ -955,10 +959,10 @@ static void bat_iv_ogm_process(const struct ethhdr *ethhdr,struct neigh_node *orig_neigh_router =NULL ;int has_directlink_flag;int is_my_addr =0 , is_my_orig =0 , is_my_oldorig =0 ; -int is_broadcast =0 , is_bidirectional; +int is_broadcast =0 , is_bidirect;bool is_single_hop_neigh = false;bool is_from_best_next_hop = false; -int is_duplicate; +int is_duplicate, sameseq, simlar_ttl;uint32_t if_incoming_seqno;uint8_t *prev_sender;
@@ -1095,8 +1099,8 @@ static void bat_iv_ogm_process(const struct ethhdr *ethhdr,if (!orig_node)return ; - is_duplicate =bat_iv_ogm_update_seqnos (ethhdr, batman_ogm_packet, - if_incoming); + is_duplicate =batadv_iv_ogm_update_seqnos (ethhdr, batman_ogm_packet, + if_incoming);if (is_duplicate ==-1 ) { batadv_dbg(DBG_BATMAN, bat_priv,
@@ -1151,8 +1155,8 @@ static void bat_iv_ogm_process(const struct ethhdr *ethhdr, goto out_neigh; } - is_bidirectional =bat_iv_ogm_calc_tq (orig_node, orig_neigh_node, - batman_ogm_packet, if_incoming); + is_bidirect =batadv_iv_ogm_calc_tq (orig_node, orig_neigh_node, + batman_ogm_packet, if_incoming);batadv_bonding_save_primary (orig_node, orig_neigh_node, batman_ogm_packet);
@@ -1160,21 +1164,20 @@ static void bat_iv_ogm_process(const struct ethhdr *ethhdr,/* update ranking if it is not a duplicate or has the same * seqno and similar ttl as the non-duplicate */ -if (is_bidirectional && - (!is_duplicate || - ((orig_node->last_real_seqno ==ntohl (batman_ogm_packet->seqno)) && - (orig_node->last_ttl -3 <= batman_ogm_packet->header.ttl)))) -bat_iv_ogm_orig_update (bat_priv, orig_node, ethhdr, - batman_ogm_packet, if_incoming, - tt_buff, is_duplicate); + sameseq = orig_node->last_real_seqno ==ntohl (batman_ogm_packet->seqno); + simlar_ttl = orig_node->last_ttl -3 <= batman_ogm_packet->header.ttl; +if (is_bidirect && (!is_duplicate || (sameseq && simlar_ttl))) +batadv_iv_ogm_orig_update (bat_priv, orig_node, ethhdr, + batman_ogm_packet, if_incoming, + tt_buff, is_duplicate);/* is single hop (direct) neighbor */ if (is_single_hop_neigh) {/* mark direct link on incoming interface */ -bat_iv_ogm_forward (orig_node, ethhdr, batman_ogm_packet, - is_single_hop_neigh, is_from_best_next_hop, - if_incoming); +batadv_iv_ogm_forward (orig_node, ethhdr, batman_ogm_packet, + is_single_hop_neigh, + is_from_best_next_hop, if_incoming);batadv_dbg (DBG_BATMAN , bat_priv,"Forwarding packet: rebroadcast neighbor packet with direct link flag\n" );
@@ -1182,7 +1185,7 @@ static void bat_iv_ogm_process(const struct ethhdr *ethhdr, }/* multihop originator */ -if (!is_bidirectional) { +if (!is_bidirect) {batadv_dbg (DBG_BATMAN , bat_priv,"Drop packet: not received via bidirectional link\n" ); goto out_neigh;
@@ -1196,9 +1199,9 @@ static void bat_iv_ogm_process(const struct ethhdr *ethhdr,batadv_dbg (DBG_BATMAN , bat_priv,"Forwarding packet: rebroadcast originator packet\n" ); -bat_iv_ogm_forward (orig_node, ethhdr, batman_ogm_packet, - is_single_hop_neigh, is_from_best_next_hop, - if_incoming); +batadv_iv_ogm_forward (orig_node, ethhdr, batman_ogm_packet, + is_single_hop_neigh, is_from_best_next_hop, + if_incoming); out_neigh:if ((orig_neigh_node) && (!is_single_hop_neigh))
@@ -1214,8 +1217,8 @@ out:batadv_orig_node_free_ref (orig_node); } -static int bat_iv_ogm_receive (struct sk_buff *skb, -struct hard_iface *if_incoming) +static int batadv_iv_ogm_receive (struct sk_buff *skb, +struct hard_iface *if_incoming) {struct bat_priv *bat_priv =netdev_priv (if_incoming->soft_iface);struct batman_ogm_packet *batman_ogm_packet;
@@ -1231,7 +1234,7 @@ static int bat_iv_ogm_receive(struct sk_buff *skb,/* did we receive a B.A.T.M.A.N. IV OGM packet on an interface * that does not have B.A.T.M.A.N. IV enabled ? */ -if (bat_priv->bat_algo_ops->bat_ogm_emit != bat_iv_ogm_emit) +if (bat_priv->bat_algo_ops->bat_ogm_emit != batadv_iv_ogm_emit)return NET_RX_DROP ;inc_counter (bat_priv,BAT_CNT_MGMT_RX );
@@ -1247,29 +1250,29 @@ static int bat_iv_ogm_receive(struct sk_buff *skb,do { tt_buff = packet_buff + buff_pos +BATMAN_OGM_HLEN ; -bat_iv_ogm_process (ethhdr, batman_ogm_packet, - tt_buff, if_incoming); +batadv_iv_ogm_process (ethhdr, batman_ogm_packet, tt_buff, + if_incoming); buff_pos +=BATMAN_OGM_HLEN ; buff_pos +=batadv_tt_len (batman_ogm_packet->tt_num_changes); batman_ogm_packet = (struct batman_ogm_packet *) (packet_buff + buff_pos); - }while (bat_iv_ogm_aggr_packet (buff_pos, packet_len, - batman_ogm_packet->tt_num_changes)); + }while (batadv_iv_ogm_aggr_packet (buff_pos, packet_len, + batman_ogm_packet->tt_num_changes));kfree_skb (skb);return NET_RX_SUCCESS ; } -static struct bat_algo_ops batman_iv__read_mostly = { +static struct bat_algo_ops batadv_batman_iv__read_mostly = { .name ="BATMAN_IV" , - .bat_iface_enable = bat_iv_ogm_iface_enable, - .bat_iface_disable = bat_iv_ogm_iface_disable, - .bat_iface_update_mac = bat_iv_ogm_iface_update_mac, - .bat_primary_iface_set = bat_iv_ogm_primary_iface_set, - .bat_ogm_schedule = bat_iv_ogm_schedule, - .bat_ogm_emit = bat_iv_ogm_emit, + .bat_iface_enable = batadv_iv_ogm_iface_enable, + .bat_iface_disable = batadv_iv_ogm_iface_disable, + .bat_iface_update_mac = batadv_iv_ogm_iface_update_mac, + .bat_primary_iface_set = batadv_iv_ogm_primary_iface_set, + .bat_ogm_schedule = batadv_iv_ogm_schedule, + .bat_ogm_emit = batadv_iv_ogm_emit, };int __init batadv_iv_init (void )
@@ -1277,11 +1280,11 @@ int __init batadv_iv_init(void)int ret;/* batman originator packet */ - ret =batadv_recv_handler_register (BAT_IV_OGM , bat_iv_ogm_receive); + ret =batadv_recv_handler_register (BAT_IV_OGM , batadv_iv_ogm_receive);if (ret <0 ) goto out; - ret =batadv_algo_register (&batman_iv); + ret =batadv_algo_register (&batadv_batman_iv);if (ret <0 ) goto handler_unregister;
Signature · 1 line
1.7.10
Marek Lindner
AppliedRe: [B.A.T.M.A.N.] [PATCH 02/18] batman-adv: Prefix bat_iv_ogm local static functions with batadv_
Quoted 9 lines · On Sunday, May 13, 2012 00:33:51 Sven Eckelmann wrote:
All non-static symbols of batman-adv were prefixed with
batadv_to avoid collisions with other symbols of the kernel. Other symbols of batman-adv should use the same prefix to keep the naming scheme consistent.Signed-off-by Sven Eckelmann <[email protected]>--- bat_iv_ogm.c | 255+++++++++++++++++++++++++++++----------------------------- 1 file changed, 129 insertions(+), 126 deletions(-)
Applied in revision 126772e.
Thanks,
Marek
PATCH 3/18 batman-adv: Prefix bat_sysfs local static functions with batadv_
In reply to Sven EckelmannAll non-static symbols of batman-adv were prefixed with batadv_ to avoid collisions with other symbols of the kernel. Other symbols of batman-adv should use the same prefix to keep the naming scheme consistent.
--- bat_sysfs.c | 250 ++++++++++++++++++++++++++++++++--------------------------- 1 file changed, 135 insertions(+), 115 deletions(-)
bat_sysfs.c +135 -115
@@ -26,15 +26,15 @@#include "gateway_client.h" #include "vis.h" -static struct net_device *kobj_to_netdev (struct kobject *obj) +static struct net_device *batadv_kobj_to_netdev (struct kobject *obj) { struct device *dev = container_of(obj->parent, struct device, kobj);return to_net_dev (dev); } -static struct bat_priv *kobj_to_batpriv (struct kobject *obj) +static struct bat_priv *batadv_kobj_to_batpriv (struct kobject *obj) { -struct net_device *net_dev =kobj_to_netdev (obj); +struct net_device *net_dev =batadv_kobj_to_netdev (obj);return netdev_priv (net_dev); }
@@ -42,19 +42,19 @@ static struct bat_priv *kobj_to_batpriv(struct kobject *obj)#define UEV_ACTION_VAR "BATACTION="#define UEV_DATA_VAR "BATDATA=" -static char *uev_action_str[] = { +static char *batadv_uev_action_str[] = {"add" ,"del" ,"change" }; -static char *uev_type_str[] = { +static char *batadv_uev_type_str[] = {"gw" };/* Use this, if you have customized show and store functions */ #define BAT_ATTR (_name, _mode, _show, _store) \ -struct bat_attribute bat_attr_##_name = { \ +struct bat_attribute batadv_attr_##_name = { \ .attr = {.name = __stringify(_name), \ .mode = _mode }, \ .show = _show, \
@@ -62,20 +62,21 @@ struct bat_attribute bat_attr_##_name = { \ };#define BAT_ATTR_SIF_STORE_BOOL (_name, _post_func) \ -ssize_t store_##_name(struct kobject *kobj, struct attribute *attr, \ - char *buff, size_t count) \ +ssize_t batadv_store_##_name(struct kobject *kobj, \ + struct attribute *attr, char *buff, \ + size_t count) \ { \ - struct net_device *net_dev = kobj_to_netdev(kobj); \ + struct net_device *net_dev = batadv_kobj_to_netdev(kobj); \ struct bat_priv *bat_priv = netdev_priv(net_dev); \ - return __store_bool_attr(buff, count, _post_func, attr, \ - &bat_priv->_name, net_dev); \ + return __batadv_store_bool_attr(buff, count, _post_func, attr, \ + &bat_priv->_name, net_dev); \ }#define BAT_ATTR_SIF_SHOW_BOOL (_name) \ -ssize_t show_##_name(struct kobject *kobj, \ - struct attribute *attr, char *buff) \ +ssize_t batadv_show_##_name(struct kobject *kobj, \ + struct attribute *attr, char *buff) \ { \ - struct bat_priv *bat_priv = kobj_to_batpriv(kobj); \ + struct bat_priv *bat_priv = batadv_kobj_to_batpriv(kobj); \ return sprintf(buff, "%s\n", \ atomic_read(&bat_priv->_name) == 0 ? \ "disabled" : "enabled"); \
@@ -87,24 +88,27 @@ ssize_t show_##_name(struct kobject *kobj, \#define BAT_ATTR_SIF_BOOL (_name, _mode, _post_func) \ static BAT_ATTR_SIF_STORE_BOOL(_name, _post_func) \ static BAT_ATTR_SIF_SHOW_BOOL(_name) \ - static BAT_ATTR(_name, _mode, show_##_name, store_##_name) + static BAT_ATTR(_name, _mode, batadv_show_##_name, \ + batadv_store_##_name)#define BAT_ATTR_SIF_STORE_UINT (_name, _min, _max, _post_func) \ -ssize_t store_##_name(struct kobject *kobj, struct attribute *attr, \ - char *buff, size_t count) \ +ssize_t batadv_store_##_name(struct kobject *kobj, \ + struct attribute *attr, char *buff, \ + size_t count) \ { \ - struct net_device *net_dev = kobj_to_netdev(kobj); \ + struct net_device *net_dev = batadv_kobj_to_netdev(kobj); \ struct bat_priv *bat_priv = netdev_priv(net_dev); \ - return __store_uint_attr(buff, count, _min, _max, _post_func, \ - attr, &bat_priv->_name, net_dev); \ + return __batadv_store_uint_attr(buff, count, _min, _max, \ + _post_func, attr, \ + &bat_priv->_name, net_dev); \ }#define BAT_ATTR_SIF_SHOW_UINT (_name) \ -ssize_t show_##_name(struct kobject *kobj, \ - struct attribute *attr, char *buff) \ +ssize_t batadv_show_##_name(struct kobject *kobj, \ + struct attribute *attr, char *buff) \ { \ - struct bat_priv *bat_priv = kobj_to_batpriv(kobj); \ + struct bat_priv *bat_priv = batadv_kobj_to_batpriv(kobj); \ return sprintf(buff, "%i\n", atomic_read(&bat_priv->_name)); \ } \
@@ -114,14 +118,16 @@ ssize_t show_##_name(struct kobject *kobj, \#define BAT_ATTR_SIF_UINT (_name, _mode, _min, _max, _post_func) \ static BAT_ATTR_SIF_STORE_UINT(_name, _min, _max, _post_func) \ static BAT_ATTR_SIF_SHOW_UINT(_name) \ - static BAT_ATTR(_name, _mode, show_##_name, store_##_name) + static BAT_ATTR(_name, _mode, batadv_show_##_name, \ + batadv_store_##_name)#define BAT_ATTR_HIF_STORE_UINT (_name, _min, _max, _post_func) \ -ssize_t store_##_name(struct kobject *kobj, struct attribute *attr, \ - char *buff, size_t count) \ +ssize_t batadv_store_##_name(struct kobject *kobj, \ + struct attribute *attr, char *buff, \ + size_t count) \ { \ - struct net_device *net_dev = kobj_to_netdev(kobj); \ + struct net_device *net_dev = batadv_kobj_to_netdev(kobj); \ struct hard_iface *hard_iface = batadv_hardif_get_by_netdev(net_dev); \ ssize_t length; \ \
@@ -136,10 +142,10 @@ ssize_t store_##_name(struct kobject *kobj, struct attribute *attr, \ }#define BAT_ATTR_HIF_SHOW_UINT (_name) \ -ssize_t show_##_name(struct kobject *kobj, \ - struct attribute *attr, char *buff) \ +ssize_t batadv_show_##_name(struct kobject *kobj, \ + struct attribute *attr, char *buff) \ { \ - struct net_device *net_dev = kobj_to_netdev(kobj); \ + struct net_device *net_dev = batadv_kobj_to_netdev(kobj); \ struct hard_iface *hard_iface = batadv_hardif_get_by_netdev(net_dev); \ ssize_t length; \ \
@@ -158,12 +164,13 @@ ssize_t show_##_name(struct kobject *kobj, \#define BAT_ATTR_HIF_UINT (_name, _mode, _min, _max, _post_func) \ static BAT_ATTR_HIF_STORE_UINT(_name, _min, _max, _post_func) \ static BAT_ATTR_HIF_SHOW_UINT(_name) \ - static BAT_ATTR(_name, _mode, show_##_name, store_##_name) + static BAT_ATTR(_name, _mode, batadv_show_##_name, \ + batadv_store_##_name) -static int store_bool_attr (char *buff,size_t count, -struct net_device *net_dev, -const char *attr_name,atomic_t *attr) +static int batadv_store_bool_attr (char *buff,size_t count, +struct net_device *net_dev, +const char *attr_name,atomic_t *attr) {int enabled =-1 ;
@@ -198,23 +205,27 @@ static int store_bool_attr(char *buff, size_t count,return count; } -static inline ssize_t __store_bool_attr (char *buff,size_t count, -void (*post_func)(struct net_device *), -struct attribute *attr, -atomic_t *attr_store,struct net_device *net_dev) +static inline ssize_t +__batadv_store_bool_attr (char *buff,size_t count, +void (*post_func)(struct net_device *), +struct attribute *attr, +atomic_t *attr_store,struct net_device *net_dev) {int ret; - ret =store_bool_attr (buff, count, net_dev, attr->name, attr_store); + ret =batadv_store_bool_attr (buff, count, net_dev, attr->name, + attr_store);if (post_func && ret)post_func (net_dev);return ret; } -static int store_uint_attr (const char *buff,size_t count, -struct net_device *net_dev,const char *attr_name, -unsigned int min,unsigned int max,atomic_t *attr) +static int batadv_store_uint_attr (const char *buff,size_t count, +struct net_device *net_dev, +const char *attr_name, +unsigned int min,unsigned int max, +atomic_t *attr) {unsigned long uint_val;int ret;
@@ -249,26 +260,27 @@ static int store_uint_attr(const char *buff, size_t count,return count; } -static inline ssize_t __store_uint_attr (const char *buff,size_t count, -int min,int max, -void (*post_func)(struct net_device *), -const struct attribute *attr, -atomic_t *attr_store,struct net_device *net_dev) +static inline ssize_t +__batadv_store_uint_attr (const char *buff,size_t count, +int min,int max, +void (*post_func)(struct net_device *), +const struct attribute *attr, +atomic_t *attr_store,struct net_device *net_dev) {int ret; - ret =store_uint_attr (buff, count, net_dev, attr->name, - min, max, attr_store); + ret =batadv_store_uint_attr (buff, count, net_dev, attr->name, min, max, + attr_store);if (post_func && ret)post_func (net_dev);return ret; } -static ssize_t show_vis_mode (struct kobject *kobj,struct attribute *attr, -char *buff) +static ssize_t batadv_show_vis_mode (struct kobject *kobj, +struct attribute *attr,char *buff) { -struct bat_priv *bat_priv =kobj_to_batpriv (kobj); +struct bat_priv *bat_priv =batadv_kobj_to_batpriv (kobj);int vis_mode =atomic_read (&bat_priv->vis_mode); return sprintf(buff, "%s\n",
@@ -276,10 +288,11 @@ static ssize_t show_vis_mode(struct kobject *kobj, struct attribute *attr, "client" : "server"); } -static ssize_t store_vis_mode (struct kobject *kobj,struct attribute *attr, -char *buff,size_t count) +static ssize_t batadv_store_vis_mode (struct kobject *kobj, +struct attribute *attr,char *buff, +size_t count) { -struct net_device *net_dev =kobj_to_netdev (kobj); +struct net_device *net_dev =batadv_kobj_to_netdev (kobj);struct bat_priv *bat_priv =netdev_priv (net_dev);unsigned long val;int ret, vis_mode_tmp =-1 ;
@@ -317,23 +330,23 @@ static ssize_t store_vis_mode(struct kobject *kobj, struct attribute *attr,return count; } -static ssize_t show_bat_algo (struct kobject *kobj,struct attribute *attr, -char *buff) +static ssize_t batadv_show_bat_algo (struct kobject *kobj, +struct attribute *attr,char *buff) { -struct bat_priv *bat_priv =kobj_to_batpriv (kobj); +struct bat_priv *bat_priv =batadv_kobj_to_batpriv (kobj);return sprintf (buff,"%s\n" , bat_priv->bat_algo_ops->name); } -static void post_gw_deselect (struct net_device *net_dev) +static void batadv_post_gw_deselect (struct net_device *net_dev) {struct bat_priv *bat_priv =netdev_priv (net_dev);batadv_gw_deselect (bat_priv); } -static ssize_t show_gw_mode (struct kobject *kobj,struct attribute *attr, -char *buff) +static ssize_t batadv_show_gw_mode (struct kobject *kobj,struct attribute *attr, +char *buff) { -struct bat_priv *bat_priv =kobj_to_batpriv (kobj); +struct bat_priv *bat_priv =batadv_kobj_to_batpriv (kobj);int bytes_written;switch (atomic_read (&bat_priv->gw_mode)) {
@@ -351,10 +364,11 @@ static ssize_t show_gw_mode(struct kobject *kobj, struct attribute *attr,return bytes_written; } -static ssize_t store_gw_mode (struct kobject *kobj,struct attribute *attr, -char *buff,size_t count) +static ssize_t batadv_store_gw_mode (struct kobject *kobj, +struct attribute *attr,char *buff, +size_t count) { -struct net_device *net_dev =kobj_to_netdev (kobj); +struct net_device *net_dev =batadv_kobj_to_netdev (kobj);struct bat_priv *bat_priv =netdev_priv (net_dev);char *curr_gw_mode_str;int gw_mode_tmp =-1 ;
@@ -403,10 +417,10 @@ static ssize_t store_gw_mode(struct kobject *kobj, struct attribute *attr,return count; } -static ssize_t show_gw_bwidth (struct kobject *kobj,struct attribute *attr, -char *buff) +static ssize_t batadv_show_gw_bwidth (struct kobject *kobj, +struct attribute *attr,char *buff) { -struct bat_priv *bat_priv =kobj_to_batpriv (kobj); +struct bat_priv *bat_priv =batadv_kobj_to_batpriv (kobj);int down, up;int gw_bandwidth =atomic_read (&bat_priv->gw_bandwidth);
@@ -418,10 +432,11 @@ static ssize_t show_gw_bwidth(struct kobject *kobj, struct attribute *attr, (up > 2048 ? "MBit" : "KBit")); } -static ssize_t store_gw_bwidth (struct kobject *kobj,struct attribute *attr, -char *buff,size_t count) +static ssize_t batadv_store_gw_bwidth (struct kobject *kobj, +struct attribute *attr,char *buff, +size_t count) { -struct net_device *net_dev =kobj_to_netdev (kobj); +struct net_device *net_dev =batadv_kobj_to_netdev (kobj);if (buff[count -1 ] =='\n' ) buff[count -1 ] ='\0' ;
@@ -436,36 +451,38 @@ BAT_ATTR_SIF_BOOL(bridge_loop_avoidance, S_IRUGO | S_IWUSR, NULL);#endif BAT_ATTR_SIF_BOOL (fragmentation,S_IRUGO |S_IWUSR , batadv_update_min_mtu);BAT_ATTR_SIF_BOOL (ap_isolation,S_IRUGO |S_IWUSR ,NULL ); -static BAT_ATTR(vis_mode, S_IRUGO | S_IWUSR, show_vis_mode, store_vis_mode); -static BAT_ATTR(routing_algo, S_IRUGO, show_bat_algo, NULL); -static BAT_ATTR(gw_mode, S_IRUGO | S_IWUSR, show_gw_mode, store_gw_mode); +static BAT_ATTR(vis_mode, S_IRUGO | S_IWUSR, batadv_show_vis_mode, + batadv_store_vis_mode); +static BAT_ATTR(routing_algo, S_IRUGO, batadv_show_bat_algo, NULL); +static BAT_ATTR(gw_mode, S_IRUGO | S_IWUSR, batadv_show_gw_mode, + batadv_store_gw_mode);BAT_ATTR_SIF_UINT (orig_interval,S_IRUGO |S_IWUSR ,2 *JITTER ,INT_MAX ,NULL );BAT_ATTR_SIF_UINT (hop_penalty,S_IRUGO |S_IWUSR ,0 ,TQ_MAX_VALUE ,NULL );BAT_ATTR_SIF_UINT (gw_sel_class,S_IRUGO |S_IWUSR ,1 ,TQ_MAX_VALUE , - post_gw_deselect); -static BAT_ATTR(gw_bandwidth, S_IRUGO | S_IWUSR, show_gw_bwidth, - store_gw_bwidth); + batadv_post_gw_deselect); +static BAT_ATTR(gw_bandwidth, S_IRUGO | S_IWUSR, batadv_show_gw_bwidth, + batadv_store_gw_bwidth);#ifdef CONFIG_BATMAN_ADV_DEBUG BAT_ATTR_SIF_UINT (log_level,S_IRUGO |S_IWUSR ,0 ,DBG_ALL ,NULL );#endif -static struct bat_attribute *mesh_attrs[] = { - &bat_attr_aggregated_ogms, - &bat_attr_bonding, +static struct bat_attribute *batadv_mesh_attrs[] = { + &batadv_attr_aggregated_ogms, + &batadv_attr_bonding, #ifdef CONFIG_BATMAN_ADV_BLA - &bat_attr_bridge_loop_avoidance, + &batadv_attr_bridge_loop_avoidance, #endif - &bat_attr_fragmentation, - &bat_attr_ap_isolation, - &bat_attr_vis_mode, - &bat_attr_routing_algo, - &bat_attr_gw_mode, - &bat_attr_orig_interval, - &bat_attr_hop_penalty, - &bat_attr_gw_sel_class, - &bat_attr_gw_bandwidth, + &batadv_attr_fragmentation, + &batadv_attr_ap_isolation, + &batadv_attr_vis_mode, + &batadv_attr_routing_algo, + &batadv_attr_gw_mode, + &batadv_attr_orig_interval, + &batadv_attr_hop_penalty, + &batadv_attr_gw_sel_class, + &batadv_attr_gw_bandwidth, #ifdef CONFIG_BATMAN_ADV_DEBUG - &bat_attr_log_level, + &batadv_attr_log_level, #endifNULL , };
@@ -485,7 +502,7 @@ int batadv_sysfs_add_meshif(struct net_device *dev) goto out; } -for (bat_attr = mesh_attrs; *bat_attr; ++bat_attr) { +for (bat_attr = batadv_mesh_attrs; *bat_attr; ++bat_attr) { err =sysfs_create_file (bat_priv->mesh_obj, &((*bat_attr)->attr));if (err) {
@@ -499,7 +516,7 @@ int batadv_sysfs_add_meshif(struct net_device *dev)return 0 ; rem_attr: -for (bat_attr = mesh_attrs; *bat_attr; ++bat_attr) +for (bat_attr = batadv_mesh_attrs; *bat_attr; ++bat_attr)sysfs_remove_file (bat_priv->mesh_obj, &((*bat_attr)->attr));kobject_put (bat_priv->mesh_obj);
@@ -513,17 +530,17 @@ void batadv_sysfs_del_meshif(struct net_device *dev)struct bat_priv *bat_priv =netdev_priv (dev);struct bat_attribute **bat_attr; -for (bat_attr = mesh_attrs; *bat_attr; ++bat_attr) +for (bat_attr = batadv_mesh_attrs; *bat_attr; ++bat_attr)sysfs_remove_file (bat_priv->mesh_obj, &((*bat_attr)->attr));kobject_put (bat_priv->mesh_obj); bat_priv->mesh_obj =NULL ; } -static ssize_t show_mesh_iface (struct kobject *kobj,struct attribute *attr, -char *buff) +static ssize_t batadv_show_mesh_iface (struct kobject *kobj, +struct attribute *attr,char *buff) { -struct net_device *net_dev =kobj_to_netdev (kobj); +struct net_device *net_dev =batadv_kobj_to_netdev (kobj);struct hard_iface *hard_iface =batadv_hardif_get_by_netdev (net_dev);ssize_t length;
@@ -538,10 +555,11 @@ static ssize_t show_mesh_iface(struct kobject *kobj, struct attribute *attr,return length; } -static ssize_t store_mesh_iface (struct kobject *kobj,struct attribute *attr, -char *buff,size_t count) +static ssize_t batadv_store_mesh_iface (struct kobject *kobj, +struct attribute *attr,char *buff, +size_t count) { -struct net_device *net_dev =kobj_to_netdev (kobj); +struct net_device *net_dev =batadv_kobj_to_netdev (kobj);struct hard_iface *hard_iface =batadv_hardif_get_by_netdev (net_dev);int status_tmp =-1 ;int ret = count;
@@ -594,10 +612,10 @@ out:return ret; } -static ssize_t show_iface_status (struct kobject *kobj,struct attribute *attr, -char *buff) +static ssize_t batadv_show_iface_status (struct kobject *kobj, +struct attribute *attr,char *buff) { -struct net_device *net_dev =kobj_to_netdev (kobj); +struct net_device *net_dev =batadv_kobj_to_netdev (kobj);struct hard_iface *hard_iface =batadv_hardif_get_by_netdev (net_dev);ssize_t length;
@@ -629,12 +647,12 @@ static ssize_t show_iface_status(struct kobject *kobj, struct attribute *attr, } static BAT_ATTR(mesh_iface, S_IRUGO | S_IWUSR, - show_mesh_iface, store_mesh_iface); -static BAT_ATTR(iface_status, S_IRUGO, show_iface_status, NULL); + batadv_show_mesh_iface, batadv_store_mesh_iface); +static BAT_ATTR(iface_status, S_IRUGO, batadv_show_iface_status, NULL); -static struct bat_attribute *batman_attrs[] = { - &bat_attr_mesh_iface, - &bat_attr_iface_status, +static struct bat_attribute *batadv_batman_attrs[] = { + &batadv_attr_mesh_iface, + &batadv_attr_iface_status,NULL , };
@@ -653,7 +671,7 @@ int batadv_sysfs_add_hardif(struct kobject **hardif_obj, struct net_device *dev) goto out; } -for (bat_attr = batman_attrs; *bat_attr; ++bat_attr) { +for (bat_attr = batadv_batman_attrs; *bat_attr; ++bat_attr) { err =sysfs_create_file (*hardif_obj, &((*bat_attr)->attr));if (err) { bat_err(dev, "Can't add sysfs file: %s/%s/%s\n",
@@ -666,7 +684,7 @@ int batadv_sysfs_add_hardif(struct kobject **hardif_obj, struct net_device *dev)return 0 ; rem_attr: -for (bat_attr = batman_attrs; *bat_attr; ++bat_attr) +for (bat_attr = batadv_batman_attrs; *bat_attr; ++bat_attr)sysfs_remove_file (*hardif_obj, &((*bat_attr)->attr)); out:return -ENOMEM ;
@@ -693,20 +711,21 @@ int batadv_throw_uevent(struct bat_priv *bat_priv, enum uev_type type, bat_kobj = &primary_if->soft_iface->dev.kobj; uevent_env[0 ] =kmalloc (strlen (UEV_TYPE_VAR ) + -strlen (uev_type_str[type]) +1 , +strlen (batadv_uev_type_str[type]) +1 ,GFP_ATOMIC );if (!uevent_env[0 ]) goto out; -sprintf (uevent_env[0 ],"%s%s" ,UEV_TYPE_VAR , uev_type_str[type]); +sprintf (uevent_env[0 ],"%s%s" ,UEV_TYPE_VAR , batadv_uev_type_str[type]); uevent_env[1 ] =kmalloc (strlen (UEV_ACTION_VAR ) + -strlen (uev_action_str[action]) +1 , +strlen (batadv_uev_action_str[action]) +1 ,GFP_ATOMIC );if (!uevent_env[1 ]) goto out; -sprintf (uevent_env[1 ],"%s%s" ,UEV_ACTION_VAR , uev_action_str[action]); +sprintf (uevent_env[1 ],"%s%s" ,UEV_ACTION_VAR , + batadv_uev_action_str[action]);/* If the event is DEL, ignore the data field */ if (action !=UEV_DEL ) {
@@ -730,7 +749,8 @@ out:if (ret)batadv_dbg (DBG_BATMAN , bat_priv,"Impossible to send uevent for (%s,%s,%s) event (err: %d)\n" , - uev_type_str[type], uev_action_str[action], + batadv_uev_type_str[type], + batadv_uev_action_str[action], (action ==UEV_DEL ?"NULL" : data), ret);return ret; }
Signature · 1 line
1.7.10
Marek Lindner
AppliedRe: [B.A.T.M.A.N.] [PATCH 03/18] batman-adv: Prefix bat_sysfs local static functions with batadv_
Quoted 9 lines · On Sunday, May 13, 2012 00:33:52 Sven Eckelmann wrote:
All non-static symbols of batman-adv were prefixed with
batadv_to avoid collisions with other symbols of the kernel. Other symbols of batman-adv should use the same prefix to keep the naming scheme consistent.Signed-off-by Sven Eckelmann <[email protected]>--- bat_sysfs.c | 250++++++++++++++++++++++++++++++++--------------------------- 1 file changed, 135 insertions(+), 115 deletions(-)
Applied in revision 98881e4.
Thanks,
Marek
Re: [B.A.T.M.A.N.] [PATCH 03/18] batman-adv: Prefix bat_sysfs local static functions with batadv_
Quoted 10 lines · On Tuesday 15 May 2012 17:54:58 Marek Lindner wrote:
Quoted 9 lines · On Sunday, May 13, 2012 00:33:52 Sven Eckelmann wrote:
All non-static symbols of batman-adv were prefixed with
batadv_to avoid collisions with other symbols of the kernel. Other symbols of batman-adv should use the same prefix to keep the naming scheme consistent.Signed-off-by Sven Eckelmann <[email protected]>---
bat_sysfs.c | 250
Quoted 7 lines
Quoted 2 lines
++++++++++++++++++++++++++++++++--------------------------- 1 file changed, 135 insertions(+), 115 deletions(-)
Applied in revision 98881e4.
Thanks,
Marek
But you only committed it partially. There are parts missing
Just to show what is missing:
@@ -123,8 +123,9 @@ ssize_t batadv_show_##_name(struct kobject *kobj, \
#define BAT_ATTR_HIF_STORE_UINT(_name, _min, _max, _post_func) \
-ssize_t store_##_name(struct kobject *kobj, struct attribute *attr, \
- char *buff, size_t count) \
+ssize_t batadv_store_##_name(struct kobject *kobj, \
+ struct attribute *attr, char *buff, \
+ size_t count) \
{ \
struct net_device *net_dev = batadv_kobj_to_netdev(kobj); \
struct hard_iface *hard_iface; \
@@ -142,8 +143,8 @@ ssize_t store_##_name(struct kobject *kobj, struct attribute *attr, \
}
#define BAT_ATTR_HIF_SHOW_UINT(_name) \
-ssize_t show_##_name(struct kobject *kobj, \
- struct attribute *attr, char *buff) \
+ssize_t batadv_show_##_name(struct kobject *kobj, \
+ struct attribute *attr, char *buff) \
{ \
struct net_device *net_dev = batadv_kobj_to_netdev(kobj); \
struct hard_iface *hard_iface; \
PATCH 4/18 batman-adv: Prefix bridge_loop_avoidance local static functions with batadv_
In reply to Sven EckelmannAll non-static symbols of batman-adv were prefixed with batadv_ to avoid collisions with other symbols of the kernel. Other symbols of batman-adv should use the same prefix to keep the naming scheme consistent.
--- bridge_loop_avoidance.c | 320 +++++++++++++++++++++++++---------------------- 1 file changed, 168 insertions(+), 152 deletions(-)
bridge_loop_avoidance.c +168 -152
@@ -31,14 +31,14 @@#include <net/arp.h> #include <linux/if_vlan.h> -static const uint8_t announce_mac[4 ] = {0x43 ,0x05 ,0x43 ,0x05 }; +static const uint8_t batadv_announce_mac[4 ] = {0x43 ,0x05 ,0x43 ,0x05 }; -static void bla_periodic_work (struct work_struct *work); -static void bla_send_announce (struct bat_priv *bat_priv, -struct backbone_gw *backbone_gw); +static void batadv_bla_periodic_work (struct work_struct *work); +static void batadv_bla_send_announce (struct bat_priv *bat_priv, +struct backbone_gw *backbone_gw);/* return the index of the claim */ -static inline uint32_t choose_claim (const void *data,uint32_t size) +static inline uint32_t batadv_choose_claim (const void *data,uint32_t size) {const unsigned char *key = data;uint32_t hash =0 ;
@@ -58,7 +58,8 @@ static inline uint32_t choose_claim(const void *data, uint32_t size) }/* return the index of the backbone gateway */ -static inline uint32_t choose_backbone_gw (const void *data,uint32_t size) +static inline uint32_t batadv_choose_backbone_gw (const void *data, +uint32_t size) {const unsigned char *key = data;uint32_t hash =0 ;
@@ -79,7 +80,8 @@ static inline uint32_t choose_backbone_gw(const void *data, uint32_t size)/* compares address and vid of two backbone gws */ -static int compare_backbone_gw (const struct hlist_node *node,const void *data2) +static int batadv_compare_backbone_gw (const struct hlist_node *node, +const void *data2) { const void *data1 = container_of(node, struct backbone_gw, hash_entry);
@@ -88,7 +90,8 @@ static int compare_backbone_gw(const struct hlist_node *node, const void *data2) }/* compares address and vid of two claims */ -static int compare_claim (const struct hlist_node *node,const void *data2) +static int batadv_compare_claim (const struct hlist_node *node, +const void *data2) { const void *data1 = container_of(node, struct claim, hash_entry);
@@ -97,28 +100,28 @@ static int compare_claim(const struct hlist_node *node, const void *data2) }/* free a backbone gw */ -static void backbone_gw_free_ref (struct backbone_gw *backbone_gw) +static void batadv_backbone_gw_free_ref (struct backbone_gw *backbone_gw) {if (atomic_dec_and_test (&backbone_gw->refcount))kfree_rcu (backbone_gw, rcu); }/* finally deinitialize the claim */ -static void claim_free_rcu (struct rcu_head *rcu) +static void batadv_claim_free_rcu (struct rcu_head *rcu) {struct claim *claim; claim = container_of(rcu, struct claim, rcu); -backbone_gw_free_ref (claim->backbone_gw); +batadv_backbone_gw_free_ref (claim->backbone_gw);kfree (claim); }/* free a claim, call claim_free_rcu if its the last reference */ -static void claim_free_ref (struct claim *claim) +static void batadv_claim_free_ref (struct claim *claim) {if (atomic_dec_and_test (&claim->refcount)) -call_rcu (&claim->rcu, claim_free_rcu); +call_rcu (&claim->rcu, batadv_claim_free_rcu); }/* @bat_priv: the bat priv with all the soft interface information
@@ -127,8 +130,8 @@ static void claim_free_ref(struct claim *claim)* looks for a claim in the hash, and returns it if found * or NULL otherwise. */ -static struct claim *claim_hash_find (struct bat_priv *bat_priv, -struct claim *data) +static struct claim *batadv_claim_hash_find (struct bat_priv *bat_priv, +struct claim *data) {struct hashtable_t *hash = bat_priv->claim_hash;struct hlist_head *head;
@@ -140,12 +143,12 @@ static struct claim *claim_hash_find(struct bat_priv *bat_priv,if (!hash)return NULL ; - index =choose_claim (data, hash->size); + index =batadv_choose_claim (data, hash->size); head = &hash->table[index];rcu_read_lock ();hlist_for_each_entry_rcu (claim, node, head, hash_entry) { -if (!compare_claim (&claim->hash_entry, data)) +if (!batadv_compare_claim (&claim->hash_entry, data))continue ;if (!atomic_inc_not_zero (&claim->refcount))
@@ -166,8 +169,8 @@ static struct claim *claim_hash_find(struct bat_priv *bat_priv,* looks for a claim in the hash, and returns it if found * or NULL otherwise. */ -static struct backbone_gw *backbone_hash_find (struct bat_priv *bat_priv, -uint8_t *addr,short vid) +static struct backbone_gw *batadv_backbone_hash_find (struct bat_priv *bat_priv, +uint8_t *addr,short vid) {struct hashtable_t *hash = bat_priv->backbone_hash;struct hlist_head *head;
@@ -182,13 +185,13 @@ static struct backbone_gw *backbone_hash_find(struct bat_priv *bat_priv,memcpy (search_entry.orig, addr,ETH_ALEN ); search_entry.vid = vid; - index =choose_backbone_gw (&search_entry, hash->size); + index =batadv_choose_backbone_gw (&search_entry, hash->size); head = &hash->table[index];rcu_read_lock ();hlist_for_each_entry_rcu (backbone_gw, node, head, hash_entry) { -if (!compare_backbone_gw (&backbone_gw->hash_entry, - &search_entry)) +if (!batadv_compare_backbone_gw (&backbone_gw->hash_entry, + &search_entry))continue ;if (!atomic_inc_not_zero (&backbone_gw->refcount))
@@ -203,7 +206,7 @@ static struct backbone_gw *backbone_hash_find(struct bat_priv *bat_priv, }/* delete all claims for a backbone */ -static void bla_del_backbone_claims (struct backbone_gw *backbone_gw) +static void batadv_bla_del_backbone_claims (struct backbone_gw *backbone_gw) {struct hashtable_t *hash;struct hlist_node *node, *node_tmp;
@@ -227,7 +230,7 @@ static void bla_del_backbone_claims(struct backbone_gw *backbone_gw)if (claim->backbone_gw != backbone_gw)continue ; -claim_free_ref (claim); +batadv_claim_free_ref (claim);hlist_del_rcu (node); }spin_unlock_bh (list_lock);
@@ -244,8 +247,8 @@ static void bla_del_backbone_claims(struct backbone_gw *backbone_gw)* * sends a claim frame according to the provided info. */ -static void bla_send_claim (struct bat_priv *bat_priv,uint8_t *mac, -short vid,int claimtype) +static void batadv_bla_send_claim (struct bat_priv *bat_priv,uint8_t *mac, +short vid,int claimtype) {struct sk_buff *skb;struct ethhdr *ethhdr;
@@ -350,14 +353,14 @@ out:* searches for the backbone gw or creates a new one if it could not * be found. */ -static struct backbone_gw *bla_get_backbone_gw (struct bat_priv *bat_priv, -uint8_t *orig,short vid) +static struct backbone_gw *batadv_bla_get_backbone_gw (struct bat_priv *bat_priv, +uint8_t *orig,short vid) {struct backbone_gw *entry;struct orig_node *orig_node;int hash_added; - entry =backbone_hash_find (bat_priv, orig, vid); + entry =batadv_backbone_hash_find (bat_priv, orig, vid);if (entry)return entry;
@@ -381,8 +384,9 @@ static struct backbone_gw *bla_get_backbone_gw(struct bat_priv *bat_priv,atomic_set (&entry->refcount,2 ); hash_added =batadv_hash_add (bat_priv->backbone_hash, - compare_backbone_gw, choose_backbone_gw, - entry, &entry->hash_entry); + batadv_compare_backbone_gw, + batadv_choose_backbone_gw, entry, + &entry->hash_entry);if (unlikely (hash_added !=0 )) {/* hash failed, free the structure */
@@ -403,19 +407,20 @@ static struct backbone_gw *bla_get_backbone_gw(struct bat_priv *bat_priv,/* update or add the own backbone gw to make sure we announce * where we receive other backbone gws */ -static void bla_update_own_backbone_gw (struct bat_priv *bat_priv, -struct hard_iface *primary_if, -short vid) +static void batadv_bla_update_own_backbone_gw (struct bat_priv *bat_priv, +struct hard_iface *primary_if, +short vid) {struct backbone_gw *backbone_gw; - backbone_gw =bla_get_backbone_gw (bat_priv, - primary_if->net_dev->dev_addr, vid); + backbone_gw =batadv_bla_get_backbone_gw (bat_priv, + primary_if->net_dev->dev_addr, + vid);if (unlikely (!backbone_gw))return ; backbone_gw->lasttime = jiffies; -backbone_gw_free_ref (backbone_gw); +batadv_backbone_gw_free_ref (backbone_gw); }/* @bat_priv: the bat priv with all the soft interface information
@@ -424,8 +429,8 @@ static void bla_update_own_backbone_gw(struct bat_priv *bat_priv,* Repeat all of our own claims, and finally send an ANNOUNCE frame * to allow the requester another check if the CRC is correct now. */ -static void bla_answer_request (struct bat_priv *bat_priv, -struct hard_iface *primary_if,short vid) +static void batadv_bla_answer_request (struct bat_priv *bat_priv, +struct hard_iface *primary_if,short vid) {struct hlist_node *node;struct hlist_head *head;
@@ -437,8 +442,9 @@ static void bla_answer_request(struct bat_priv *bat_priv,batadv_dbg (DBG_BLA , bat_priv,"bla_answer_request(): received a claim request, send all of our own claims again\n" ); - backbone_gw =backbone_hash_find (bat_priv, - primary_if->net_dev->dev_addr, vid); + backbone_gw =batadv_backbone_hash_find (bat_priv, + primary_if->net_dev->dev_addr, + vid);if (!backbone_gw)return ;
@@ -452,15 +458,15 @@ static void bla_answer_request(struct bat_priv *bat_priv,if (claim->backbone_gw != backbone_gw)continue ; -bla_send_claim (bat_priv, claim->addr, claim->vid, -CLAIM_TYPE_ADD ); +batadv_bla_send_claim (bat_priv, claim->addr, claim->vid, +CLAIM_TYPE_ADD ); }rcu_read_unlock (); }/* finally, send an announcement frame */ -bla_send_announce (bat_priv, backbone_gw); -backbone_gw_free_ref (backbone_gw); +batadv_bla_send_announce (bat_priv, backbone_gw); +batadv_backbone_gw_free_ref (backbone_gw); }/* @backbone_gw: the backbone gateway from whom we are out of sync
@@ -469,17 +475,17 @@ static void bla_answer_request(struct bat_priv *bat_priv,* After the request, it will repeat all of his own claims and finally * send an announcement claim with which we can check again. */ -static void bla_send_request (struct backbone_gw *backbone_gw) +static void batadv_bla_send_request (struct backbone_gw *backbone_gw) {/* first, remove all old entries */ -bla_del_backbone_claims (backbone_gw); +batadv_bla_del_backbone_claims (backbone_gw);batadv_dbg (DBG_BLA , backbone_gw->bat_priv,"Sending REQUEST to %pM\n" , backbone_gw->orig);/* send request */ -bla_send_claim (backbone_gw->bat_priv, backbone_gw->orig, - backbone_gw->vid,CLAIM_TYPE_REQUEST ); +batadv_bla_send_claim (backbone_gw->bat_priv, backbone_gw->orig, + backbone_gw->vid,CLAIM_TYPE_REQUEST );/* no local broadcasts should be sent or received, for now. */ if (!atomic_read (&backbone_gw->request_sent)) {
@@ -494,17 +500,18 @@ static void bla_send_request(struct backbone_gw *backbone_gw)* This function sends an announcement. It is called from multiple * places. */ -static void bla_send_announce (struct bat_priv *bat_priv, -struct backbone_gw *backbone_gw) +static void batadv_bla_send_announce (struct bat_priv *bat_priv, +struct backbone_gw *backbone_gw) {uint8_t mac[ETH_ALEN ];__be16 crc; -memcpy (mac, announce_mac,4 ); +memcpy (mac, batadv_announce_mac,4 ); crc =htons (backbone_gw->crc);memcpy (&mac[4 ], &crc,2 ); -bla_send_claim (bat_priv, mac, backbone_gw->vid,CLAIM_TYPE_ANNOUNCE ); +batadv_bla_send_claim (bat_priv, mac, backbone_gw->vid, +CLAIM_TYPE_ANNOUNCE ); }
@@ -515,8 +522,9 @@ static void bla_send_announce(struct bat_priv *bat_priv,* * Adds a claim in the claim hash. */ -static void bla_add_claim (struct bat_priv *bat_priv,const uint8_t *mac, -const short vid,struct backbone_gw *backbone_gw) +static void batadv_bla_add_claim (struct bat_priv *bat_priv,const uint8_t *mac, +const short vid, +struct backbone_gw *backbone_gw) {struct claim *claim;struct claim search_claim;
@@ -524,7 +532,7 @@ static void bla_add_claim(struct bat_priv *bat_priv, const uint8_t *mac,memcpy (search_claim.addr, mac,ETH_ALEN ); search_claim.vid = vid; - claim =claim_hash_find (bat_priv, &search_claim); + claim =batadv_claim_hash_find (bat_priv, &search_claim);/* create a new claim entry if it does not exist yet. */ if (!claim) {
@@ -542,8 +550,9 @@ static void bla_add_claim(struct bat_priv *bat_priv, const uint8_t *mac,"bla_add_claim(): adding new entry %pM, vid %d to hash ...\n" , mac, vid); hash_added =batadv_hash_add (bat_priv->claim_hash, - compare_claim, choose_claim, - claim, &claim->hash_entry); + batadv_compare_claim, + batadv_choose_claim, claim, + &claim->hash_entry);if (unlikely (hash_added !=0 )) {/* only local changes happened. */
@@ -562,7 +571,7 @@ static void bla_add_claim(struct bat_priv *bat_priv, const uint8_t *mac, claim->backbone_gw->crc ^=crc16 (0 , claim->addr,ETH_ALEN ); -backbone_gw_free_ref (claim->backbone_gw); +batadv_backbone_gw_free_ref (claim->backbone_gw); }/* set (new) backbone gw */
@@ -573,47 +582,48 @@ static void bla_add_claim(struct bat_priv *bat_priv, const uint8_t *mac, backbone_gw->lasttime = jiffies; claim_free_ref: -claim_free_ref (claim); +batadv_claim_free_ref (claim); }/* Delete a claim from the claim hash which has the * given mac address and vid. */ -static void bla_del_claim (struct bat_priv *bat_priv,const uint8_t *mac, -const short vid) +static void batadv_bla_del_claim (struct bat_priv *bat_priv,const uint8_t *mac, +const short vid) {struct claim search_claim, *claim;memcpy (search_claim.addr, mac,ETH_ALEN ); search_claim.vid = vid; - claim =claim_hash_find (bat_priv, &search_claim); + claim =batadv_claim_hash_find (bat_priv, &search_claim);if (!claim)return ;batadv_dbg (DBG_BLA , bat_priv,"bla_del_claim(): %pM, vid %d\n" , mac, vid); -batadv_hash_remove (bat_priv->claim_hash, compare_claim, choose_claim, - claim); -claim_free_ref (claim);/* reference from the hash is gone */ +batadv_hash_remove (bat_priv->claim_hash, batadv_compare_claim, + batadv_choose_claim, claim); +batadv_claim_free_ref (claim);/* reference from the hash is gone */ claim->backbone_gw->crc ^=crc16 (0 , claim->addr,ETH_ALEN );/* don't need the reference from hash_find() anymore */ -claim_free_ref (claim); +batadv_claim_free_ref (claim); }/* check for ANNOUNCE frame, return 1 if handled */ -static int handle_announce (struct bat_priv *bat_priv, -uint8_t *an_addr,uint8_t *backbone_addr,short vid) +static int batadv_handle_announce (struct bat_priv *bat_priv, +uint8_t *an_addr,uint8_t *backbone_addr, +short vid) {struct backbone_gw *backbone_gw;uint16_t crc; -if (memcmp (an_addr, announce_mac,4 ) !=0 ) +if (memcmp (an_addr, batadv_announce_mac,4 ) !=0 )return 0 ; - backbone_gw =bla_get_backbone_gw (bat_priv, backbone_addr, vid); + backbone_gw =batadv_bla_get_backbone_gw (bat_priv, backbone_addr, vid);if (unlikely (!backbone_gw))return 1 ;
@@ -633,7 +643,7 @@ static int handle_announce(struct bat_priv *bat_priv, backbone_gw->orig, backbone_gw->vid, backbone_gw->crc, crc); -bla_send_request (backbone_gw); +batadv_bla_send_request (backbone_gw); }else {/* if we have sent a request and the crc was OK, * we can allow traffic again.
@@ -644,15 +654,15 @@ static int handle_announce(struct bat_priv *bat_priv, } } -backbone_gw_free_ref (backbone_gw); +batadv_backbone_gw_free_ref (backbone_gw);return 1 ; }/* check for REQUEST frame, return 1 if handled */ -static int handle_request (struct bat_priv *bat_priv, -struct hard_iface *primary_if, -uint8_t *backbone_addr, -struct ethhdr *ethhdr,short vid) +static int batadv_handle_request (struct bat_priv *bat_priv, +struct hard_iface *primary_if, +uint8_t *backbone_addr, +struct ethhdr *ethhdr,short vid) {/* check for REQUEST frame */ if (!batadv_compare_eth (backbone_addr, ethhdr->h_dest))
@@ -668,24 +678,25 @@ static int handle_request(struct bat_priv *bat_priv,"handle_request(): REQUEST vid %d (sent by %pM)...\n" , vid, ethhdr->h_source); -bla_answer_request (bat_priv, primary_if, vid); +batadv_bla_answer_request (bat_priv, primary_if, vid);return 1 ; }/* check for UNCLAIM frame, return 1 if handled */ -static int handle_unclaim (struct bat_priv *bat_priv, -struct hard_iface *primary_if, -uint8_t *backbone_addr, -uint8_t *claim_addr,short vid) +static int batadv_handle_unclaim (struct bat_priv *bat_priv, +struct hard_iface *primary_if, +uint8_t *backbone_addr, +uint8_t *claim_addr,short vid) {struct backbone_gw *backbone_gw;/* unclaim in any case if it is our own */ if (primary_if &&batadv_compare_eth (backbone_addr, primary_if->net_dev->dev_addr)) -bla_send_claim (bat_priv, claim_addr, vid,CLAIM_TYPE_DEL ); +batadv_bla_send_claim (bat_priv, claim_addr, vid, +CLAIM_TYPE_DEL ); - backbone_gw =backbone_hash_find (bat_priv, backbone_addr, vid); + backbone_gw =batadv_backbone_hash_find (bat_priv, backbone_addr, vid);if (!backbone_gw)return 1 ;
@@ -695,33 +706,35 @@ static int handle_unclaim(struct bat_priv *bat_priv,"handle_unclaim(): UNCLAIM %pM on vid %d (sent by %pM)...\n" , claim_addr, vid, backbone_gw->orig); -bla_del_claim (bat_priv, claim_addr, vid); -backbone_gw_free_ref (backbone_gw); +batadv_bla_del_claim (bat_priv, claim_addr, vid); +batadv_backbone_gw_free_ref (backbone_gw);return 1 ; }/* check for CLAIM frame, return 1 if handled */ -static int handle_claim (struct bat_priv *bat_priv, -struct hard_iface *primary_if,uint8_t *backbone_addr, -uint8_t *claim_addr,short vid) +static int batadv_handle_claim (struct bat_priv *bat_priv, +struct hard_iface *primary_if, +uint8_t *backbone_addr,uint8_t *claim_addr, +short vid) {struct backbone_gw *backbone_gw;/* register the gateway if not yet available, and add the claim. */ - backbone_gw =bla_get_backbone_gw (bat_priv, backbone_addr, vid); + backbone_gw =batadv_bla_get_backbone_gw (bat_priv, backbone_addr, vid);if (unlikely (!backbone_gw))return 1 ;/* this must be a CLAIM frame */ -bla_add_claim (bat_priv, claim_addr, vid, backbone_gw); +batadv_bla_add_claim (bat_priv, claim_addr, vid, backbone_gw);if (batadv_compare_eth (backbone_addr, primary_if->net_dev->dev_addr)) -bla_send_claim (bat_priv, claim_addr, vid,CLAIM_TYPE_ADD ); +batadv_bla_send_claim (bat_priv, claim_addr, vid, +CLAIM_TYPE_ADD );/* TODO: we could call something like tt_local_del() here. */ -backbone_gw_free_ref (backbone_gw); +batadv_backbone_gw_free_ref (backbone_gw);return 1 ; }
@@ -739,10 +752,10 @@ static int handle_claim(struct bat_priv *bat_priv,* 1 - if is a claim packet from another group * 0 - if it is not a claim packet */ -static int check_claim_group (struct bat_priv *bat_priv, -struct hard_iface *primary_if, -uint8_t *hw_src,uint8_t *hw_dst, -struct ethhdr *ethhdr) +static int batadv_check_claim_group (struct bat_priv *bat_priv, +struct hard_iface *primary_if, +uint8_t *hw_src,uint8_t *hw_dst, +struct ethhdr *ethhdr) {uint8_t *backbone_addr;struct orig_node *orig_node;
@@ -811,9 +824,9 @@ static int check_claim_group(struct bat_priv *bat_priv,* returns 1 if it was a claim frame, otherwise return 0 to * tell the callee that it can use the frame on its own. */ -static int bla_process_claim (struct bat_priv *bat_priv, -struct hard_iface *primary_if, -struct sk_buff *skb) +static int batadv_bla_process_claim (struct bat_priv *bat_priv, +struct hard_iface *primary_if, +struct sk_buff *skb) {struct ethhdr *ethhdr;struct vlan_ethhdr *vhdr;
@@ -866,7 +879,8 @@ static int bla_process_claim(struct bat_priv *bat_priv, bla_dst = (struct bla_claim_dst *)hw_dst;/* check if it is a claim frame. */ - ret =check_claim_group (bat_priv, primary_if, hw_src, hw_dst, ethhdr); + ret =batadv_check_claim_group (bat_priv, primary_if, hw_src, hw_dst, + ethhdr);if (ret ==1 ) batadv_dbg(DBG_BLA, bat_priv, "bla_process_claim(): received a claim frame from another group. From: %pM on vid %d ...(hw_src %pM, hw_dst %pM)\n",
@@ -876,27 +890,29 @@ static int bla_process_claim(struct bat_priv *bat_priv,return ret;/* become a backbone gw ourselves on this vlan if not happened yet */ -bla_update_own_backbone_gw (bat_priv, primary_if, vid); +batadv_bla_update_own_backbone_gw (bat_priv, primary_if, vid);/* check for the different types of claim frames ... */ switch (bla_dst->type) {case CLAIM_TYPE_ADD : -if (handle_claim (bat_priv, primary_if, hw_src, - ethhdr->h_source, vid)) +if (batadv_handle_claim (bat_priv, primary_if, hw_src, + ethhdr->h_source, vid))return 1 ;break ;case CLAIM_TYPE_DEL : -if (handle_unclaim (bat_priv, primary_if, - ethhdr->h_source, hw_src, vid)) +if (batadv_handle_unclaim (bat_priv, primary_if, + ethhdr->h_source, hw_src, vid))return 1 ;break ;case CLAIM_TYPE_ANNOUNCE : -if (handle_announce (bat_priv, hw_src, ethhdr->h_source, vid)) +if (batadv_handle_announce (bat_priv, hw_src, ethhdr->h_source, + vid))return 1 ;break ;case CLAIM_TYPE_REQUEST : -if (handle_request (bat_priv, primary_if, hw_src, ethhdr, vid)) +if (batadv_handle_request (bat_priv, primary_if, hw_src, ethhdr, + vid))return 1 ;break ; }
@@ -910,7 +926,7 @@ static int bla_process_claim(struct bat_priv *bat_priv,/* Check when we last heard from other nodes, and remove them in case of * a time out, or clean all backbone gws if now is set. */ -static void bla_purge_backbone_gw (struct bat_priv *bat_priv,int now) +static void batadv_bla_purge_backbone_gw (struct bat_priv *bat_priv,int now) {struct backbone_gw *backbone_gw;struct hlist_node *node, *node_tmp;
@@ -945,10 +961,10 @@ purge_now:if (atomic_read (&backbone_gw->request_sent))atomic_dec (&bat_priv->bla_num_requests); -bla_del_backbone_claims (backbone_gw); +batadv_bla_del_backbone_claims (backbone_gw);hlist_del_rcu (node); -backbone_gw_free_ref (backbone_gw); +batadv_backbone_gw_free_ref (backbone_gw); }spin_unlock_bh (list_lock); }
@@ -961,8 +977,8 @@ purge_now:* Check when we heard last time from our own claims, and remove them in case of * a time out, or clean all claims if now is set */ -static void bla_purge_claims (struct bat_priv *bat_priv, -struct hard_iface *primary_if,int now) +static void batadv_bla_purge_claims (struct bat_priv *bat_priv, +struct hard_iface *primary_if,int now) {struct claim *claim;struct hlist_node *node;
@@ -993,9 +1009,9 @@ static void bla_purge_claims(struct bat_priv *bat_priv, claim->addr, claim->vid); purge_now: -handle_unclaim (bat_priv, primary_if, - claim->backbone_gw->orig, - claim->addr, claim->vid); +batadv_handle_unclaim (bat_priv, primary_if, + claim->backbone_gw->orig, + claim->addr, claim->vid); }rcu_read_unlock (); }
@@ -1022,8 +1038,8 @@ void batadv_bla_update_orig_address(struct bat_priv *bat_priv,htons (crc16 (0 , primary_if->net_dev->dev_addr,ETH_ALEN ));if (!oldif) { -bla_purge_claims (bat_priv,NULL ,1 ); -bla_purge_backbone_gw (bat_priv,1 ); +batadv_bla_purge_claims (bat_priv,NULL ,1 ); +batadv_bla_purge_backbone_gw (bat_priv,1 );return ; }
@@ -1046,7 +1062,7 @@ void batadv_bla_update_orig_address(struct bat_priv *bat_priv,/* send an announce frame so others will ask for our * claims and update their tables. */ -bla_send_announce (bat_priv, backbone_gw); +batadv_bla_send_announce (bat_priv, backbone_gw); }rcu_read_unlock (); }
@@ -1055,9 +1071,9 @@ void batadv_bla_update_orig_address(struct bat_priv *bat_priv,/* (re)start the timer */ -static void bla_start_timer (struct bat_priv *bat_priv) +static void batadv_bla_start_timer (struct bat_priv *bat_priv) { -INIT_DELAYED_WORK (&bat_priv->bla_work, bla_periodic_work); +INIT_DELAYED_WORK (&bat_priv->bla_work, batadv_bla_periodic_work);queue_delayed_work (batadv_event_workqueue, &bat_priv->bla_work,msecs_to_jiffies (BLA_PERIOD_LENGTH )); }
@@ -1066,7 +1082,7 @@ static void bla_start_timer(struct bat_priv *bat_priv)* * purge structures when they are too old * * send announcements */ -static void bla_periodic_work (struct work_struct *work) +static void batadv_bla_periodic_work (struct work_struct *work) {struct delayed_work *delayed_work = container_of(work, struct delayed_work, work);
@@ -1083,8 +1099,8 @@ static void bla_periodic_work(struct work_struct *work)if (!primary_if) goto out; -bla_purge_claims (bat_priv, primary_if,0 ); -bla_purge_backbone_gw (bat_priv,0 ); +batadv_bla_purge_claims (bat_priv, primary_if,0 ); +batadv_bla_purge_backbone_gw (bat_priv,0 );if (!atomic_read (&bat_priv->bridge_loop_avoidance)) goto out;
@@ -1104,7 +1120,7 @@ static void bla_periodic_work(struct work_struct *work) backbone_gw->lasttime = jiffies; -bla_send_announce (bat_priv, backbone_gw); +batadv_bla_send_announce (bat_priv, backbone_gw); }rcu_read_unlock (); }
@@ -1112,7 +1128,7 @@ out:if (primary_if)batadv_hardif_free_ref (primary_if); -bla_start_timer (bat_priv); +batadv_bla_start_timer (bat_priv); }/* The hash for claim and backbone hash receive the same key because they
@@ -1120,8 +1136,8 @@ out:* them with to different keys to allow nested locking without generating * lockdep warnings */ -static struct lock_class_key claim_hash_lock_class_key; -static struct lock_class_key backbone_hash_lock_class_key; +static struct lock_class_key batadv_claim_hash_lock_class_key; +static struct lock_class_key batadv_backbone_hash_lock_class_key;/* initialize all bla structures */ int batadv_bla_init (struct bat_priv *bat_priv)
@@ -1161,13 +1177,13 @@ int batadv_bla_init(struct bat_priv *bat_priv)return -ENOMEM ;batadv_hash_set_lock_class (bat_priv->claim_hash, - &claim_hash_lock_class_key); + &batadv_claim_hash_lock_class_key);batadv_hash_set_lock_class (bat_priv->backbone_hash, - &backbone_hash_lock_class_key); + &batadv_backbone_hash_lock_class_key);batadv_dbg (DBG_BLA , bat_priv,"bla hashes initialized\n" ); -bla_start_timer (bat_priv); +batadv_bla_start_timer (bat_priv);return 0 ; }
@@ -1308,12 +1324,12 @@ int batadv_bla_is_backbone_gw(struct sk_buff *skb, }/* see if this originator is a backbone gw for this VLAN */ - backbone_gw =backbone_hash_find (orig_node->bat_priv, - orig_node->orig, vid); + backbone_gw =batadv_backbone_hash_find (orig_node->bat_priv, + orig_node->orig, vid);if (!backbone_gw)return 0 ; -backbone_gw_free_ref (backbone_gw); +batadv_backbone_gw_free_ref (backbone_gw);return 1 ; }
@@ -1326,12 +1342,12 @@ void batadv_bla_free(struct bat_priv *bat_priv) primary_if =batadv_primary_if_get_selected (bat_priv);if (bat_priv->claim_hash) { -bla_purge_claims (bat_priv, primary_if,1 ); +batadv_bla_purge_claims (bat_priv, primary_if,1 );batadv_hash_destroy (bat_priv->claim_hash); bat_priv->claim_hash =NULL ; }if (bat_priv->backbone_hash) { -bla_purge_backbone_gw (bat_priv,1 ); +batadv_bla_purge_backbone_gw (bat_priv,1 );batadv_hash_destroy (bat_priv->backbone_hash); bat_priv->backbone_hash =NULL ; }
@@ -1375,15 +1391,15 @@ int batadv_bla_rx(struct bat_priv *bat_priv, struct sk_buff *skb, short vid)memcpy (search_claim.addr, ethhdr->h_source,ETH_ALEN ); search_claim.vid = vid; - claim =claim_hash_find (bat_priv, &search_claim); + claim =batadv_claim_hash_find (bat_priv, &search_claim);if (!claim) {/* possible optimization: race for a claim */ /* No claim exists yet, claim it for us! */ -handle_claim (bat_priv, primary_if, - primary_if->net_dev->dev_addr, - ethhdr->h_source, vid); +batadv_handle_claim (bat_priv, primary_if, + primary_if->net_dev->dev_addr, + ethhdr->h_source, vid); goto allow; }
@@ -1404,13 +1420,13 @@ int batadv_bla_rx(struct bat_priv *bat_priv, struct sk_buff *skb, short vid)* send a claim and update the claim table * immediately. */ -handle_claim (bat_priv, primary_if, - primary_if->net_dev->dev_addr, - ethhdr->h_source, vid); +batadv_handle_claim (bat_priv, primary_if, + primary_if->net_dev->dev_addr, + ethhdr->h_source, vid); goto allow; } allow: -bla_update_own_backbone_gw (bat_priv, primary_if, vid); +batadv_bla_update_own_backbone_gw (bat_priv, primary_if, vid); ret =0 ; goto out;
@@ -1422,7 +1438,7 @@ out:if (primary_if)batadv_hardif_free_ref (primary_if);if (claim) -claim_free_ref (claim); +batadv_claim_free_ref (claim);return ret; }
@@ -1455,7 +1471,7 @@ int batadv_bla_tx(struct bat_priv *bat_priv, struct sk_buff *skb, short vid)/* in VLAN case, the mac header might not be set. */ skb_reset_mac_header (skb); -if (bla_process_claim (bat_priv, primary_if, skb)) +if (batadv_bla_process_claim (bat_priv, primary_if, skb)) goto handled; ethhdr = (struct ethhdr *)skb_mac_header (skb);
@@ -1468,7 +1484,7 @@ int batadv_bla_tx(struct bat_priv *bat_priv, struct sk_buff *skb, short vid)memcpy (search_claim.addr, ethhdr->h_source,ETH_ALEN ); search_claim.vid = vid; - claim =claim_hash_find (bat_priv, &search_claim); + claim =batadv_claim_hash_find (bat_priv, &search_claim);/* if no claim exists, allow it. */ if (!claim)
@@ -1480,9 +1496,9 @@ int batadv_bla_tx(struct bat_priv *bat_priv, struct sk_buff *skb, short vid)/* if yes, the client has roamed and we have * to unclaim it. */ -handle_unclaim (bat_priv, primary_if, - primary_if->net_dev->dev_addr, - ethhdr->h_source, vid); +batadv_handle_unclaim (bat_priv, primary_if, + primary_if->net_dev->dev_addr, + ethhdr->h_source, vid); goto allow; }
@@ -1499,7 +1515,7 @@ int batadv_bla_tx(struct bat_priv *bat_priv, struct sk_buff *skb, short vid) goto allow; } allow: -bla_update_own_backbone_gw (bat_priv, primary_if, vid); +batadv_bla_update_own_backbone_gw (bat_priv, primary_if, vid); ret =0 ; goto out; handled:
@@ -1508,7 +1524,7 @@ out:if (primary_if)batadv_hardif_free_ref (primary_if);if (claim) -claim_free_ref (claim); +batadv_claim_free_ref (claim);return ret; }
Signature · 1 line
1.7.10
Marek Lindner
AppliedRe: [B.A.T.M.A.N.] [PATCH 04/18] batman-adv: Prefix bridge_loop_avoidance local static functions with batadv_
Quoted 9 lines · On Sunday, May 13, 2012 00:33:53 Sven Eckelmann wrote:
All non-static symbols of batman-adv were prefixed with
batadv_to avoid collisions with other symbols of the kernel. Other symbols of batman-adv should use the same prefix to keep the naming scheme consistent.Signed-off-by Sven Eckelmann <[email protected]>--- bridge_loop_avoidance.c | 320+++++++++++++++++++++++++---------------------- 1 file changed, 168 insertions(+), 152 deletions(-)
Applied in revision 7039674.
Thanks,
Marek
PATCH 5/18 batman-adv: Prefix distributed-arp-table local static functions with batadv_
In reply to Sven EckelmannAll non-static symbols of batman-adv were prefixed with batadv_ to avoid collisions with other symbols of the kernel. Other symbols of batman-adv should use the same prefix to keep the naming scheme consistent.
--- distributed-arp-table.c | 106 ++++++++++++++++++++++++----------------------- 1 file changed, 55 insertions(+), 51 deletions(-)
distributed-arp-table.c +55 -51
@@ -56,8 +56,8 @@ static uint32_t batadv_hash_ipv4(const void *data, uint32_t size)#ifdef CONFIG_BATMAN_ADV_DEBUG -static void bat_dbg_arp (struct bat_priv *bat_priv,struct sk_buff *skb, -uint16_t type,int hdr_size,char *msg) +static void batadv_dbg_arp (struct bat_priv *bat_priv,struct sk_buff *skb, +uint16_t type,int hdr_size,char *msg) {struct unicast_4addr_packet *unicast_4addr_packet;
@@ -118,18 +118,18 @@ static void bat_dbg_arp(struct bat_priv *bat_priv, struct sk_buff *skb,#else -static void bat_dbg_arp (struct bat_priv *bat_priv,struct sk_buff *skb, -uint16_t type,int hdr_size,char *msg) +static void batadv_dbg_arp (struct bat_priv *bat_priv,struct sk_buff *skb, +uint16_t type,int hdr_size,char *msg) { }#endif /* CONFIG_BATMAN_ADV_DEBUG */ -static bool is_orig_node_eligible (struct dht_candidate *res,int select, -dat_addr_t tmp_max,dat_addr_t max, -dat_addr_t last_max, -struct orig_node *candidate, -struct orig_node *max_orig_node) +static bool batadv_is_orig_node_eligible (struct dht_candidate *res,int select, +dat_addr_t tmp_max,dat_addr_t max, +dat_addr_t last_max, +struct orig_node *candidate, +struct orig_node *max_orig_node) {bool ret = false;int j;
@@ -164,9 +164,10 @@ out:/* selects the next candidate by populating cands[select] and modifies last_max * accordingly */ -static void choose_next_candidate (struct bat_priv *bat_priv, -struct dht_candidate *cands,int select, -dat_addr_t ip_key,dat_addr_t *last_max) +static void batadv_choose_next_candidate (struct bat_priv *bat_priv, +struct dht_candidate *cands, +int select,dat_addr_t ip_key, +dat_addr_t *last_max) {dat_addr_t max =0 , tmp_max =0 ;struct orig_node *orig_node, *max_orig_node =NULL ;
@@ -191,9 +192,10 @@ static void choose_next_candidate(struct bat_priv *bat_priv,/* the dht space is a ring and addresses are unsigned */ tmp_max =DAT_ADDR_MAX - orig_node->dht_addr + ip_key; -if (!is_orig_node_eligible (cands, select, tmp_max, max, - *last_max, orig_node, - max_orig_node)) +if (!batadv_is_orig_node_eligible (cands, select, + tmp_max, max, + *last_max, orig_node, + max_orig_node))continue ;if (!atomic_inc_not_zero (&orig_node->refcount))
@@ -224,8 +226,8 @@ static void choose_next_candidate(struct bat_priv *bat_priv,* * return an array of size DHT_CANDIDATES_NUM */ -static struct dht_candidate *dht_select_candidates (struct bat_priv *bat_priv, -__be32 ip_dst) +static struct dht_candidate * +batadv_dht_select_candidates (struct bat_priv *bat_priv,__be32 ip_dst) {int select;dat_addr_t last_max =DAT_ADDR_MAX , ip_key;
@@ -245,7 +247,8 @@ static struct dht_candidate *dht_select_candidates(struct bat_priv *bat_priv, ip_key);for (select =0 ; select <DHT_CANDIDATES_NUM ; select++) -choose_next_candidate (bat_priv, res, select, ip_key, &last_max); +batadv_choose_next_candidate (bat_priv, res, select, ip_key, + &last_max);return res; }
@@ -257,15 +260,16 @@ static struct dht_candidate *dht_select_candidates(struct bat_priv *bat_priv,* If the packet is successfully sent to at least one candidate, then this * function returns true */ -static bool dht_send_data (struct bat_priv *bat_priv,struct sk_buff *skb, -__be32 ip,int packet_subtype) +static bool batadv_dht_send_data (struct bat_priv *bat_priv, +struct sk_buff *skb,__be32 ip, +int packet_subtype) {int i;bool ret = false;int send_status;struct neigh_node *neigh_node =NULL ;struct sk_buff *tmp_skb; -struct dht_candidate *cand =dht_select_candidates (bat_priv, ip); +struct dht_candidate *cand =batadv_dht_select_candidates (bat_priv, ip);if (!cand) goto out;
@@ -309,7 +313,8 @@ out:* the hw address hw. If the neighbour entry doesn't exists, then it will be * created */ -static void arp_neigh_update (struct bat_priv *bat_priv,__be32 ip,uint8_t *hw) +static void batadv_arp_neigh_update (struct bat_priv *bat_priv,__be32 ip, +uint8_t *hw) {struct neighbour *n =NULL ;struct hard_iface *primary_if;
@@ -336,8 +341,8 @@ out:/* Returns arphdr->ar_op if the skb contains a valid ARP packet, otherwise * returns 0 */ -static uint16_t arp_get_type (struct bat_priv *bat_priv,struct sk_buff *skb, -int hdr_size) +static uint16_t batadv_arp_get_type (struct bat_priv *bat_priv, +struct sk_buff *skb,int hdr_size) {struct arphdr *arphdr;struct ethhdr *ethhdr;
@@ -404,14 +409,14 @@ bool batadv_dat_snoop_outgoing_arp_request(struct bat_priv *bat_priv,struct hard_iface *primary_if =NULL ;struct sk_buff *skb_new; - type =arp_get_type (bat_priv, skb,0 ); + type =batadv_arp_get_type (bat_priv, skb,0 );/* If we get an ARP_REQUEST we have to send the unicast message to the * selected DHT candidates */ if (type !=ARPOP_REQUEST ) goto out; -bat_dbg_arp (bat_priv, skb, type,0 ,"Parsing outgoing ARP REQUEST" ); +batadv_dbg_arp (bat_priv, skb, type,0 ,"Parsing outgoing ARP REQUEST" ); ip_src =ARP_IP_SRC (skb,0 ); hw_src =ARP_HW_SRC (skb,0 );
@@ -421,7 +426,7 @@ bool batadv_dat_snoop_outgoing_arp_request(struct bat_priv *bat_priv,if (!primary_if) goto out; -arp_neigh_update (bat_priv, ip_src, hw_src); +batadv_arp_neigh_update (bat_priv, ip_src, hw_src); n =neigh_lookup (&arp_tbl, &ip_dst, primary_if->soft_iface);/* check if it is a valid neigh entry */
@@ -444,7 +449,8 @@ bool batadv_dat_snoop_outgoing_arp_request(struct bat_priv *bat_priv, }else {/* Send the request on the DHT */ inc_counter (bat_priv,BAT_CNT_DAT_REQUEST_TX ); - ret =dht_send_data (bat_priv, skb, ip_dst,BAT_P_DAT_DHT_GET ); + ret =batadv_dht_send_data (bat_priv, skb, ip_dst, +BAT_P_DAT_DHT_GET ); } out:if (n)
@@ -470,7 +476,7 @@ bool batadv_dat_snoop_incoming_arp_request(struct bat_priv *bat_priv,struct neighbour *n =NULL ;bool ret = false; - type =arp_get_type (bat_priv, skb, hdr_size); + type =batadv_arp_get_type (bat_priv, skb, hdr_size);if (type !=ARPOP_REQUEST ) goto out;
@@ -478,14 +484,14 @@ bool batadv_dat_snoop_incoming_arp_request(struct bat_priv *bat_priv, ip_src =ARP_IP_SRC (skb, hdr_size); ip_dst =ARP_IP_DST (skb, hdr_size); -bat_dbg_arp (bat_priv, skb, type, hdr_size, -"Parsing incoming ARP REQUEST" ); +batadv_dbg_arp (bat_priv, skb, type, hdr_size, +"Parsing incoming ARP REQUEST" ); primary_if =batadv_primary_if_get_selected (bat_priv);if (!primary_if) goto out; -arp_neigh_update (bat_priv, ip_src, hw_src); +batadv_arp_neigh_update (bat_priv, ip_src, hw_src); n =neigh_lookup (&arp_tbl, &ip_dst, primary_if->soft_iface);/* check if it is a valid neigh entry */
@@ -526,27 +532,27 @@ bool batadv_dat_snoop_outgoing_arp_reply(struct bat_priv *bat_priv,uint8_t *hw_src, *hw_dst;bool ret = false; - type =arp_get_type (bat_priv, skb,0 ); + type =batadv_arp_get_type (bat_priv, skb,0 );if (type !=ARPOP_REPLY ) goto out; -bat_dbg_arp (bat_priv, skb, type,0 ,"Parsing outgoing ARP REPLY" ); +batadv_dbg_arp (bat_priv, skb, type,0 ,"Parsing outgoing ARP REPLY" ); hw_src =ARP_HW_SRC (skb,0 ); ip_src =ARP_IP_SRC (skb,0 ); hw_dst =ARP_HW_DST (skb,0 ); ip_dst =ARP_IP_DST (skb,0 ); -arp_neigh_update (bat_priv, ip_src, hw_src); -arp_neigh_update (bat_priv, ip_dst, hw_dst); +batadv_arp_neigh_update (bat_priv, ip_src, hw_src); +batadv_arp_neigh_update (bat_priv, ip_dst, hw_dst);inc_counter (bat_priv,BAT_CNT_DAT_REPLY_TX );/* Send the ARP reply to the candidates for both the IP addresses we * fetched from the ARP reply */ -dht_send_data (bat_priv, skb, ip_src,BAT_P_DAT_DHT_PUT ); -dht_send_data (bat_priv, skb, ip_dst,BAT_P_DAT_DHT_PUT ); +batadv_dht_send_data (bat_priv, skb, ip_src,BAT_P_DAT_DHT_PUT ); +batadv_dht_send_data (bat_priv, skb, ip_dst,BAT_P_DAT_DHT_PUT ); ret = true; out:return ret;
@@ -563,12 +569,12 @@ bool batadv_dat_snoop_incoming_arp_reply(struct bat_priv *bat_priv,uint8_t *hw_src, *hw_dst;bool ret = false; - type =arp_get_type (bat_priv, skb, hdr_size); + type =batadv_arp_get_type (bat_priv, skb, hdr_size);if (type !=ARPOP_REPLY ) goto out; -bat_dbg_arp (bat_priv, skb, type, hdr_size, -"Parsing incoming ARP REPLY" ); +batadv_dbg_arp (bat_priv, skb, type, hdr_size, +"Parsing incoming ARP REPLY" ); hw_src =ARP_HW_SRC (skb, hdr_size); ip_src =ARP_IP_SRC (skb, hdr_size);
@@ -578,8 +584,8 @@ bool batadv_dat_snoop_incoming_arp_reply(struct bat_priv *bat_priv,/* Update our internal cache with both the IP addresses we fetched from * the ARP reply */ -arp_neigh_update (bat_priv, ip_src, hw_src); -arp_neigh_update (bat_priv, ip_dst, hw_dst); +batadv_arp_neigh_update (bat_priv, ip_src, hw_src); +batadv_arp_neigh_update (bat_priv, ip_dst, hw_dst);/* if this REPLY is directed to a client of mine, let's deliver the * packet to the interface
@@ -594,29 +600,27 @@ bool batadv_dat_drop_broadcast_packet(struct bat_priv *bat_priv, struct forw_packet *forw_packet) {struct neighbour *n; +const size_t bcast_len =sizeof (struct bcast_packet );/* If this packet is an ARP_REQUEST and we already have the information * that it is going to ask, we can drop the packet */ if (!forw_packet->num_packets && - (ARPOP_REQUEST ==arp_get_type (bat_priv, forw_packet->skb, -sizeof (struct bcast_packet )))) { + (ARPOP_REQUEST ==batadv_arp_get_type (bat_priv, forw_packet->skb, + bcast_len))) { n =neigh_lookup (&arp_tbl, - &ARP_IP_DST (forw_packet->skb, -sizeof (struct bcast_packet )), + &ARP_IP_DST (forw_packet->skb, bcast_len), forw_packet->if_incoming->soft_iface);/* check if we already know this neigh */ if (n && (n->nud_state &NUD_CONNECTED )) {batadv_dbg (DBG_DAT , bat_priv,"ARP Request for %pI4: fallback prevented\n" , - &ARP_IP_DST (forw_packet->skb, -sizeof (struct bcast_packet ))); + &ARP_IP_DST (forw_packet->skb, bcast_len));return true; }batadv_dbg (DBG_DAT , bat_priv,"ARP Request for %pI4: fallback\n" , - &ARP_IP_DST (forw_packet->skb, -sizeof (struct bcast_packet ))); + &ARP_IP_DST (forw_packet->skb, bcast_len)); }return false; }
Signature · 1 line
1.7.10
Marek Lindner
AppliedRe: [B.A.T.M.A.N.] [PATCH 05/18] batman-adv: Prefix distributed-arp-table local static functions with batadv_
Quoted 9 lines · On Sunday, May 13, 2012 00:33:54 Sven Eckelmann wrote:
All non-static symbols of batman-adv were prefixed with
batadv_to avoid collisions with other symbols of the kernel. Other symbols of batman-adv should use the same prefix to keep the naming scheme consistent.Signed-off-by Sven Eckelmann <[email protected]>--- distributed-arp-table.c | 106++++++++++++++++++++++++----------------------- 1 file changed, 55 insertions(+), 51 deletions(-)
Applied in revision 01f5a2a.
Thanks,
Marek
PATCH 6/18 batman-adv: Prefix gateway_client local static functions with batadv_
In reply to Sven EckelmannAll non-static symbols of batman-adv were prefixed with batadv_ to avoid collisions with other symbols of the kernel. Other symbols of batman-adv should use the same prefix to keep the naming scheme consistent.
--- gateway_client.c | 67 ++++++++++++++++++++++++++++-------------------------- 1 file changed, 35 insertions(+), 32 deletions(-)
gateway_client.c +35 -32
@@ -36,13 +36,13 @@#define DHCP_OPTIONS_OFFSET 240#define DHCP_REQUEST 3 -static void gw_node_free_ref (struct gw_node *gw_node) +static void batadv_gw_node_free_ref (struct gw_node *gw_node) {if (atomic_dec_and_test (&gw_node->refcount))kfree_rcu (gw_node, rcu); } -static struct gw_node *gw_get_selected_gw_node (struct bat_priv *bat_priv) +static struct gw_node *batadv_gw_get_selected_gw_node (struct bat_priv *bat_priv) {struct gw_node *gw_node;
@@ -64,7 +64,7 @@ struct orig_node *batadv_gw_get_selected_orig(struct bat_priv *bat_priv)struct gw_node *gw_node;struct orig_node *orig_node =NULL ; - gw_node =gw_get_selected_gw_node (bat_priv); + gw_node =batadv_gw_get_selected_gw_node (bat_priv);if (!gw_node) goto out;
@@ -80,11 +80,12 @@ unlock:rcu_read_unlock (); out:if (gw_node) -gw_node_free_ref (gw_node); +batadv_gw_node_free_ref (gw_node);return orig_node; } -static void gw_select (struct bat_priv *bat_priv,struct gw_node *new_gw_node) +static void batadv_gw_select (struct bat_priv *bat_priv, +struct gw_node *new_gw_node) {struct gw_node *curr_gw_node;
@@ -97,7 +98,7 @@ static void gw_select(struct bat_priv *bat_priv, struct gw_node *new_gw_node)rcu_assign_pointer (bat_priv->curr_gw, new_gw_node);if (curr_gw_node) -gw_node_free_ref (curr_gw_node); +batadv_gw_node_free_ref (curr_gw_node);spin_unlock_bh (&bat_priv->gw_list_lock); }
@@ -107,7 +108,7 @@ void batadv_gw_deselect(struct bat_priv *bat_priv)atomic_set (&bat_priv->gw_reselect,1 ); } -static struct gw_node *gw_get_best_gw_node (struct bat_priv *bat_priv) +static struct gw_node *batadv_gw_get_best_gw_node (struct bat_priv *bat_priv) {struct neigh_node *router;struct hlist_node *node;
@@ -144,7 +145,7 @@ static struct gw_node *gw_get_best_gw_node(struct bat_priv *bat_priv) ((tmp_gw_factor == max_gw_factor) && (router->tq_avg > max_tq))) {if (curr_gw) -gw_node_free_ref (curr_gw); +batadv_gw_node_free_ref (curr_gw); curr_gw = gw_node;atomic_inc (&curr_gw->refcount); }
@@ -159,7 +160,7 @@ static struct gw_node *gw_get_best_gw_node(struct bat_priv *bat_priv)*/ if (router->tq_avg > max_tq) {if (curr_gw) -gw_node_free_ref (curr_gw); +batadv_gw_node_free_ref (curr_gw); curr_gw = gw_node;atomic_inc (&curr_gw->refcount); }
@@ -172,7 +173,7 @@ static struct gw_node *gw_get_best_gw_node(struct bat_priv *bat_priv)if (tmp_gw_factor > max_gw_factor) max_gw_factor = tmp_gw_factor; -gw_node_free_ref (gw_node); +batadv_gw_node_free_ref (gw_node); next:batadv_neigh_node_free_ref (router);
@@ -199,9 +200,9 @@ void batadv_gw_election(struct bat_priv *bat_priv)if (!atomic_dec_not_zero (&bat_priv->gw_reselect)) goto out; - curr_gw =gw_get_selected_gw_node (bat_priv); + curr_gw =batadv_gw_get_selected_gw_node (bat_priv); - next_gw =gw_get_best_gw_node (bat_priv); + next_gw =batadv_gw_get_best_gw_node (bat_priv);if (curr_gw == next_gw) goto out;
@@ -234,13 +235,13 @@ void batadv_gw_election(struct bat_priv *bat_priv)batadv_throw_uevent (bat_priv,UEV_GW ,UEV_CHANGE , gw_addr); } -gw_select (bat_priv, next_gw); +batadv_gw_select (bat_priv, next_gw); out:if (curr_gw) -gw_node_free_ref (curr_gw); +batadv_gw_node_free_ref (curr_gw);if (next_gw) -gw_node_free_ref (next_gw); +batadv_gw_node_free_ref (next_gw);if (router)batadv_neigh_node_free_ref (router); }
@@ -299,8 +300,9 @@ out:return ; } -static void gw_node_add (struct bat_priv *bat_priv, -struct orig_node *orig_node,uint8_t new_gwflags) +static void batadv_gw_node_add (struct bat_priv *bat_priv, +struct orig_node *orig_node, +uint8_t new_gwflags) {struct gw_node *gw_node;int down, up;
@@ -338,7 +340,7 @@ void batadv_gw_node_update(struct bat_priv *bat_priv,* have this gateway in our list (duplication check!) even though we * have no currently selected gateway. */ - curr_gw =gw_get_selected_gw_node (bat_priv); + curr_gw =batadv_gw_get_selected_gw_node (bat_priv);rcu_read_lock ();hlist_for_each_entry_rcu (gw_node, node, &bat_priv->gw_list, list) {
@@ -368,7 +370,7 @@ void batadv_gw_node_update(struct bat_priv *bat_priv,if (new_gwflags ==NO_FLAGS ) goto unlock; -gw_node_add (bat_priv, orig_node, new_gwflags); +batadv_gw_node_add (bat_priv, orig_node, new_gwflags); goto unlock; deselect:
@@ -377,7 +379,7 @@ unlock:rcu_read_unlock ();if (curr_gw) -gw_node_free_ref (curr_gw); +batadv_gw_node_free_ref (curr_gw); } void batadv_gw_node_delete(struct bat_priv *bat_priv,
@@ -393,7 +395,7 @@ void batadv_gw_node_purge(struct bat_priv *bat_priv)unsigned long timeout =msecs_to_jiffies (2 *PURGE_TIMEOUT );int do_deselect =0 ; - curr_gw =gw_get_selected_gw_node (bat_priv); + curr_gw =batadv_gw_get_selected_gw_node (bat_priv);spin_lock_bh (&bat_priv->gw_list_lock);
@@ -408,7 +410,7 @@ void batadv_gw_node_purge(struct bat_priv *bat_priv) do_deselect =1 ;hlist_del_rcu (&gw_node->list); -gw_node_free_ref (gw_node); +batadv_gw_node_free_ref (gw_node); }spin_unlock_bh (&bat_priv->gw_list_lock);
@@ -418,12 +420,13 @@ void batadv_gw_node_purge(struct bat_priv *bat_priv)batadv_gw_deselect (bat_priv);if (curr_gw) -gw_node_free_ref (curr_gw); +batadv_gw_node_free_ref (curr_gw); }/* fails if orig_node has no router */ -static int _write_buffer_text (struct bat_priv *bat_priv,struct seq_file *seq, -const struct gw_node *gw_node) +static int batadv_write_buffer_text (struct bat_priv *bat_priv, +struct seq_file *seq, +const struct gw_node *gw_node) {struct gw_node *curr_gw;struct neigh_node *router;
@@ -435,7 +438,7 @@ static int _write_buffer_text(struct bat_priv *bat_priv, struct seq_file *seq,if (!router) goto out; - curr_gw =gw_get_selected_gw_node (bat_priv); + curr_gw =batadv_gw_get_selected_gw_node (bat_priv); ret = seq_printf(seq, "%s %pM (%3i) %pM [%10s]: %3i - %i%s/%i%s\n", (curr_gw == gw_node ? "=>" : " "),
@@ -450,7 +453,7 @@ static int _write_buffer_text(struct bat_priv *bat_priv, struct seq_file *seq,batadv_neigh_node_free_ref (router);if (curr_gw) -gw_node_free_ref (curr_gw); +batadv_gw_node_free_ref (curr_gw); out:return ret; }
@@ -491,7 +494,7 @@ int batadv_gw_client_seq_print_text(struct seq_file *seq, void *offset)continue ;/* fails if orig_node has no router */ -if (_write_buffer_text (bat_priv, seq, gw_node) <0 ) +if (batadv_write_buffer_text (bat_priv, seq, gw_node) <0 )continue ; gw_count++;
@@ -507,7 +510,7 @@ out:return ret; } -static bool is_type_dhcprequest (struct sk_buff *skb,int header_len) +static bool batadv_is_type_dhcprequest (struct sk_buff *skb,int header_len) {int ret = false;unsigned char *p;
@@ -655,7 +658,7 @@ bool batadv_gw_out_of_range(struct bat_priv *bat_priv,if (!orig_dst_node->gw_flags) goto out; - ret =is_type_dhcprequest (skb, header_len); + ret =batadv_is_type_dhcprequest (skb, header_len);if (!ret) goto out;
@@ -667,7 +670,7 @@ bool batadv_gw_out_of_range(struct bat_priv *bat_priv, curr_tq_avg =TQ_MAX_VALUE ;break ;case GW_MODE_CLIENT : - curr_gw =gw_get_selected_gw_node (bat_priv); + curr_gw =batadv_gw_get_selected_gw_node (bat_priv);if (!curr_gw) goto out;
@@ -702,7 +705,7 @@ out:if (orig_dst_node)batadv_orig_node_free_ref (orig_dst_node);if (curr_gw) -gw_node_free_ref (curr_gw); +batadv_gw_node_free_ref (curr_gw);if (neigh_old)batadv_neigh_node_free_ref (neigh_old);if (neigh_curr)
Signature · 1 line
1.7.10
Marek Lindner
AppliedRe: [B.A.T.M.A.N.] [PATCH 06/18] batman-adv: Prefix gateway_client local static functions with batadv_
Quoted 9 lines · On Sunday, May 13, 2012 00:33:55 Sven Eckelmann wrote:
All non-static symbols of batman-adv were prefixed with
batadv_to avoid collisions with other symbols of the kernel. Other symbols of batman-adv should use the same prefix to keep the naming scheme consistent.Signed-off-by Sven Eckelmann <[email protected]>--- gateway_client.c | 67++++++++++++++++++++++++++++-------------------------- 1 file changed, 35 insertions(+), 32 deletions(-)
Applied in revision d72bc47.
Thanks,
Marek
PATCH 7/18 batman-adv: Prefix gateway_common local static functions with batadv_
In reply to Sven EckelmannAll non-static symbols of batman-adv were prefixed with batadv_ to avoid collisions with other symbols of the kernel. Other symbols of batman-adv should use the same prefix to keep the naming scheme consistent.
--- gateway_common.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
gateway_common.c +5 -5
@@ -22,7 +22,7 @@#include "gateway_client.h" /* calculates the gateway class from kbit */ -static void kbit_to_gw_bandwidth (int down,int up,long *gw_srv_class) +static void batadv_kbit_to_gw_bandwidth (int down,int up,long *gw_srv_class) {int mdown =0 , tdown, tup, difference;uint8_t sbit, part;
@@ -73,8 +73,8 @@ void batadv_gw_bandwidth_to_kbit(uint8_t gw_srv_class, int *down, int *up) *up = ((upart +1 ) * (*down)) /8 ; } -static bool parse_gw_bandwidth (struct net_device *net_dev,char *buff, -int *up,int *down) +static bool batadv_parse_gw_bandwidth (struct net_device *net_dev,char *buff, +int *up,int *down) {int ret, multi =1 ;char *slash_ptr, *tmp_ptr;
@@ -142,7 +142,7 @@ ssize_t batadv_gw_bandwidth_set(struct net_device *net_dev, char *buff,int up =0 , down =0 ;bool ret; - ret =parse_gw_bandwidth (net_dev, buff, &up, &down); + ret =batadv_parse_gw_bandwidth (net_dev, buff, &up, &down);if (!ret) goto end;
@@ -152,7 +152,7 @@ ssize_t batadv_gw_bandwidth_set(struct net_device *net_dev, char *buff,if (!up) up = down /5 ; -kbit_to_gw_bandwidth (down, up, &gw_bandwidth_tmp); +batadv_kbit_to_gw_bandwidth (down, up, &gw_bandwidth_tmp);/* the gw bandwidth we guessed above might not match the given * speeds, hence we need to calculate it back to show the number
Signature · 1 line
1.7.10
Marek Lindner
AppliedRe: [B.A.T.M.A.N.] [PATCH 07/18] batman-adv: Prefix gateway_common local static functions with batadv_
Quoted 8 lines · On Sunday, May 13, 2012 00:33:56 Sven Eckelmann wrote:
All non-static symbols of batman-adv were prefixed with
batadv_to avoid collisions with other symbols of the kernel. Other symbols of batman-adv should use the same prefix to keep the naming scheme consistent.Signed-off-by Sven Eckelmann <[email protected]>--- gateway_common.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
Applied in revision a80c651.
Thanks,
Marek
PATCH 8/18 batman-adv: Prefix hard-interface local static functions with batadv_
In reply to Sven EckelmannAll non-static symbols of batman-adv were prefixed with batadv_ to avoid collisions with other symbols of the kernel. Other symbols of batman-adv should use the same prefix to keep the naming scheme consistent.
--- hard-interface.c | 62 ++++++++++++++++++++++++++++-------------------------- 1 file changed, 32 insertions(+), 30 deletions(-)
hard-interface.c +32 -30
@@ -58,7 +58,7 @@ out:return hard_iface; } -static int is_valid_iface (const struct net_device *net_dev) +static int batadv_is_valid_iface (const struct net_device *net_dev) {if (net_dev->flags &IFF_LOOPBACK )return 0 ;
@@ -76,7 +76,8 @@ static int is_valid_iface(const struct net_device *net_dev)return 1 ; } -static struct hard_iface *hardif_get_active (const struct net_device *soft_iface) +static struct hard_iface * +batadv_hardif_get_active (const struct net_device *soft_iface) {struct hard_iface *hard_iface;
@@ -97,8 +98,8 @@ out:return hard_iface; } -static void primary_if_update_addr (struct bat_priv *bat_priv, -struct hard_iface *oldif) +static void batadv_primary_if_update_addr (struct bat_priv *bat_priv, +struct hard_iface *oldif) {struct vis_packet *vis_packet;struct hard_iface *primary_if;
@@ -121,8 +122,8 @@ out:batadv_hardif_free_ref (primary_if); } -static void primary_if_select (struct bat_priv *bat_priv, -struct hard_iface *new_hard_iface) +static void batadv_primary_if_select (struct bat_priv *bat_priv, +struct hard_iface *new_hard_iface) {struct hard_iface *curr_hard_iface;
@@ -138,14 +139,14 @@ static void primary_if_select(struct bat_priv *bat_priv, goto out; bat_priv->bat_algo_ops->bat_primary_iface_set (new_hard_iface); -primary_if_update_addr (bat_priv, curr_hard_iface); +batadv_primary_if_update_addr (bat_priv, curr_hard_iface); out:if (curr_hard_iface)batadv_hardif_free_ref (curr_hard_iface); } -static bool hardif_is_iface_up (const struct hard_iface *hard_iface) +static bool batadv_hardif_is_iface_up (const struct hard_iface *hard_iface) {if (hard_iface->net_dev->flags &IFF_UP )return true;
@@ -153,7 +154,7 @@ static bool hardif_is_iface_up(const struct hard_iface *hard_iface)return false; } -static void check_known_mac_addr (const struct net_device *net_dev) +static void batadv_check_known_mac_addr (const struct net_device *net_dev) {const struct hard_iface *hard_iface;
@@ -216,7 +217,7 @@ void batadv_update_min_mtu(struct net_device *soft_iface) soft_iface->mtu = min_mtu; } -static void hardif_activate_interface (struct hard_iface *hard_iface) +static void batadv_hardif_activate_interface (struct hard_iface *hard_iface) {struct bat_priv *bat_priv;struct hard_iface *primary_if =NULL ;
@@ -234,7 +235,7 @@ static void hardif_activate_interface(struct hard_iface *hard_iface)*/ primary_if =batadv_primary_if_get_selected (bat_priv);if (!primary_if) -primary_if_select (bat_priv, hard_iface); +batadv_primary_if_select (bat_priv, hard_iface);bat_info (hard_iface->soft_iface,"Interface activated: %s\n" , hard_iface->net_dev->name);
@@ -246,7 +247,7 @@ out:batadv_hardif_free_ref (primary_if); } -static void hardif_deactivate_interface (struct hard_iface *hard_iface) +static void batadv_hardif_deactivate_interface (struct hard_iface *hard_iface) {if ((hard_iface->if_status !=IF_ACTIVE ) && (hard_iface->if_status !=IF_TO_BE_ACTIVATED ))
@@ -334,8 +335,8 @@ int batadv_hardif_enable_interface(struct hard_iface *hard_iface, hard_iface->net_dev->name, hard_iface->net_dev->mtu, ETH_DATA_LEN + BAT_HEADER_LEN); -if (hardif_is_iface_up (hard_iface)) -hardif_activate_interface (hard_iface); +if (batadv_hardif_is_iface_up (hard_iface)) +batadv_hardif_activate_interface (hard_iface);else bat_err(hard_iface->soft_iface, "Not using interface %s (retrying later): interface not active\n",
@@ -360,7 +361,7 @@ void batadv_hardif_disable_interface(struct hard_iface *hard_iface)struct hard_iface *primary_if =NULL ;if (hard_iface->if_status ==IF_ACTIVE ) -hardif_deactivate_interface (hard_iface); +batadv_hardif_deactivate_interface (hard_iface);if (hard_iface->if_status !=IF_INACTIVE ) goto out;
@@ -376,8 +377,8 @@ void batadv_hardif_disable_interface(struct hard_iface *hard_iface)if (hard_iface == primary_if) {struct hard_iface *new_if; - new_if =hardif_get_active (hard_iface->soft_iface); -primary_if_select (bat_priv, new_if); + new_if =batadv_hardif_get_active (hard_iface->soft_iface); +batadv_primary_if_select (bat_priv, new_if);if (new_if)batadv_hardif_free_ref (new_if);
@@ -403,14 +404,15 @@ out:batadv_hardif_free_ref (primary_if); } -static struct hard_iface *hardif_add_interface (struct net_device *net_dev) +static struct hard_iface * +batadv_hardif_add_interface (struct net_device *net_dev) {struct hard_iface *hard_iface;int ret;ASSERT_RTNL (); - ret =is_valid_iface (net_dev); + ret =batadv_is_valid_iface (net_dev);if (ret !=1 ) goto out;
@@ -432,7 +434,7 @@ static struct hard_iface *hardif_add_interface(struct net_device *net_dev)/* extra reference for return */ atomic_set (&hard_iface->refcount,2 ); -check_known_mac_addr (hard_iface->net_dev); +batadv_check_known_mac_addr (hard_iface->net_dev);list_add_tail_rcu (&hard_iface->list, &batadv_hardif_list);/* This can't be called via a bat_priv callback because
@@ -451,7 +453,7 @@ out:return NULL ; } -static void hardif_remove_interface (struct hard_iface *hard_iface) +static void batadv_hardif_remove_interface (struct hard_iface *hard_iface) {ASSERT_RTNL ();
@@ -475,12 +477,12 @@ void batadv_hardif_remove_interfaces(void)list_for_each_entry_safe (hard_iface, hard_iface_tmp, &batadv_hardif_list, list) {list_del_rcu (&hard_iface->list); -hardif_remove_interface (hard_iface); +batadv_hardif_remove_interface (hard_iface); }rtnl_unlock (); } -static int hard_if_event (struct notifier_block *this, +static int batadv_hard_if_event (struct notifier_block *this,unsigned long event,void *ptr) {struct net_device *net_dev = ptr;
@@ -489,23 +491,23 @@ static int hard_if_event(struct notifier_block *this,struct bat_priv *bat_priv;if (!hard_iface && event ==NETDEV_REGISTER ) - hard_iface =hardif_add_interface (net_dev); + hard_iface =batadv_hardif_add_interface (net_dev);if (!hard_iface) goto out;switch (event) {case NETDEV_UP : -hardif_activate_interface (hard_iface); +batadv_hardif_activate_interface (hard_iface);break ;case NETDEV_GOING_DOWN :case NETDEV_DOWN : -hardif_deactivate_interface (hard_iface); +batadv_hardif_deactivate_interface (hard_iface);break ;case NETDEV_UNREGISTER :list_del_rcu (&hard_iface->list); -hardif_remove_interface (hard_iface); +batadv_hardif_remove_interface (hard_iface);break ;case NETDEV_CHANGEMTU :if (hard_iface->soft_iface)
@@ -515,7 +517,7 @@ static int hard_if_event(struct notifier_block *this,if (hard_iface->if_status ==IF_NOT_IN_USE ) goto hardif_put; -check_known_mac_addr (hard_iface->net_dev); +batadv_check_known_mac_addr (hard_iface->net_dev); bat_priv =netdev_priv (hard_iface->soft_iface); bat_priv->bat_algo_ops->bat_iface_update_mac (hard_iface);
@@ -525,7 +527,7 @@ static int hard_if_event(struct notifier_block *this, goto hardif_put;if (hard_iface == primary_if) -primary_if_update_addr (bat_priv,NULL ); +batadv_primary_if_update_addr (bat_priv,NULL );break ;default :break ;
@@ -572,5 +574,5 @@ out: }struct notifier_block batadv_hard_if_notifier = { - .notifier_call = hard_if_event, + .notifier_call = batadv_hard_if_event, };
Signature · 1 line
1.7.10
Marek Lindner
AppliedRe: [B.A.T.M.A.N.] [PATCH 08/18] batman-adv: Prefix hard-interface local static functions with batadv_
Quoted 9 lines · On Sunday, May 13, 2012 00:33:57 Sven Eckelmann wrote:
All non-static symbols of batman-adv were prefixed with
batadv_to avoid collisions with other symbols of the kernel. Other symbols of batman-adv should use the same prefix to keep the naming scheme consistent.Signed-off-by Sven Eckelmann <[email protected]>--- hard-interface.c | 62++++++++++++++++++++++++++++-------------------------- 1 file changed, 32 insertions(+), 30 deletions(-)
Applied in revision 5615c46.
Thanks,
Marek
PATCH 9/18 batman-adv: Prefix hash local static functions with batadv_
In reply to Sven EckelmannAll non-static symbols of batman-adv were prefixed with batadv_ to avoid collisions with other symbols of the kernel. Other symbols of batman-adv should use the same prefix to keep the naming scheme consistent.
--- hash.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
hash.c +2 -2
@@ -21,7 +21,7 @@#include "hash.h" /* clears the hash */ -static void hash_init (struct hashtable_t *hash) +static void batadv_hash_init (struct hashtable_t *hash) {uint32_t i;
@@ -58,7 +58,7 @@ struct hashtable_t *batadv_hash_new(uint32_t size) goto free_table; hash->size = size; -hash_init (hash); +batadv_hash_init (hash);return hash; free_table:
Signature · 1 line
1.7.10
Marek Lindner
AppliedRe: [B.A.T.M.A.N.] [PATCH 09/18] batman-adv: Prefix hash local static functions with batadv_
Quoted 8 lines · On Sunday, May 13, 2012 00:33:58 Sven Eckelmann wrote:
All non-static symbols of batman-adv were prefixed with
batadv_to avoid collisions with other symbols of the kernel. Other symbols of batman-adv should use the same prefix to keep the naming scheme consistent.Signed-off-by Sven Eckelmann <[email protected]>--- hash.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Applied in revision 0118a62.
Thanks,
Marek
PATCH 10/18 batman-adv: Prefix icmp_socket local static functions with batadv_
In reply to Sven EckelmannAll non-static symbols of batman-adv were prefixed with batadv_ to avoid collisions with other symbols of the kernel. Other symbols of batman-adv should use the same prefix to keep the naming scheme consistent.
--- icmp_socket.c | 66 +++++++++++++++++++++++++++++---------------------------- 1 file changed, 34 insertions(+), 32 deletions(-)
icmp_socket.c +34 -32
@@ -26,18 +26,18 @@#include "originator.h" #include "hard-interface.h" -static struct socket_client *socket_client_hash[256 ]; +static struct socket_client *batadv_socket_client_hash[256 ]; -static void bat_socket_add_packet (struct socket_client *socket_client, -struct icmp_packet_rr *icmp_packet, -size_t icmp_len); +static void batadv_socket_add_packet (struct socket_client *socket_client, +struct icmp_packet_rr *icmp_packet, +size_t icmp_len);void batadv_socket_init (void ) { -memset (socket_client_hash,0 ,sizeof (socket_client_hash)); +memset (batadv_socket_client_hash,0 ,sizeof (batadv_socket_client_hash)); } -static int bat_socket_open (struct inode *inode,struct file *file) +static int batadv_socket_open (struct inode *inode,struct file *file) {unsigned int i;struct socket_client *socket_client;
@@ -49,14 +49,14 @@ static int bat_socket_open(struct inode *inode, struct file *file)if (!socket_client)return -ENOMEM ; -for (i =0 ; i <ARRAY_SIZE (socket_client_hash); i++) { -if (!socket_client_hash[i]) { - socket_client_hash[i] = socket_client; +for (i =0 ; i <ARRAY_SIZE (batadv_socket_client_hash); i++) { +if (!batadv_socket_client_hash[i]) { + batadv_socket_client_hash[i] = socket_client;break ; } } -if (i ==ARRAY_SIZE (socket_client_hash)) { +if (i ==ARRAY_SIZE (batadv_socket_client_hash)) {pr_err ("Error - can't add another packet client: maximum number of clients reached\n" );kfree (socket_client);return -EXFULL ;
@@ -75,7 +75,7 @@ static int bat_socket_open(struct inode *inode, struct file *file)return 0 ; } -static int bat_socket_release (struct inode *inode,struct file *file) +static int batadv_socket_release (struct inode *inode,struct file *file) {struct socket_client *socket_client = file->private_data;struct socket_packet *socket_packet;
@@ -92,7 +92,7 @@ static int bat_socket_release(struct inode *inode, struct file *file)kfree (socket_packet); } - socket_client_hash[socket_client->index] =NULL ; + batadv_socket_client_hash[socket_client->index] =NULL ;spin_unlock_bh (&socket_client->lock);kfree (socket_client);
@@ -101,8 +101,8 @@ static int bat_socket_release(struct inode *inode, struct file *file)return 0 ; } -static ssize_t bat_socket_read (struct file *file,char __user *buf, -size_t count,loff_t *ppos) +static ssize_t batadv_socket_read (struct file *file,char __user *buf, +size_t count,loff_t *ppos) {struct socket_client *socket_client = file->private_data;struct socket_packet *socket_packet;
@@ -144,8 +144,8 @@ static ssize_t bat_socket_read(struct file *file, char __user *buf,return packet_len; } -static ssize_t bat_socket_write (struct file *file,const char __user *buff, -size_t len,loff_t *off) +static ssize_t batadv_socket_write (struct file *file,const char __user *buff, +size_t len,loff_t *off) {struct socket_client *socket_client = file->private_data;struct bat_priv *bat_priv = socket_client->bat_priv;
@@ -206,7 +206,8 @@ static ssize_t bat_socket_write(struct file *file, const char __user *buff,if (icmp_packet->header.version !=COMPAT_VERSION ) { icmp_packet->msg_type =PARAMETER_PROBLEM ; icmp_packet->header.version =COMPAT_VERSION ; -bat_socket_add_packet (socket_client, icmp_packet, packet_len); +batadv_socket_add_packet (socket_client, icmp_packet, + packet_len); goto free_skb; }
@@ -239,7 +240,7 @@ static ssize_t bat_socket_write(struct file *file, const char __user *buff, dst_unreach: icmp_packet->msg_type =DESTINATION_UNREACHABLE ; -bat_socket_add_packet (socket_client, icmp_packet, packet_len); +batadv_socket_add_packet (socket_client, icmp_packet, packet_len); free_skb:kfree_skb (skb); out:
@@ -252,7 +253,7 @@ out:return len; } -static unsigned int bat_socket_poll (struct file *file,poll_table *wait) +static unsigned int batadv_socket_poll (struct file *file,poll_table *wait) {struct socket_client *socket_client = file->private_data;
@@ -264,13 +265,13 @@ static unsigned int bat_socket_poll(struct file *file, poll_table *wait)return 0 ; } -static const struct file_operations fops = { +static const struct file_operations batadv_fops = { .owner =THIS_MODULE , - .open = bat_socket_open, - .release = bat_socket_release, - .read = bat_socket_read, - .write = bat_socket_write, - .poll = bat_socket_poll, + .open = batadv_socket_open, + .release = batadv_socket_release, + .read = batadv_socket_read, + .write = batadv_socket_write, + .poll = batadv_socket_poll, .llseek = no_llseek, };
@@ -282,7 +283,7 @@ int batadv_socket_setup(struct bat_priv *bat_priv) goto err; d =debugfs_create_file (ICMP_SOCKET ,S_IFREG |S_IWUSR |S_IRUSR , - bat_priv->debug_dir, bat_priv, &fops); + bat_priv->debug_dir, bat_priv, &batadv_fops);if (d) goto err;
@@ -292,9 +293,9 @@ err:return 1 ; } -static void bat_socket_add_packet (struct socket_client *socket_client, -struct icmp_packet_rr *icmp_packet, -size_t icmp_len) +static void batadv_socket_add_packet (struct socket_client *socket_client, +struct icmp_packet_rr *icmp_packet, +size_t icmp_len) {struct socket_packet *socket_packet;
@@ -312,7 +313,7 @@ static void bat_socket_add_packet(struct socket_client *socket_client,/* while waiting for the lock the socket_client could have been * deleted */ -if (!socket_client_hash[icmp_packet->uid]) { +if (!batadv_socket_client_hash[icmp_packet->uid]) {spin_unlock_bh (&socket_client->lock);kfree (socket_packet);return ;
@@ -338,8 +339,9 @@ static void bat_socket_add_packet(struct socket_client *socket_client,void batadv_socket_receive_packet (struct icmp_packet_rr *icmp_packet,size_t icmp_len) { -struct socket_client *hash = socket_client_hash[icmp_packet->uid]; +struct socket_client *hash; + hash = batadv_socket_client_hash[icmp_packet->uid];if (hash) -bat_socket_add_packet (hash, icmp_packet, icmp_len); +batadv_socket_add_packet (hash, icmp_packet, icmp_len); }
Signature · 1 line
1.7.10
Marek Lindner
AppliedRe: [B.A.T.M.A.N.] [PATCH 10/18] batman-adv: Prefix icmp_socket local static functions with batadv_
Quoted 9 lines · On Sunday, May 13, 2012 00:33:59 Sven Eckelmann wrote:
All non-static symbols of batman-adv were prefixed with
batadv_to avoid collisions with other symbols of the kernel. Other symbols of batman-adv should use the same prefix to keep the naming scheme consistent.Signed-off-by Sven Eckelmann <[email protected]>--- icmp_socket.c | 66+++++++++++++++++++++++++++++---------------------------- 1 file changed, 34 insertions(+), 32 deletions(-)
Applied in revision e4f3aef.
Thanks,
Marek
PATCH 11/18 batman-adv: Prefix originator local static functions with batadv_
In reply to Sven EckelmannAll non-static symbols of batman-adv were prefixed with batadv_ to avoid collisions with other symbols of the kernel. Other symbols of batman-adv should use the same prefix to keep the naming scheme consistent.
--- originator.c | 54 +++++++++++++++++++++++++++--------------------------- 1 file changed, 27 insertions(+), 27 deletions(-)
originator.c +27 -27
@@ -29,17 +29,17 @@#include "soft-interface.h" #include "bridge_loop_avoidance.h" -static void purge_orig (struct work_struct *work); +static void batadv_purge_orig (struct work_struct *work); -static void start_purge_timer (struct bat_priv *bat_priv) +static void batadv_start_purge_timer (struct bat_priv *bat_priv) { -INIT_DELAYED_WORK (&bat_priv->orig_work, purge_orig); +INIT_DELAYED_WORK (&bat_priv->orig_work, batadv_purge_orig);queue_delayed_work (batadv_event_workqueue, &bat_priv->orig_work,msecs_to_jiffies (1000 )); }/* returns 1 if they are the same originator */ -static int compare_orig (const struct hlist_node *node,const void *data2) +static int batadv_compare_orig (const struct hlist_node *node,const void *data2) { const void *data1 = container_of(node, struct orig_node, hash_entry);
@@ -56,7 +56,7 @@ int batadv_originator_init(struct bat_priv *bat_priv)if (!bat_priv->orig_hash) goto err; -start_purge_timer (bat_priv); +batadv_start_purge_timer (bat_priv);return 0 ; err:
@@ -111,7 +111,7 @@ out:return neigh_node; } -static void orig_node_free_rcu (struct rcu_head *rcu) +static void batadv_orig_node_free_rcu (struct rcu_head *rcu) {struct hlist_node *node, *node_tmp;struct neigh_node *neigh_node, *tmp_neigh_node;
@@ -150,7 +150,7 @@ static void orig_node_free_rcu(struct rcu_head *rcu)void batadv_orig_node_free_ref (struct orig_node *orig_node) {if (atomic_dec_and_test (&orig_node->refcount)) -call_rcu (&orig_node->rcu, orig_node_free_rcu); +call_rcu (&orig_node->rcu, batadv_orig_node_free_rcu); }void batadv_originator_free (struct bat_priv *bat_priv)
@@ -250,7 +250,7 @@ struct orig_node *batadv_get_orig_node(struct bat_priv *bat_priv,if (!orig_node->bcast_own_sum) goto free_bcast_own; - hash_added =batadv_hash_add (bat_priv->orig_hash, compare_orig, + hash_added =batadv_hash_add (bat_priv->orig_hash, batadv_compare_orig, batadv_choose_orig, orig_node, &orig_node->hash_entry);if (hash_added !=0 )
@@ -266,9 +266,9 @@ free_orig_node:return NULL ; } -static bool purge_orig_neighbors (struct bat_priv *bat_priv, -struct orig_node *orig_node, -struct neigh_node **best_neigh_node) +static bool batadv_purge_orig_neighbors (struct bat_priv *bat_priv, +struct orig_node *orig_node, +struct neigh_node **best_neigh_node) {struct hlist_node *node, *node_tmp;struct neigh_node *neigh_node;
@@ -321,8 +321,8 @@ static bool purge_orig_neighbors(struct bat_priv *bat_priv,return neigh_purged; } -static bool purge_orig_node (struct bat_priv *bat_priv, -struct orig_node *orig_node) +static bool batadv_purge_orig_node (struct bat_priv *bat_priv, +struct orig_node *orig_node) {struct neigh_node *best_neigh_node;
@@ -333,8 +333,8 @@ static bool purge_orig_node(struct bat_priv *bat_priv, jiffies_to_msecs(orig_node->last_seen));return true; }else { -if (purge_orig_neighbors (bat_priv, orig_node, - &best_neigh_node)) +if (batadv_purge_orig_neighbors (bat_priv, orig_node, + &best_neigh_node))batadv_update_route (bat_priv, orig_node, best_neigh_node); }
@@ -342,7 +342,7 @@ static bool purge_orig_node(struct bat_priv *bat_priv,return false; } -static void _purge_orig (struct bat_priv *bat_priv) +static void _batadv_purge_orig (struct bat_priv *bat_priv) {struct hashtable_t *hash = bat_priv->orig_hash;struct hlist_node *node, *node_tmp;
@@ -362,7 +362,7 @@ static void _purge_orig(struct bat_priv *bat_priv)spin_lock_bh (list_lock);hlist_for_each_entry_safe (orig_node, node, node_tmp, head, hash_entry) { -if (purge_orig_node (bat_priv, orig_node)) { +if (batadv_purge_orig_node (bat_priv, orig_node)) {if (orig_node->gw_flags)batadv_gw_node_delete (bat_priv, orig_node);
@@ -382,20 +382,20 @@ static void _purge_orig(struct bat_priv *bat_priv)batadv_gw_election (bat_priv); } -static void purge_orig (struct work_struct *work) +static void batadv_purge_orig (struct work_struct *work) {struct delayed_work *delayed_work = container_of(work, struct delayed_work, work);struct bat_priv *bat_priv = container_of(delayed_work, struct bat_priv, orig_work); -_purge_orig (bat_priv); -start_purge_timer (bat_priv); +_batadv_purge_orig (bat_priv); +batadv_start_purge_timer (bat_priv); }void batadv_purge_orig_ref (struct bat_priv *bat_priv) { -_purge_orig (bat_priv); +_batadv_purge_orig (bat_priv); }int batadv_orig_seq_print_text (struct seq_file *seq,void *offset)
@@ -485,7 +485,7 @@ out:return ret; } -static int orig_node_add_if (struct orig_node *orig_node,int max_if_num) +static int batadv_orig_node_add_if (struct orig_node *orig_node,int max_if_num) {void *data_ptr;
@@ -530,7 +530,7 @@ int batadv_orig_hash_add_if(struct hard_iface *hard_iface, int max_if_num)rcu_read_lock ();hlist_for_each_entry_rcu (orig_node, node, head, hash_entry) {spin_lock_bh (&orig_node->ogm_cnt_lock); - ret =orig_node_add_if (orig_node, max_if_num); + ret =batadv_orig_node_add_if (orig_node, max_if_num);spin_unlock_bh (&orig_node->ogm_cnt_lock);if (ret == -ENOMEM )
@@ -546,8 +546,8 @@ err:return -ENOMEM ; } -static int orig_node_del_if (struct orig_node *orig_node, -int max_if_num,int del_if_num) +static int batadv_orig_node_del_if (struct orig_node *orig_node, +int max_if_num,int del_if_num) {void *data_ptr =NULL ;int chunk_size;
@@ -614,8 +614,8 @@ int batadv_orig_hash_del_if(struct hard_iface *hard_iface, int max_if_num)rcu_read_lock ();hlist_for_each_entry_rcu (orig_node, node, head, hash_entry) {spin_lock_bh (&orig_node->ogm_cnt_lock); - ret =orig_node_del_if (orig_node, max_if_num, - hard_iface->if_num); + ret =batadv_orig_node_del_if (orig_node, max_if_num, + hard_iface->if_num);spin_unlock_bh (&orig_node->ogm_cnt_lock);if (ret == -ENOMEM )
Signature · 1 line
1.7.10
Marek Lindner
AppliedRe: [B.A.T.M.A.N.] [PATCH 11/18] batman-adv: Prefix originator local static functions with batadv_
Quoted 8 lines · On Sunday, May 13, 2012 00:34:00 Sven Eckelmann wrote:
All non-static symbols of batman-adv were prefixed with
batadv_to avoid collisions with other symbols of the kernel. Other symbols of batman-adv should use the same prefix to keep the naming scheme consistent.Signed-off-by Sven Eckelmann <[email protected]>--- originator.c | 54 +++++++++++++++++++++++++++--------------------------- 1 file changed, 27 insertions(+), 27 deletions(-)
Applied in revision 3dbc8e0.
Thanks,
Marek
PATCH 12/18 batman-adv: Prefix routing local static functions with batadv_
In reply to Sven EckelmannAll non-static symbols of batman-adv were prefixed with batadv_ to avoid collisions with other symbols of the kernel. Other symbols of batman-adv should use the same prefix to keep the naming scheme consistent.
--- routing.c | 65 ++++++++++++++++++++++++++++++++----------------------------- 1 file changed, 34 insertions(+), 31 deletions(-)
routing.c +34 -31
@@ -29,8 +29,8 @@#include "unicast.h" #include "bridge_loop_avoidance.h" -static int route_unicast_packet (struct sk_buff *skb, -struct hard_iface *recv_if); +static int batadv_route_unicast_packet (struct sk_buff *skb, +struct hard_iface *recv_if);void batadv_slide_own_bcast_window (struct hard_iface *hard_iface) {
@@ -61,9 +61,9 @@ void batadv_slide_own_bcast_window(struct hard_iface *hard_iface) } } -static void _update_route (struct bat_priv *bat_priv, -struct orig_node *orig_node, -struct neigh_node *neigh_node) +static void _batadv_update_route (struct bat_priv *bat_priv, +struct orig_node *orig_node, +struct neigh_node *neigh_node) {struct neigh_node *curr_router;
@@ -117,7 +117,7 @@ void batadv_update_route(struct bat_priv *bat_priv, struct orig_node *orig_node, router =batadv_orig_node_get_router (orig_node);if (router != neigh_node) -_update_route (bat_priv, orig_node, neigh_node); +_batadv_update_route (bat_priv, orig_node, neigh_node); out:if (router)
@@ -276,8 +276,8 @@ bool batadv_check_management_packet(struct sk_buff *skb,return true; } -static int recv_my_icmp_packet (struct bat_priv *bat_priv, -struct sk_buff *skb,size_t icmp_len) +static int batadv_recv_my_icmp_packet (struct bat_priv *bat_priv, +struct sk_buff *skb,size_t icmp_len) {struct hard_iface *primary_if =NULL ;struct orig_node *orig_node =NULL ;
@@ -331,8 +331,8 @@ out:return ret; } -static int recv_icmp_ttl_exceeded (struct bat_priv *bat_priv, -struct sk_buff *skb) +static int batadv_recv_icmp_ttl_exceeded (struct bat_priv *bat_priv, +struct sk_buff *skb) {struct hard_iface *primary_if =NULL ;struct orig_node *orig_node =NULL ;
@@ -431,11 +431,11 @@ int batadv_recv_icmp_packet(struct sk_buff *skb, struct hard_iface *recv_if)/* packet for me */ if (batadv_is_my_mac (icmp_packet->dst)) -return recv_my_icmp_packet (bat_priv, skb, hdr_size); +return batadv_recv_my_icmp_packet (bat_priv, skb, hdr_size);/* TTL exceeded */ if (icmp_packet->header.ttl <2 ) -return recv_icmp_ttl_exceeded (bat_priv, skb); +return batadv_recv_icmp_ttl_exceeded (bat_priv, skb);/* get routing information */ orig_node =batadv_orig_hash_find (bat_priv, icmp_packet->dst);
@@ -473,8 +473,9 @@ out:* This method rotates the bonding list and increases the * returned router's refcount. */ -static struct neigh_node *find_bond_router (struct orig_node *primary_orig, -const struct hard_iface *recv_if) +static struct neigh_node * +batadv_find_bond_router (struct orig_node *primary_orig, +const struct hard_iface *recv_if) {struct neigh_node *tmp_neigh_node;struct neigh_node *router =NULL , *first_candidate =NULL ;
@@ -527,8 +528,9 @@ out:* * Increases the returned router's refcount */ -static struct neigh_node *find_ifalter_router (struct orig_node *primary_orig, -const struct hard_iface *recv_if) +static struct neigh_node * +batadv_find_ifalter_router (struct orig_node *primary_orig, +const struct hard_iface *recv_if) {struct neigh_node *tmp_neigh_node;struct neigh_node *router =NULL , *first_candidate =NULL ;
@@ -614,7 +616,7 @@ int batadv_recv_tt_query(struct sk_buff *skb, struct hard_iface *recv_if)"Routing TT_REQUEST to %pM [%c]\n" , tt_query->dst, tt_flag); -return route_unicast_packet (skb, recv_if); +return batadv_route_unicast_packet (skb, recv_if); }break ;case TT_RESPONSE :
@@ -641,7 +643,7 @@ int batadv_recv_tt_query(struct sk_buff *skb, struct hard_iface *recv_if)"Routing TT_RESPONSE to %pM [%c]\n" , tt_query->dst, tt_flag); -return route_unicast_packet (skb, recv_if); +return batadv_route_unicast_packet (skb, recv_if); }break ; }
@@ -677,7 +679,7 @@ int batadv_recv_roam_adv(struct sk_buff *skb, struct hard_iface *recv_if) roam_adv_packet = (struct roam_adv_packet *)skb->data;if (!batadv_is_my_mac (roam_adv_packet->dst)) -return route_unicast_packet (skb, recv_if); +return batadv_route_unicast_packet (skb, recv_if);/* check if it is a backbone gateway. we don't accept * roaming advertisement from it, as it has the same
@@ -781,9 +783,9 @@ struct neigh_node *batadv_find_router(struct bat_priv *bat_priv,batadv_neigh_node_free_ref (router);if (bonding_enabled) - router =find_bond_router (primary_orig_node, recv_if); + router =batadv_find_bond_router (primary_orig_node, recv_if);else - router =find_ifalter_router (primary_orig_node, recv_if); + router =batadv_find_ifalter_router (primary_orig_node, recv_if); return_router:if (router && router->if_incoming->if_status !=IF_ACTIVE )
@@ -799,7 +801,7 @@ err:return NULL ; } -static int check_unicast_packet (struct sk_buff *skb,int hdr_size) +static int batadv_check_unicast_packet (struct sk_buff *skb,int hdr_size) {struct ethhdr *ethhdr;
@@ -824,7 +826,8 @@ static int check_unicast_packet(struct sk_buff *skb, int hdr_size)return 0 ; } -static int route_unicast_packet (struct sk_buff *skb,struct hard_iface *recv_if) +static int batadv_route_unicast_packet (struct sk_buff *skb, +struct hard_iface *recv_if) {struct bat_priv *bat_priv =netdev_priv (recv_if->soft_iface);struct orig_node *orig_node =NULL ;
@@ -909,8 +912,8 @@ out:return ret; } -static int check_unicast_ttvn (struct bat_priv *bat_priv, -struct sk_buff *skb) { +static int batadv_check_unicast_ttvn (struct bat_priv *bat_priv, +struct sk_buff *skb) {uint8_t curr_ttvn;struct orig_node *orig_node;struct ethhdr *ethhdr;
@@ -998,10 +1001,10 @@ int batadv_recv_unicast_packet(struct sk_buff *skb, struct hard_iface *recv_if)if (unicast_packet->header.packet_type ==BAT_UNICAST_4ADDR ) hdr_size =sizeof (struct unicast_4addr_packet ); -if (check_unicast_packet (skb, hdr_size) <0 ) +if (batadv_check_unicast_packet (skb, hdr_size) <0 )return NET_RX_DROP ; -if (!check_unicast_ttvn (bat_priv, skb)) +if (!batadv_check_unicast_ttvn (bat_priv, skb))return NET_RX_DROP ;/* packet for me */
@@ -1011,7 +1014,7 @@ int batadv_recv_unicast_packet(struct sk_buff *skb, struct hard_iface *recv_if)return NET_RX_SUCCESS ; } -return route_unicast_packet (skb, recv_if); +return batadv_route_unicast_packet (skb, recv_if); } int batadv_recv_ucast_frag_packet(struct sk_buff *skb,
@@ -1023,10 +1026,10 @@ int batadv_recv_ucast_frag_packet(struct sk_buff *skb,struct sk_buff *new_skb =NULL ;int ret; -if (check_unicast_packet (skb, hdr_size) <0 ) +if (batadv_check_unicast_packet (skb, hdr_size) <0 )return NET_RX_DROP ; -if (!check_unicast_ttvn (bat_priv, skb)) +if (!batadv_check_unicast_ttvn (bat_priv, skb))return NET_RX_DROP ; unicast_packet = (struct unicast_frag_packet *)skb->data;
@@ -1048,7 +1051,7 @@ int batadv_recv_ucast_frag_packet(struct sk_buff *skb,return NET_RX_SUCCESS ; } -return route_unicast_packet (skb, recv_if); +return batadv_route_unicast_packet (skb, recv_if); }
Signature · 1 line
1.7.10
PATCH 13/18 batman-adv: Prefix send local static functions with batadv_
In reply to Sven EckelmannAll non-static symbols of batman-adv were prefixed with batadv_ to avoid collisions with other symbols of the kernel. Other symbols of batman-adv should use the same prefix to keep the naming scheme consistent.
--- send.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-)
send.c +15 -15
@@ -28,7 +28,7 @@#include "gateway_common.h" #include "originator.h" -static void send_outstanding_bcast_packet (struct work_struct *work); +static void batadv_send_outstanding_bcast_packet (struct work_struct *work);/* send out an already prepared packet to the given address via the * specified batman interface
@@ -97,7 +97,7 @@ void batadv_schedule_bat_ogm(struct hard_iface *hard_iface) bat_priv->bat_algo_ops->bat_ogm_schedule (hard_iface); } -static void forw_packet_free (struct forw_packet *forw_packet) +static void batadv_forw_packet_free (struct forw_packet *forw_packet) {if (forw_packet->skb)kfree_skb (forw_packet->skb);
@@ -106,9 +106,9 @@ static void forw_packet_free(struct forw_packet *forw_packet)kfree (forw_packet); } -static void _add_bcast_packet_to_list (struct bat_priv *bat_priv, -struct forw_packet *forw_packet, -unsigned long send_time) +static void _batadv_add_bcast_packet_to_list (struct bat_priv *bat_priv, +struct forw_packet *forw_packet, +unsigned long send_time) {INIT_HLIST_NODE (&forw_packet->list);
@@ -119,7 +119,7 @@ static void _add_bcast_packet_to_list(struct bat_priv *bat_priv,/* start timer for this packet */ INIT_DELAYED_WORK (&forw_packet->delayed_work, - send_outstanding_bcast_packet); + batadv_send_outstanding_bcast_packet);queue_delayed_work (batadv_event_workqueue, &forw_packet->delayed_work, send_time); }
@@ -172,7 +172,7 @@ int batadv_add_bcast_packet_to_list(struct bat_priv *bat_priv,/* how often did we send the bcast packet ? */ forw_packet->num_packets =0 ; -_add_bcast_packet_to_list (bat_priv, forw_packet, delay); +_batadv_add_bcast_packet_to_list (bat_priv, forw_packet, delay);return NETDEV_TX_OK ; packet_free:
@@ -185,7 +185,7 @@ out:return NETDEV_TX_BUSY ; } -static void send_outstanding_bcast_packet (struct work_struct *work) +static void batadv_send_outstanding_bcast_packet (struct work_struct *work) {struct hard_iface *hard_iface; struct delayed_work *delayed_work =
@@ -224,13 +224,13 @@ static void send_outstanding_bcast_packet(struct work_struct *work)/* if we still have some more bcasts to send */ if (forw_packet->num_packets <3 ) { -_add_bcast_packet_to_list (bat_priv, forw_packet, -msecs_to_jiffies (5 )); +_batadv_add_bcast_packet_to_list (bat_priv, forw_packet, +msecs_to_jiffies (5 ));return ; } out: -forw_packet_free (forw_packet); +batadv_forw_packet_free (forw_packet);atomic_inc (&bat_priv->bcast_queue_left); }
@@ -264,7 +264,7 @@ out:if (!forw_packet->own)atomic_inc (&bat_priv->batman_queue_left); -forw_packet_free (forw_packet); +batadv_forw_packet_free (forw_packet); } void batadv_purge_outstanding_packets(struct bat_priv *bat_priv,
@@ -296,7 +296,7 @@ void batadv_purge_outstanding_packets(struct bat_priv *bat_priv,spin_unlock_bh (&bat_priv->forw_bcast_list_lock); -/* send_outstanding_bcast_packet() will lock the list to +/* batadv_send_outstanding_bcast_packet() will lock the list to * delete the item from the list */ pending =cancel_delayed_work_sync (&forw_packet->delayed_work);
@@ -304,7 +304,7 @@ void batadv_purge_outstanding_packets(struct bat_priv *bat_priv,if (pending) {hlist_del (&forw_packet->list); -forw_packet_free (forw_packet); +batadv_forw_packet_free (forw_packet); } }spin_unlock_bh (&bat_priv->forw_bcast_list_lock);
@@ -331,7 +331,7 @@ void batadv_purge_outstanding_packets(struct bat_priv *bat_priv,if (pending) {hlist_del (&forw_packet->list); -forw_packet_free (forw_packet); +batadv_forw_packet_free (forw_packet); } }spin_unlock_bh (&bat_priv->forw_bat_list_lock);
Signature · 1 line
1.7.10
PATCH 14/18 batman-adv: Prefix soft-interface local static functions with batadv_
In reply to Sven EckelmannAll non-static symbols of batman-adv were prefixed with batadv_ to avoid collisions with other symbols of the kernel. Other symbols of batman-adv should use the same prefix to keep the naming scheme consistent.
--- soft-interface.c | 105 ++++++++++++++++++++++++++++-------------------------- 1 file changed, 54 insertions(+), 51 deletions(-)
soft-interface.c +54 -51
@@ -38,26 +38,26 @@#include "bridge_loop_avoidance.h" -static int bat_get_settings (struct net_device *dev,struct ethtool_cmd *cmd); -static void bat_get_drvinfo (struct net_device *dev, -struct ethtool_drvinfo *info); -static u32 bat_get_msglevel (struct net_device *dev); -static void bat_set_msglevel (struct net_device *dev,u32 value); -static u32 bat_get_link (struct net_device *dev); -static void bat_get_strings (struct net_device *dev,u32 stringset,u8 *data); -static void bat_get_ethtool_stats (struct net_device *dev, -struct ethtool_stats *stats,u64 *data); -static int bat_get_sset_count (struct net_device *dev,int stringset); +static int batadv_get_settings (struct net_device *dev,struct ethtool_cmd *cmd); +static void batadv_get_drvinfo (struct net_device *dev, +struct ethtool_drvinfo *info); +static u32 batadv_get_msglevel (struct net_device *dev); +static void batadv_set_msglevel (struct net_device *dev,u32 value); +static u32 batadv_get_link (struct net_device *dev); +static void batadv_get_strings (struct net_device *dev,u32 stringset,u8 *data); +static void batadv_get_ethtool_stats (struct net_device *dev, +struct ethtool_stats *stats,u64 *data); +static int batadv_get_sset_count (struct net_device *dev,int stringset); -static const struct ethtool_ops bat_ethtool_ops = { - .get_settings = bat_get_settings, - .get_drvinfo = bat_get_drvinfo, - .get_msglevel = bat_get_msglevel, - .set_msglevel = bat_set_msglevel, - .get_link = bat_get_link, - .get_strings = bat_get_strings, - .get_ethtool_stats = bat_get_ethtool_stats, - .get_sset_count = bat_get_sset_count, +static const struct ethtool_ops batadv_ethtool_ops = { + .get_settings = batadv_get_settings, + .get_drvinfo = batadv_get_drvinfo, + .get_msglevel = batadv_get_msglevel, + .set_msglevel = batadv_set_msglevel, + .get_link = batadv_get_link, + .get_strings = batadv_get_strings, + .get_ethtool_stats = batadv_get_ethtool_stats, + .get_sset_count = batadv_get_sset_count, };int batadv_skb_head_push (struct sk_buff *skb,unsigned int len)
@@ -79,25 +79,25 @@ int batadv_skb_head_push(struct sk_buff *skb, unsigned int len)return 0 ; } -static int interface_open (struct net_device *dev) +static int batadv_interface_open (struct net_device *dev) {netif_start_queue (dev);return 0 ; } -static int interface_release (struct net_device *dev) +static int batadv_interface_release (struct net_device *dev) {netif_stop_queue (dev);return 0 ; } -static struct net_device_stats *interface_stats (struct net_device *dev) +static struct net_device_stats *batadv_interface_stats (struct net_device *dev) {struct bat_priv *bat_priv =netdev_priv (dev);return &bat_priv->stats; } -static int interface_set_mac_addr (struct net_device *dev,void *p) +static int batadv_interface_set_mac_addr (struct net_device *dev,void *p) {struct bat_priv *bat_priv =netdev_priv (dev);struct sockaddr *addr = p;
@@ -117,7 +117,7 @@ static int interface_set_mac_addr(struct net_device *dev, void *p)return 0 ; } -static int interface_change_mtu (struct net_device *dev,int new_mtu) +static int batadv_interface_change_mtu (struct net_device *dev,int new_mtu) {/* check ranges */ if ((new_mtu <68 ) || (new_mtu >batadv_hardif_min_mtu (dev)))
@@ -128,7 +128,8 @@ static int interface_change_mtu(struct net_device *dev, int new_mtu)return 0 ; } -static int interface_tx (struct sk_buff *skb,struct net_device *soft_iface) +static int batadv_interface_tx (struct sk_buff *skb, +struct net_device *soft_iface) {struct ethhdr *ethhdr = (struct ethhdr *)skb->data;struct bat_priv *bat_priv =netdev_priv (soft_iface);
@@ -336,23 +337,23 @@ out:return ; } -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, +static const struct net_device_ops batadv_netdev_ops = { + .ndo_open = batadv_interface_open, + .ndo_stop = batadv_interface_release, + .ndo_get_stats = batadv_interface_stats, + .ndo_set_mac_address = batadv_interface_set_mac_addr, + .ndo_change_mtu = batadv_interface_change_mtu, + .ndo_start_xmit = batadv_interface_tx, .ndo_validate_addr = eth_validate_addr }; -static void interface_setup (struct net_device *dev) +static void batadv_interface_setup (struct net_device *dev) {struct bat_priv *priv =netdev_priv (dev);ether_setup (dev); - dev->netdev_ops = &bat_netdev_ops; + dev->netdev_ops = &batadv_netdev_ops; dev->destructor = free_netdev; dev->tx_queue_len =0 ;
@@ -366,7 +367,7 @@ static void interface_setup(struct net_device *dev)/* generate random address */ eth_hw_addr_random (dev); -SET_ETHTOOL_OPS (dev, &bat_ethtool_ops); +SET_ETHTOOL_OPS (dev, &batadv_ethtool_ops);memset (priv,0 ,sizeof (*priv)); }
@@ -377,7 +378,8 @@ struct net_device *batadv_softif_create(const char *name)struct bat_priv *bat_priv;int ret; - soft_iface =alloc_netdev (sizeof (*bat_priv), name, interface_setup); + soft_iface =alloc_netdev (sizeof (*bat_priv), name, + batadv_interface_setup);if (!soft_iface) goto out;
@@ -471,14 +473,14 @@ void batadv_softif_destroy(struct net_device *soft_iface)int batadv_softif_is_valid (const struct net_device *net_dev) { -if (net_dev->netdev_ops->ndo_start_xmit == interface_tx) +if (net_dev->netdev_ops->ndo_start_xmit == batadv_interface_tx)return 1 ;return 0 ; }/* ethtool */ -static int bat_get_settings (struct net_device *dev,struct ethtool_cmd *cmd) +static int batadv_get_settings (struct net_device *dev,struct ethtool_cmd *cmd) { cmd->supported =0 ; cmd->advertising =0 ;
@@ -494,8 +496,8 @@ static int bat_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)return 0 ; } -static void bat_get_drvinfo (struct net_device *dev, -struct ethtool_drvinfo *info) +static void batadv_get_drvinfo (struct net_device *dev, +struct ethtool_drvinfo *info) {strcpy (info->driver,"B.A.T.M.A.N. advanced" );strcpy (info->version,SOURCE_VERSION );
@@ -503,16 +505,16 @@ static void bat_get_drvinfo(struct net_device *dev,strcpy (info->bus_info,"batman" ); } -static u32 bat_get_msglevel (struct net_device *dev) +static u32 batadv_get_msglevel (struct net_device *dev) {return -EOPNOTSUPP ; } -static void bat_set_msglevel (struct net_device *dev,u32 value) +static void batadv_set_msglevel (struct net_device *dev,u32 value) { } -static u32 bat_get_link (struct net_device *dev) +static u32 batadv_get_link (struct net_device *dev) {return 1 ; }
@@ -523,7 +525,7 @@ static u32 bat_get_link(struct net_device *dev)*/ static const struct {const char name[ETH_GSTRING_LEN ]; -} bat_counters_strings[] = { +} batadv_counters_strings[] = { {"forward" }, {"forward_bytes" }, {"mgmt_tx" },
@@ -544,16 +546,17 @@ static const struct {#endif }; -static void bat_get_strings (struct net_device *dev,uint32_t stringset, -uint8_t *data) +static void batadv_get_strings (struct net_device *dev,uint32_t stringset, +uint8_t *data) {if (stringset ==ETH_SS_STATS ) -memcpy (data, bat_counters_strings, -sizeof (bat_counters_strings)); +memcpy (data, batadv_counters_strings, +sizeof (batadv_counters_strings)); } -static void bat_get_ethtool_stats (struct net_device *dev, -struct ethtool_stats *stats,uint64_t *data) +static void batadv_get_ethtool_stats (struct net_device *dev, +struct ethtool_stats *stats, +uint64_t *data) {struct bat_priv *bat_priv =netdev_priv (dev);int i;
@@ -562,7 +565,7 @@ static void bat_get_ethtool_stats(struct net_device *dev, data[i] =batadv_sum_counter (bat_priv, i); } -static int bat_get_sset_count (struct net_device *dev,int stringset) +static int batadv_get_sset_count (struct net_device *dev,int stringset) {if (stringset ==ETH_SS_STATS )return BAT_CNT_NUM ;
Signature · 1 line
1.7.10
PATCH 15/18 batman-adv: Prefix translation-table local static functions with batadv_
In reply to Sven EckelmannAll non-static symbols of batman-adv were prefixed with batadv_ to avoid collisions with other symbols of the kernel. Other symbols of batman-adv should use the same prefix to keep the naming scheme consistent.
--- translation-table.c | 540 +++++++++++++++++++++++++++------------------------ 1 file changed, 282 insertions(+), 258 deletions(-)
translation-table.c +282 -258
@@ -29,13 +29,14 @@#include <linux/crc16.h> -static void send_roam_adv (struct bat_priv *bat_priv,uint8_t *client, -struct orig_node *orig_node); -static void tt_purge (struct work_struct *work); -static void tt_global_del_orig_list (struct tt_global_entry *tt_global_entry); +static void batadv_send_roam_adv (struct bat_priv *bat_priv,uint8_t *client, +struct orig_node *orig_node); +static void batadv_tt_purge (struct work_struct *work); +static void +batadv_tt_global_del_orig_list (struct tt_global_entry *tt_global_entry);/* returns 1 if they are the same mac addr */ -static int compare_tt (const struct hlist_node *node,const void *data2) +static int batadv_compare_tt (const struct hlist_node *node,const void *data2) { const void *data1 = container_of(node, struct tt_common_entry, hash_entry);
@@ -43,15 +44,15 @@ static int compare_tt(const struct hlist_node *node, const void *data2)return (memcmp (data1, data2,ETH_ALEN ) ==0 ?1 :0 ); } -static void tt_start_timer (struct bat_priv *bat_priv) +static void batadv_tt_start_timer (struct bat_priv *bat_priv) { -INIT_DELAYED_WORK (&bat_priv->tt_work, tt_purge); +INIT_DELAYED_WORK (&bat_priv->tt_work, batadv_tt_purge);queue_delayed_work (batadv_event_workqueue, &bat_priv->tt_work,msecs_to_jiffies (5000 )); } -static struct tt_common_entry *tt_hash_find (struct hashtable_t *hash, -const void *data) +static struct tt_common_entry *batadv_tt_hash_find (struct hashtable_t *hash, +const void *data) {struct hlist_head *head;struct hlist_node *node;
@@ -80,26 +81,26 @@ static struct tt_common_entry *tt_hash_find(struct hashtable_t *hash,return tt_common_entry_tmp; } -static struct tt_local_entry *tt_local_hash_find (struct bat_priv *bat_priv, -const void *data) +static struct tt_local_entry * +batadv_tt_local_hash_find (struct bat_priv *bat_priv,const void *data) {struct tt_common_entry *tt_common_entry;struct tt_local_entry *tt_local_entry =NULL ; - tt_common_entry =tt_hash_find (bat_priv->tt_local_hash, data); + tt_common_entry =batadv_tt_hash_find (bat_priv->tt_local_hash, data);if (tt_common_entry) tt_local_entry =container_of (tt_common_entry, struct tt_local_entry, common);return tt_local_entry; } -static struct tt_global_entry *tt_global_hash_find (struct bat_priv *bat_priv, -const void *data) +static struct tt_global_entry * +batadv_tt_global_hash_find (struct bat_priv *bat_priv,const void *data) {struct tt_common_entry *tt_common_entry;struct tt_global_entry *tt_global_entry =NULL ; - tt_common_entry =tt_hash_find (bat_priv->tt_global_hash, data); + tt_common_entry =batadv_tt_hash_find (bat_priv->tt_global_hash, data);if (tt_common_entry) tt_global_entry =container_of (tt_common_entry, struct tt_global_entry, common);
@@ -107,13 +108,14 @@ static struct tt_global_entry *tt_global_hash_find(struct bat_priv *bat_priv, } -static void tt_local_entry_free_ref (struct tt_local_entry *tt_local_entry) +static void +batadv_tt_local_entry_free_ref (struct tt_local_entry *tt_local_entry) {if (atomic_dec_and_test (&tt_local_entry->common.refcount))kfree_rcu (tt_local_entry, common.rcu); } -static void tt_global_entry_free_rcu (struct rcu_head *rcu) +static void batadv_tt_global_entry_free_rcu (struct rcu_head *rcu) {struct tt_common_entry *tt_common_entry;struct tt_global_entry *tt_global_entry;
@@ -125,16 +127,17 @@ static void tt_global_entry_free_rcu(struct rcu_head *rcu)kfree (tt_global_entry); } -static void tt_global_entry_free_ref (struct tt_global_entry *tt_global_entry) +static void +batadv_tt_global_entry_free_ref (struct tt_global_entry *tt_global_entry) {if (atomic_dec_and_test (&tt_global_entry->common.refcount)) { -tt_global_del_orig_list (tt_global_entry); +batadv_tt_global_del_orig_list (tt_global_entry);call_rcu (&tt_global_entry->common.rcu, - tt_global_entry_free_rcu); + batadv_tt_global_entry_free_rcu); } } -static void tt_orig_list_entry_free_rcu (struct rcu_head *rcu) +static void batadv_tt_orig_list_entry_free_rcu (struct rcu_head *rcu) {struct tt_orig_list_entry *orig_entry;
@@ -144,13 +147,14 @@ static void tt_orig_list_entry_free_rcu(struct rcu_head *rcu)kfree (orig_entry); } -static void tt_orig_list_entry_free_ref (struct tt_orig_list_entry *orig_entry) +static void +batadv_tt_orig_list_entry_free_ref (struct tt_orig_list_entry *orig_entry) { -call_rcu (&orig_entry->rcu, tt_orig_list_entry_free_rcu); +call_rcu (&orig_entry->rcu, batadv_tt_orig_list_entry_free_rcu); } -static void tt_local_event (struct bat_priv *bat_priv,const uint8_t *addr, -uint8_t flags) +static void batadv_tt_local_event (struct bat_priv *bat_priv, +const uint8_t *addr,uint8_t flags) {struct tt_change_node *tt_change_node;
@@ -176,7 +180,7 @@ int batadv_tt_len(int changes_num)return changes_num *sizeof (struct tt_change ); } -static int tt_local_init (struct bat_priv *bat_priv) +static int batadv_tt_local_init (struct bat_priv *bat_priv) {if (bat_priv->tt_local_hash)return 0 ;
@@ -200,7 +204,7 @@ void batadv_tt_local_add(struct net_device *soft_iface, const uint8_t *addr,struct tt_orig_list_entry *orig_entry;int hash_added; - tt_local_entry =tt_local_hash_find (bat_priv, addr); + tt_local_entry =batadv_tt_local_hash_find (bat_priv, addr);if (tt_local_entry) { tt_local_entry->last_seen = jiffies;
@@ -234,21 +238,21 @@ void batadv_tt_local_add(struct net_device *soft_iface, const uint8_t *addr,*/ tt_local_entry->common.flags |=TT_CLIENT_NEW ; - hash_added =batadv_hash_add (bat_priv->tt_local_hash, compare_tt, + hash_added =batadv_hash_add (bat_priv->tt_local_hash, batadv_compare_tt, batadv_choose_orig, &tt_local_entry->common, &tt_local_entry->common.hash_entry);if (unlikely (hash_added !=0 )) {/* remove the reference for the hash */ -tt_local_entry_free_ref (tt_local_entry); +batadv_tt_local_entry_free_ref (tt_local_entry); goto out; } -tt_local_event (bat_priv, addr, tt_local_entry->common.flags); +batadv_tt_local_event (bat_priv, addr, tt_local_entry->common.flags);/* remove address from global hash if present */ - tt_global_entry =tt_global_hash_find (bat_priv, addr); + tt_global_entry =batadv_tt_global_hash_find (bat_priv, addr);/* Check whether it is a roaming! */ if (tt_global_entry) {
@@ -258,8 +262,9 @@ void batadv_tt_local_add(struct net_device *soft_iface, const uint8_t *addr,hlist_for_each_entry_rcu (orig_entry, node, head, list) { orig_entry->orig_node->tt_poss_change = true; -send_roam_adv (bat_priv, tt_global_entry->common.addr, - orig_entry->orig_node); +batadv_send_roam_adv (bat_priv, + tt_global_entry->common.addr, + orig_entry->orig_node); }rcu_read_unlock ();/* The global entry has to be marked as ROAMING and
@@ -270,14 +275,15 @@ void batadv_tt_local_add(struct net_device *soft_iface, const uint8_t *addr, } out:if (tt_local_entry) -tt_local_entry_free_ref (tt_local_entry); +batadv_tt_local_entry_free_ref (tt_local_entry);if (tt_global_entry) -tt_global_entry_free_ref (tt_global_entry); +batadv_tt_global_entry_free_ref (tt_global_entry); } -static void tt_realloc_packet_buff (unsigned char **packet_buff, -int *packet_buff_len,int min_packet_len, -int new_packet_len) +static void batadv_tt_realloc_packet_buff (unsigned char **packet_buff, +int *packet_buff_len, +int min_packet_len, +int new_packet_len) {unsigned char *new_buff;
@@ -292,9 +298,10 @@ static void tt_realloc_packet_buff(unsigned char **packet_buff, } } -static void tt_prepare_packet_buff (struct bat_priv *bat_priv, -unsigned char **packet_buff, -int *packet_buff_len,int min_packet_len) +static void batadv_tt_prepare_packet_buff (struct bat_priv *bat_priv, +unsigned char **packet_buff, +int *packet_buff_len, +int min_packet_len) {struct hard_iface *primary_if;int req_len;
@@ -310,23 +317,24 @@ static void tt_prepare_packet_buff(struct bat_priv *bat_priv,if ((!primary_if) || (req_len > primary_if->soft_iface->mtu)) req_len = min_packet_len; -tt_realloc_packet_buff (packet_buff, packet_buff_len, - min_packet_len, req_len); +batadv_tt_realloc_packet_buff (packet_buff, packet_buff_len, + min_packet_len, req_len);if (primary_if)batadv_hardif_free_ref (primary_if); } -static int tt_changes_fill_buff (struct bat_priv *bat_priv, -unsigned char **packet_buff, -int *packet_buff_len,int min_packet_len) +static int batadv_tt_changes_fill_buff (struct bat_priv *bat_priv, +unsigned char **packet_buff, +int *packet_buff_len, +int min_packet_len) {struct tt_change_node *entry, *safe;int count =0 , tot_changes =0 , new_len;unsigned char *tt_buff; -tt_prepare_packet_buff (bat_priv, packet_buff, - packet_buff_len, min_packet_len); +batadv_tt_prepare_packet_buff (bat_priv, packet_buff, + packet_buff_len, min_packet_len); new_len = *packet_buff_len - min_packet_len; tt_buff = *packet_buff + min_packet_len;
@@ -428,12 +436,12 @@ out:return ret; } -static void tt_local_set_pending (struct bat_priv *bat_priv, -struct tt_local_entry *tt_local_entry, -uint16_t flags,const char *message) +static void batadv_tt_local_set_pending (struct bat_priv *bat_priv, +struct tt_local_entry *tt_local_entry, +uint16_t flags,const char *message) { -tt_local_event (bat_priv, tt_local_entry->common.addr, - tt_local_entry->common.flags | flags); +batadv_tt_local_event (bat_priv, tt_local_entry->common.addr, + tt_local_entry->common.flags | flags);/* The local client has to be marked as "pending to be removed" but has * to be kept in the table in order to send it in a full table
@@ -451,18 +459,19 @@ void batadv_tt_local_remove(struct bat_priv *bat_priv, const uint8_t *addr, {struct tt_local_entry *tt_local_entry =NULL ; - tt_local_entry =tt_local_hash_find (bat_priv, addr); + tt_local_entry =batadv_tt_local_hash_find (bat_priv, addr);if (!tt_local_entry) goto out; -tt_local_set_pending (bat_priv, tt_local_entry,TT_CLIENT_DEL | - (roaming ?TT_CLIENT_ROAM :NO_FLAGS ), message); +batadv_tt_local_set_pending (bat_priv, tt_local_entry,TT_CLIENT_DEL | + (roaming ?TT_CLIENT_ROAM :NO_FLAGS ), + message); out:if (tt_local_entry) -tt_local_entry_free_ref (tt_local_entry); +batadv_tt_local_entry_free_ref (tt_local_entry); } -static void tt_local_purge (struct bat_priv *bat_priv) +static void batadv_tt_local_purge (struct bat_priv *bat_priv) {struct hashtable_t *hash = bat_priv->tt_local_hash;struct tt_local_entry *tt_local_entry;
@@ -493,15 +502,15 @@ static void tt_local_purge(struct bat_priv *bat_priv) TT_LOCAL_TIMEOUT))continue ; -tt_local_set_pending (bat_priv, tt_local_entry, -TT_CLIENT_DEL ,"timed out" ); +batadv_tt_local_set_pending (bat_priv, tt_local_entry, +TT_CLIENT_DEL ,"timed out" ); }spin_unlock_bh (list_lock); } } -static void tt_local_table_free (struct bat_priv *bat_priv) +static void batadv_tt_local_table_free (struct bat_priv *bat_priv) {struct hashtable_t *hash;spinlock_t *list_lock;/* protects write access to the hash lists */
@@ -527,7 +536,7 @@ static void tt_local_table_free(struct bat_priv *bat_priv) tt_local_entry =container_of (tt_common_entry, struct tt_local_entry, common); -tt_local_entry_free_ref (tt_local_entry); +batadv_tt_local_entry_free_ref (tt_local_entry); }spin_unlock_bh (list_lock); }
@@ -537,7 +546,7 @@ static void tt_local_table_free(struct bat_priv *bat_priv) bat_priv->tt_local_hash =NULL ; } -static int tt_global_init (struct bat_priv *bat_priv) +static int batadv_tt_global_init (struct bat_priv *bat_priv) {if (bat_priv->tt_global_hash)return 0 ;
@@ -550,7 +559,7 @@ static int tt_global_init(struct bat_priv *bat_priv)return 0 ; } -static void tt_changes_list_free (struct bat_priv *bat_priv) +static void batadv_tt_changes_list_free (struct bat_priv *bat_priv) {struct tt_change_node *entry, *safe;
@@ -569,8 +578,8 @@ static void tt_changes_list_free(struct bat_priv *bat_priv)/* find out if an orig_node is already in the list of a tt_global_entry. * returns 1 if found, 0 otherwise */ -static bool tt_global_entry_has_orig (const struct tt_global_entry *entry, -const struct orig_node *orig_node) +static bool batadv_tt_global_entry_has_orig (const struct tt_global_entry *entry, +const struct orig_node *orig_node) {struct tt_orig_list_entry *tmp_orig_entry;const struct hlist_head *head;
@@ -589,9 +598,9 @@ static bool tt_global_entry_has_orig(const struct tt_global_entry *entry,return found; } -static void tt_global_add_orig_entry (struct tt_global_entry *tt_global_entry, -struct orig_node *orig_node, -int ttvn) +static void +batadv_tt_global_add_orig_entry (struct tt_global_entry *tt_global_entry, +struct orig_node *orig_node,int ttvn) {struct tt_orig_list_entry *orig_entry;
@@ -621,7 +630,7 @@ int batadv_tt_global_add(struct bat_priv *bat_priv, struct orig_node *orig_node,int hash_added;struct tt_common_entry *common; - tt_global_entry =tt_global_hash_find (bat_priv, tt_addr); + tt_global_entry =batadv_tt_global_hash_find (bat_priv, tt_addr);if (!tt_global_entry) { tt_global_entry = kzalloc(sizeof(*tt_global_entry),
@@ -640,16 +649,18 @@ int batadv_tt_global_add(struct bat_priv *bat_priv, struct orig_node *orig_node,spin_lock_init (&tt_global_entry->list_lock); hash_added =batadv_hash_add (bat_priv->tt_global_hash, - compare_tt, batadv_choose_orig, - common, &common->hash_entry); + batadv_compare_tt, + batadv_choose_orig, common, + &common->hash_entry);if (unlikely (hash_added !=0 )) {/* remove the reference for the hash */ -tt_global_entry_free_ref (tt_global_entry); +batadv_tt_global_entry_free_ref (tt_global_entry); goto out_remove; } -tt_global_add_orig_entry (tt_global_entry, orig_node, ttvn); +batadv_tt_global_add_orig_entry (tt_global_entry, orig_node, + ttvn); }else {/* there is already a global entry, use this one. */
@@ -661,14 +672,15 @@ int batadv_tt_global_add(struct bat_priv *bat_priv, struct orig_node *orig_node,* new one. */ if (tt_global_entry->common.flags &TT_CLIENT_ROAM ) { -tt_global_del_orig_list (tt_global_entry); +batadv_tt_global_del_orig_list (tt_global_entry); tt_global_entry->common.flags &= ~TT_CLIENT_ROAM ; tt_global_entry->roam_at =0 ; } -if (!tt_global_entry_has_orig (tt_global_entry, orig_node)) -tt_global_add_orig_entry (tt_global_entry, orig_node, - ttvn); +if (!batadv_tt_global_entry_has_orig (tt_global_entry, + orig_node)) +batadv_tt_global_add_orig_entry (tt_global_entry, + orig_node, ttvn); }if (wifi)
@@ -685,15 +697,16 @@ out_remove: ret =1 ; out:if (tt_global_entry) -tt_global_entry_free_ref (tt_global_entry); +batadv_tt_global_entry_free_ref (tt_global_entry);return ret; }/* print all orig nodes who announce the address for this global entry. * it is assumed that the caller holds rcu_read_lock(); */ -static void tt_global_print_entry (struct tt_global_entry *tt_global_entry, -struct seq_file *seq) +static void +batadv_tt_global_print_entry (struct tt_global_entry *tt_global_entry, +struct seq_file *seq) {struct hlist_head *head;struct hlist_node *node;
@@ -760,7 +773,7 @@ int batadv_tt_global_seq_print_text(struct seq_file *seq, void *offset) tt_global_entry =container_of (tt_common_entry, struct tt_global_entry, common); -tt_global_print_entry (tt_global_entry, seq); +batadv_tt_global_print_entry (tt_global_entry, seq); }rcu_read_unlock (); }
@@ -771,7 +784,8 @@ out: }/* deletes the orig list of a tt_global_entry */ -static void tt_global_del_orig_list (struct tt_global_entry *tt_global_entry) +static void +batadv_tt_global_del_orig_list (struct tt_global_entry *tt_global_entry) {struct hlist_head *head;struct hlist_node *node, *safe;
@@ -781,16 +795,17 @@ static void tt_global_del_orig_list(struct tt_global_entry *tt_global_entry) head = &tt_global_entry->orig_list;hlist_for_each_entry_safe (orig_entry, node, safe, head, list) {hlist_del_rcu (node); -tt_orig_list_entry_free_ref (orig_entry); +batadv_tt_orig_list_entry_free_ref (orig_entry); }spin_unlock_bh (&tt_global_entry->list_lock); } -static void tt_global_del_orig_entry (struct bat_priv *bat_priv, -struct tt_global_entry *tt_global_entry, -struct orig_node *orig_node, -const char *message) +static void +batadv_tt_global_del_orig_entry (struct bat_priv *bat_priv, +struct tt_global_entry *tt_global_entry, +struct orig_node *orig_node, +const char *message) {struct hlist_head *head;struct hlist_node *node, *safe;
@@ -805,22 +820,22 @@ static void tt_global_del_orig_entry(struct bat_priv *bat_priv, orig_node->orig, tt_global_entry->common.addr, message);hlist_del_rcu (node); -tt_orig_list_entry_free_ref (orig_entry); +batadv_tt_orig_list_entry_free_ref (orig_entry); } }spin_unlock_bh (&tt_global_entry->list_lock); } -static void tt_global_del_struct (struct bat_priv *bat_priv, -struct tt_global_entry *tt_global_entry, -const char *message) +static void batadv_tt_global_del_struct (struct bat_priv *bat_priv, +struct tt_global_entry *tt_global_entry, +const char *message) {batadv_dbg (DBG_TT , bat_priv,"Deleting global tt entry %pM: %s\n" , tt_global_entry->common.addr, message); -batadv_hash_remove (bat_priv->tt_global_hash, compare_tt, +batadv_hash_remove (bat_priv->tt_global_hash, batadv_compare_tt, batadv_choose_orig, tt_global_entry->common.addr); -tt_global_entry_free_ref (tt_global_entry); +batadv_tt_global_entry_free_ref (tt_global_entry); }
@@ -828,10 +843,10 @@ static void tt_global_del_struct(struct bat_priv *bat_priv,* within tt_global entry. If yes, we set the TT_CLIENT_ROAM flag and the timer, * otherwise we simply remove the originator scheduled for deletion. */ -static void tt_global_del_roaming (struct bat_priv *bat_priv, -struct tt_global_entry *tt_global_entry, -struct orig_node *orig_node, -const char *message) +static void +batadv_tt_global_del_roaming (struct bat_priv *bat_priv, +struct tt_global_entry *tt_global_entry, +struct orig_node *orig_node,const char *message) {bool last_entry = true;struct hlist_head *head;
@@ -860,31 +875,31 @@ static void tt_global_del_roaming(struct bat_priv *bat_priv,/* there is another entry, we can simply delete this * one and can still use the other one. */ -tt_global_del_orig_entry (bat_priv, tt_global_entry, - orig_node, message); +batadv_tt_global_del_orig_entry (bat_priv, tt_global_entry, + orig_node, message); } -static void tt_global_del (struct bat_priv *bat_priv, -struct orig_node *orig_node, -const unsigned char *addr, -const char *message,bool roaming) +static void batadv_tt_global_del (struct bat_priv *bat_priv, +struct orig_node *orig_node, +const unsigned char *addr, +const char *message,bool roaming) {struct tt_global_entry *tt_global_entry =NULL ; -struct tt_local_entry *tt_local_entry =NULL ; +struct tt_local_entry *local_entry =NULL ; - tt_global_entry =tt_global_hash_find (bat_priv, addr); + tt_global_entry =batadv_tt_global_hash_find (bat_priv, addr);if (!tt_global_entry) goto out;if (!roaming) { -tt_global_del_orig_entry (bat_priv, tt_global_entry, orig_node, - message); +batadv_tt_global_del_orig_entry (bat_priv, tt_global_entry, + orig_node, message);if (hlist_empty (&tt_global_entry->orig_list)) -tt_global_del_struct (bat_priv, tt_global_entry, - message); +batadv_tt_global_del_struct (bat_priv, tt_global_entry, + message); goto out; }
@@ -902,29 +917,29 @@ static void tt_global_del(struct bat_priv *bat_priv,* 2) the client roamed to us => we can directly delete * the global entry, since it is useless now. */ - tt_local_entry =tt_local_hash_find (bat_priv, - tt_global_entry->common.addr); -if (tt_local_entry) { + local_entry =batadv_tt_local_hash_find (bat_priv, + tt_global_entry->common.addr); +if (local_entry) {/* local entry exists, case 2: client roamed to us. */ -tt_global_del_orig_list (tt_global_entry); -tt_global_del_struct (bat_priv, tt_global_entry, message); +batadv_tt_global_del_orig_list (tt_global_entry); +batadv_tt_global_del_struct (bat_priv, tt_global_entry, message); }else /* no local entry exists, case 1: check for roaming */ -tt_global_del_roaming (bat_priv, tt_global_entry, orig_node, - message); +batadv_tt_global_del_roaming (bat_priv, tt_global_entry, + orig_node, message); out:if (tt_global_entry) -tt_global_entry_free_ref (tt_global_entry); -if (tt_local_entry) -tt_local_entry_free_ref (tt_local_entry); +batadv_tt_global_entry_free_ref (tt_global_entry); +if (local_entry) +batadv_tt_local_entry_free_ref (local_entry); }void batadv_tt_global_del_orig (struct bat_priv *bat_priv,struct orig_node *orig_node,const char *message) { -struct tt_global_entry *tt_global_entry; +struct tt_global_entry *global_entry;struct tt_common_entry *tt_common_entry;uint32_t i;struct hashtable_t *hash = bat_priv->tt_global_hash;
@@ -942,20 +957,19 @@ void batadv_tt_global_del_orig(struct bat_priv *bat_priv,spin_lock_bh (list_lock);hlist_for_each_entry_safe (tt_common_entry, node, safe, head, hash_entry) { - tt_global_entry =container_of (tt_common_entry, - struct tt_global_entry, - common); + global_entry =container_of (tt_common_entry, + struct tt_global_entry, + common); -tt_global_del_orig_entry (bat_priv, tt_global_entry, - orig_node, message); +batadv_tt_global_del_orig_entry (bat_priv, global_entry, + orig_node, message); -if (hlist_empty (&tt_global_entry->orig_list)) { +if (hlist_empty (&global_entry->orig_list)) {batadv_dbg (DBG_TT , bat_priv,"Deleting global tt entry %pM: %s\n" , - tt_global_entry->common.addr, - message); + global_entry->common.addr, message);hlist_del_rcu (node); -tt_global_entry_free_ref (tt_global_entry); +batadv_tt_global_entry_free_ref (global_entry); } }spin_unlock_bh (list_lock);
@@ -964,7 +978,7 @@ void batadv_tt_global_del_orig(struct bat_priv *bat_priv, orig_node->tt_initialised = false; } -static void tt_global_roam_purge (struct bat_priv *bat_priv) +static void batadv_tt_global_roam_purge (struct bat_priv *bat_priv) {struct hashtable_t *hash = bat_priv->tt_global_hash;struct tt_common_entry *tt_common_entry;
@@ -995,14 +1009,14 @@ static void tt_global_roam_purge(struct bat_priv *bat_priv) tt_global_entry->common.addr);hlist_del_rcu (node); -tt_global_entry_free_ref (tt_global_entry); +batadv_tt_global_entry_free_ref (tt_global_entry); }spin_unlock_bh (list_lock); } } -static void tt_global_table_free (struct bat_priv *bat_priv) +static void batadv_tt_global_table_free (struct bat_priv *bat_priv) {struct hashtable_t *hash;spinlock_t *list_lock;/* protects write access to the hash lists */
@@ -1028,7 +1042,7 @@ static void tt_global_table_free(struct bat_priv *bat_priv) tt_global_entry =container_of (tt_common_entry, struct tt_global_entry, common); -tt_global_entry_free_ref (tt_global_entry); +batadv_tt_global_entry_free_ref (tt_global_entry); }spin_unlock_bh (list_lock); }
@@ -1038,8 +1052,8 @@ static void tt_global_table_free(struct bat_priv *bat_priv) bat_priv->tt_global_hash =NULL ; } -static bool _is_ap_isolated (struct tt_local_entry *tt_local_entry, -struct tt_global_entry *tt_global_entry) +static bool _batadv_is_ap_isolated (struct tt_local_entry *tt_local_entry, +struct tt_global_entry *tt_global_entry) {bool ret = false;
@@ -1064,19 +1078,20 @@ struct orig_node *batadv_transtable_search(struct bat_priv *bat_priv,int best_tq;if (src &&atomic_read (&bat_priv->ap_isolation)) { - tt_local_entry =tt_local_hash_find (bat_priv, src); + tt_local_entry =batadv_tt_local_hash_find (bat_priv, src);if (!tt_local_entry) goto out; } - tt_global_entry =tt_global_hash_find (bat_priv, addr); + tt_global_entry =batadv_tt_global_hash_find (bat_priv, addr);if (!tt_global_entry) goto out;/* check whether the clients should not communicate due to AP * isolation */ -if (tt_local_entry &&_is_ap_isolated (tt_local_entry, tt_global_entry)) +if (tt_local_entry && +_batadv_is_ap_isolated (tt_local_entry, tt_global_entry)) goto out; best_tq =0 ;
@@ -1100,16 +1115,16 @@ struct orig_node *batadv_transtable_search(struct bat_priv *bat_priv,rcu_read_unlock (); out:if (tt_global_entry) -tt_global_entry_free_ref (tt_global_entry); +batadv_tt_global_entry_free_ref (tt_global_entry);if (tt_local_entry) -tt_local_entry_free_ref (tt_local_entry); +batadv_tt_local_entry_free_ref (tt_local_entry);return orig_node; }/* Calculates the checksum of the local table of a given orig_node */ -static uint16_t tt_global_crc (struct bat_priv *bat_priv, -struct orig_node *orig_node) +static uint16_t batadv_tt_global_crc (struct bat_priv *bat_priv, +struct orig_node *orig_node) {uint16_t total =0 , total_one;struct hashtable_t *hash = bat_priv->tt_global_hash;
@@ -1140,8 +1155,8 @@ static uint16_t tt_global_crc(struct bat_priv *bat_priv,/* find out if this global entry is announced by this * originator */ -if (!tt_global_entry_has_orig (tt_global_entry, - orig_node)) +if (!batadv_tt_global_entry_has_orig (tt_global_entry, + orig_node))continue ; total_one =0 ;
@@ -1190,7 +1205,7 @@ uint16_t batadv_tt_local_crc(struct bat_priv *bat_priv)return total; } -static void tt_req_list_free (struct bat_priv *bat_priv) +static void batadv_tt_req_list_free (struct bat_priv *bat_priv) {struct tt_req_node *node, *safe;
@@ -1204,10 +1219,10 @@ static void tt_req_list_free(struct bat_priv *bat_priv)spin_unlock_bh (&bat_priv->tt_req_list_lock); } -static void tt_save_orig_buffer (struct bat_priv *bat_priv, -struct orig_node *orig_node, -const unsigned char *tt_buff, -uint8_t tt_num_changes) +static void batadv_tt_save_orig_buffer (struct bat_priv *bat_priv, +struct orig_node *orig_node, +const unsigned char *tt_buff, +uint8_t tt_num_changes) {uint16_t tt_buff_len =batadv_tt_len (tt_num_changes);
@@ -1227,7 +1242,7 @@ static void tt_save_orig_buffer(struct bat_priv *bat_priv,spin_unlock_bh (&orig_node->tt_buff_lock); } -static void tt_req_purge (struct bat_priv *bat_priv) +static void batadv_tt_req_purge (struct bat_priv *bat_priv) {struct tt_req_node *node, *safe;
@@ -1244,8 +1259,8 @@ static void tt_req_purge(struct bat_priv *bat_priv)/* returns the pointer to the new tt_req_node struct if no request * has already been issued for this orig_node, NULL otherwise */ -static struct tt_req_node *new_tt_req_node (struct bat_priv *bat_priv, -struct orig_node *orig_node) +static struct tt_req_node *batadv_new_tt_req_node (struct bat_priv *bat_priv, +struct orig_node *orig_node) {struct tt_req_node *tt_req_node_tmp, *tt_req_node =NULL ;
@@ -1271,7 +1286,8 @@ unlock: }/* data_ptr is useless here, but has to be kept to respect the prototype */ -static int tt_local_valid_entry (const void *entry_ptr,const void *data_ptr) +static int batadv_tt_local_valid_entry (const void *entry_ptr, +const void *data_ptr) {const struct tt_common_entry *tt_common_entry = entry_ptr;
@@ -1280,7 +1296,8 @@ static int tt_local_valid_entry(const void *entry_ptr, const void *data_ptr)return 1 ; } -static int tt_global_valid_entry (const void *entry_ptr,const void *data_ptr) +static int batadv_tt_global_valid (const void *entry_ptr, +const void *data_ptr) {const struct tt_common_entry *tt_common_entry = entry_ptr;const struct tt_global_entry *tt_global_entry;
@@ -1292,15 +1309,15 @@ static int tt_global_valid_entry(const void *entry_ptr, const void *data_ptr) tt_global_entry = container_of(tt_common_entry, struct tt_global_entry, common); -return tt_global_entry_has_orig (tt_global_entry, orig_node); +return batadv_tt_global_entry_has_orig (tt_global_entry, orig_node); } -static struct sk_buff *tt_response_fill_table (uint16_t tt_len,uint8_t ttvn, -struct hashtable_t *hash, -struct hard_iface *primary_if, -int (*valid_cb)(const void *, -const void *), -void *cb_data) +static struct sk_buff * +batadv_tt_response_fill_table (uint16_t tt_len,uint8_t ttvn, +struct hashtable_t *hash, +struct hard_iface *primary_if, +int (*valid_cb)(const void *,const void *), +void *cb_data) {struct tt_common_entry *tt_common_entry;struct tt_query_packet *tt_response;
@@ -1361,9 +1378,10 @@ out:return skb; } -static int send_tt_request (struct bat_priv *bat_priv, -struct orig_node *dst_orig_node, -uint8_t ttvn,uint16_t tt_crc,bool full_table) +static int batadv_send_tt_request (struct bat_priv *bat_priv, +struct orig_node *dst_orig_node, +uint8_t ttvn,uint16_t tt_crc, +bool full_table) {struct sk_buff *skb =NULL ;struct tt_query_packet *tt_request;
@@ -1379,7 +1397,7 @@ static int send_tt_request(struct bat_priv *bat_priv,/* The new tt_req will be issued only if I'm not waiting for a * reply from the same orig_node yet */ - tt_req_node =new_tt_req_node (bat_priv, dst_orig_node); + tt_req_node =batadv_new_tt_req_node (bat_priv, dst_orig_node);if (!tt_req_node) goto out;
@@ -1434,8 +1452,8 @@ out:return ret; } -static bool send_other_tt_response (struct bat_priv *bat_priv, -struct tt_query_packet *tt_request) +static bool batadv_send_other_tt_response (struct bat_priv *bat_priv, +struct tt_query_packet *tt_request) {struct orig_node *req_dst_orig_node =NULL , *res_dst_orig_node =NULL ;struct neigh_node *neigh_node =NULL ;
@@ -1515,10 +1533,11 @@ static bool send_other_tt_response(struct bat_priv *bat_priv,sizeof (struct tt_change ); ttvn = (uint8_t )atomic_read (&req_dst_orig_node->last_ttvn); - skb =tt_response_fill_table (tt_len, ttvn, - bat_priv->tt_global_hash, - primary_if, tt_global_valid_entry, - req_dst_orig_node); + skb =batadv_tt_response_fill_table (tt_len, ttvn, + bat_priv->tt_global_hash, + primary_if, + batadv_tt_global_valid, + req_dst_orig_node);if (!skb) goto out;
@@ -1563,8 +1582,8 @@ out:return ret; } -static bool send_my_tt_response (struct bat_priv *bat_priv, -struct tt_query_packet *tt_request) +static bool batadv_send_my_tt_response (struct bat_priv *bat_priv, +struct tt_query_packet *tt_request) {struct orig_node *orig_node =NULL ;struct neigh_node *neigh_node =NULL ;
@@ -1635,10 +1654,11 @@ static bool send_my_tt_response(struct bat_priv *bat_priv,sizeof (struct tt_change ); ttvn = (uint8_t )atomic_read (&bat_priv->ttvn); - skb =tt_response_fill_table (tt_len, ttvn, - bat_priv->tt_local_hash, - primary_if, tt_local_valid_entry, -NULL ); + skb =batadv_tt_response_fill_table (tt_len, ttvn, + bat_priv->tt_local_hash, + primary_if, + batadv_tt_local_valid_entry, +NULL );if (!skb) goto out;
@@ -1689,26 +1709,28 @@ bool batadv_send_tt_response(struct bat_priv *bat_priv, if (batadv_bla_is_backbone_gw_orig(bat_priv, tt_request->src)) return true; - return send_my_tt_response(bat_priv, tt_request); + return batadv_send_my_tt_response(bat_priv, tt_request); } else { - return send_other_tt_response(bat_priv, tt_request); + return batadv_send_other_tt_response(bat_priv, tt_request); } } -static void _tt_update_changes(struct bat_priv *bat_priv, - struct orig_node *orig_node, - struct tt_change *tt_change, - uint16_t tt_num_changes, uint8_t ttvn) +static void _batadv_tt_update_changes(struct bat_priv *bat_priv, + struct orig_node *orig_node, + struct tt_change *tt_change, + uint16_t tt_num_changes, uint8_t ttvn) { int i; int is_wifi; + int roams; for (i = 0; i < tt_num_changes; i++) { if ((tt_change + i)->flags & TT_CLIENT_DEL) { - tt_global_del(bat_priv, orig_node, - (tt_change + i)->addr, - "tt removed by changes", - (tt_change + i)->flags & TT_CLIENT_ROAM); + roams = (tt_change + i)->flags & TT_CLIENT_ROAM; + batadv_tt_global_del(bat_priv, orig_node, + (tt_change + i)->addr, + "tt removed by changes", + roams); } else { is_wifi = (tt_change + i)->flags & TT_CLIENT_WIFI; if (!batadv_tt_global_add(bat_priv, orig_node,
@@ -1726,8 +1748,8 @@ static void _tt_update_changes(struct bat_priv *bat_priv, orig_node->tt_initialised = true; } -static void tt_fill_gtable (struct bat_priv *bat_priv, -struct tt_query_packet *tt_response) +static void batadv_tt_fill_gtable (struct bat_priv *bat_priv, +struct tt_query_packet *tt_response) {struct orig_node *orig_node =NULL ;
@@ -1738,9 +1760,10 @@ static void tt_fill_gtable(struct bat_priv *bat_priv,/* Purge the old table first.. */ batadv_tt_global_del_orig (bat_priv, orig_node,"Received full table" ); -_tt_update_changes (bat_priv, orig_node, - (struct tt_change *)(tt_response +1 ), -ntohs (tt_response->tt_data), tt_response->ttvn); +_batadv_tt_update_changes (bat_priv, orig_node, + (struct tt_change *)(tt_response +1 ), +ntohs (tt_response->tt_data), + tt_response->ttvn);spin_lock_bh (&orig_node->tt_buff_lock);kfree (orig_node->tt_buff);
@@ -1755,16 +1778,16 @@ out:batadv_orig_node_free_ref (orig_node); } -static void tt_update_changes (struct bat_priv *bat_priv, -struct orig_node *orig_node, -uint16_t tt_num_changes,uint8_t ttvn, -struct tt_change *tt_change) +static void batadv_tt_update_changes (struct bat_priv *bat_priv, +struct orig_node *orig_node, +uint16_t tt_num_changes,uint8_t ttvn, +struct tt_change *tt_change) { -_tt_update_changes (bat_priv, orig_node, tt_change, tt_num_changes, - ttvn); +_batadv_tt_update_changes (bat_priv, orig_node, tt_change, + tt_num_changes, ttvn); -tt_save_orig_buffer (bat_priv, orig_node, (unsigned char *)tt_change, - tt_num_changes); +batadv_tt_save_orig_buffer (bat_priv, orig_node, + (unsigned char *)tt_change, tt_num_changes);atomic_set (&orig_node->last_ttvn, ttvn); }
@@ -1773,7 +1796,7 @@ bool batadv_is_my_client(struct bat_priv *bat_priv, const uint8_t *addr)struct tt_local_entry *tt_local_entry =NULL ;bool ret = false; - tt_local_entry =tt_local_hash_find (bat_priv, addr); + tt_local_entry =batadv_tt_local_hash_find (bat_priv, addr);if (!tt_local_entry) goto out;/* Check if the client has been logically deleted (but is kept for
@@ -1784,7 +1807,7 @@ bool batadv_is_my_client(struct bat_priv *bat_priv, const uint8_t *addr) ret = true; out:if (tt_local_entry) -tt_local_entry_free_ref (tt_local_entry); +batadv_tt_local_entry_free_ref (tt_local_entry);return ret; }
@@ -1809,12 +1832,12 @@ void batadv_handle_tt_response(struct bat_priv *bat_priv, goto out;if (tt_response->flags &TT_FULL_TABLE ) -tt_fill_gtable (bat_priv, tt_response); +batadv_tt_fill_gtable (bat_priv, tt_response);else -tt_update_changes (bat_priv, orig_node, -ntohs (tt_response->tt_data), - tt_response->ttvn, - (struct tt_change *)(tt_response +1 )); +batadv_tt_update_changes (bat_priv, orig_node, +ntohs (tt_response->tt_data), + tt_response->ttvn, + (struct tt_change *)(tt_response +1 ));/* Delete the tt_req_node from pending tt_requests list */ spin_lock_bh (&bat_priv->tt_req_list_lock);
@@ -1827,7 +1850,7 @@ void batadv_handle_tt_response(struct bat_priv *bat_priv,spin_unlock_bh (&bat_priv->tt_req_list_lock);/* Recalculate the CRC for this orig_node and store it */ - orig_node->tt_crc =tt_global_crc (bat_priv, orig_node); + orig_node->tt_crc =batadv_tt_global_crc (bat_priv, orig_node);/* Roaming phase is over: tables are in sync again. I can * unset the flag */
@@ -1841,20 +1864,20 @@ int batadv_tt_init(struct bat_priv *bat_priv) {int ret; - ret =tt_local_init (bat_priv); + ret =batadv_tt_local_init (bat_priv);if (ret <0 )return ret; - ret =tt_global_init (bat_priv); + ret =batadv_tt_global_init (bat_priv);if (ret <0 )return ret; -tt_start_timer (bat_priv); +batadv_tt_start_timer (bat_priv);return 1 ; } -static void tt_roam_list_free (struct bat_priv *bat_priv) +static void batadv_tt_roam_list_free (struct bat_priv *bat_priv) {struct tt_roam_node *node, *safe;
@@ -1868,7 +1891,7 @@ static void tt_roam_list_free(struct bat_priv *bat_priv)spin_unlock_bh (&bat_priv->tt_roam_list_lock); } -static void tt_roam_purge (struct bat_priv *bat_priv) +static void batadv_tt_roam_purge (struct bat_priv *bat_priv) {struct tt_roam_node *node, *safe;
@@ -1889,8 +1912,8 @@ static void tt_roam_purge(struct bat_priv *bat_priv)* * returns true if the ROAMING_ADV can be sent, false otherwise */ -static bool tt_check_roam_count (struct bat_priv *bat_priv, -uint8_t *client) +static bool batadv_tt_check_roam_count (struct bat_priv *bat_priv, +uint8_t *client) {struct tt_roam_node *tt_roam_node;bool ret = false;
@@ -1932,8 +1955,8 @@ unlock:return ret; } -static void send_roam_adv (struct bat_priv *bat_priv,uint8_t *client, -struct orig_node *orig_node) +static void batadv_send_roam_adv (struct bat_priv *bat_priv,uint8_t *client, +struct orig_node *orig_node) {struct neigh_node *neigh_node =NULL ;struct sk_buff *skb =NULL ;
@@ -1944,7 +1967,7 @@ static void send_roam_adv(struct bat_priv *bat_priv, uint8_t *client,/* before going on we have to check whether the client has * already roamed to us too many times */ -if (!tt_check_roam_count (bat_priv, client)) +if (!batadv_tt_check_roam_count (bat_priv, client)) goto out; skb =dev_alloc_skb (sizeof (struct roam_adv_packet ) +ETH_HLEN );
@@ -1988,30 +2011,30 @@ out:return ; } -static void tt_purge (struct work_struct *work) +static void batadv_tt_purge (struct work_struct *work) {struct delayed_work *delayed_work = container_of(work, struct delayed_work, work);struct bat_priv *bat_priv = container_of(delayed_work, struct bat_priv, tt_work); -tt_local_purge (bat_priv); -tt_global_roam_purge (bat_priv); -tt_req_purge (bat_priv); -tt_roam_purge (bat_priv); +batadv_tt_local_purge (bat_priv); +batadv_tt_global_roam_purge (bat_priv); +batadv_tt_req_purge (bat_priv); +batadv_tt_roam_purge (bat_priv); -tt_start_timer (bat_priv); +batadv_tt_start_timer (bat_priv); }void batadv_tt_free (struct bat_priv *bat_priv) {cancel_delayed_work_sync (&bat_priv->tt_work); -tt_local_table_free (bat_priv); -tt_global_table_free (bat_priv); -tt_req_list_free (bat_priv); -tt_changes_list_free (bat_priv); -tt_roam_list_free (bat_priv); +batadv_tt_local_table_free (bat_priv); +batadv_tt_global_table_free (bat_priv); +batadv_tt_req_list_free (bat_priv); +batadv_tt_changes_list_free (bat_priv); +batadv_tt_roam_list_free (bat_priv);kfree (bat_priv->tt_buff); }
@@ -2019,8 +2042,8 @@ void batadv_tt_free(struct bat_priv *bat_priv)/* This function will enable or disable the specified flags for all the entries * in the given hash table and returns the number of modified entries */ -static uint16_t tt_set_flags (struct hashtable_t *hash,uint16_t flags, -bool enable) +static uint16_t batadv_tt_set_flags (struct hashtable_t *hash,uint16_t flags, +bool enable) {uint32_t i;uint16_t changed_num =0 ;
@@ -2055,7 +2078,7 @@ out: }/* Purge out all the tt local entries marked with TT_CLIENT_PENDING */ -static void tt_local_purge_pending_clients (struct bat_priv *bat_priv) +static void batadv_tt_local_purge_pending_clients (struct bat_priv *bat_priv) {struct hashtable_t *hash = bat_priv->tt_local_hash;struct tt_common_entry *tt_common_entry;
@@ -2087,28 +2110,28 @@ static void tt_local_purge_pending_clients(struct bat_priv *bat_priv) tt_local_entry =container_of (tt_common_entry, struct tt_local_entry, common); -tt_local_entry_free_ref (tt_local_entry); +batadv_tt_local_entry_free_ref (tt_local_entry); }spin_unlock_bh (list_lock); } } -static int tt_commit_changes (struct bat_priv *bat_priv, -unsigned char **packet_buff,int *packet_buff_len, -int packet_min_len) +static int batadv_tt_commit_changes (struct bat_priv *bat_priv, +unsigned char **packet_buff, +int *packet_buff_len,int packet_min_len) {uint16_t changed_num =0 ;if (atomic_read (&bat_priv->tt_local_changes) <1 )return -ENOENT ; - changed_num =tt_set_flags (bat_priv->tt_local_hash, -TT_CLIENT_NEW , false); + changed_num =batadv_tt_set_flags (bat_priv->tt_local_hash, +TT_CLIENT_NEW , false);/* all reset entries have to be counted as local entries */ atomic_add (changed_num, &bat_priv->num_local_tt); -tt_local_purge_pending_clients (bat_priv); +batadv_tt_local_purge_pending_clients (bat_priv); bat_priv->tt_crc =batadv_tt_local_crc (bat_priv);/* Increment the TTVN only once per OGM interval */
@@ -2121,8 +2144,8 @@ static int tt_commit_changes(struct bat_priv *bat_priv,/* reset the sending counter */ atomic_set (&bat_priv->tt_ogm_append_cnt,TT_OGM_APPEND_MAX ); -return tt_changes_fill_buff (bat_priv, packet_buff, - packet_buff_len, packet_min_len); +return batadv_tt_changes_fill_buff (bat_priv, packet_buff, + packet_buff_len, packet_min_len); }/* when calling this function (hard_iface == primary_if) has to be true */
@@ -2133,14 +2156,15 @@ int batadv_tt_append_diff(struct bat_priv *bat_priv,int tt_num_changes;/* if at least one change happened */ - tt_num_changes =tt_commit_changes (bat_priv, packet_buff, - packet_buff_len, packet_min_len); + tt_num_changes =batadv_tt_commit_changes (bat_priv, packet_buff, + packet_buff_len, + packet_min_len);/* if the changes have been sent often enough */ if ((tt_num_changes <0 ) && (!atomic_dec_not_zero (&bat_priv->tt_ogm_append_cnt))) { -tt_realloc_packet_buff (packet_buff, packet_buff_len, - packet_min_len, packet_min_len); +batadv_tt_realloc_packet_buff (packet_buff, packet_buff_len, + packet_min_len, packet_min_len); tt_num_changes =0 ; }
@@ -2157,24 +2181,24 @@ bool batadv_is_ap_isolated(struct bat_priv *bat_priv, uint8_t *src,if (!atomic_read (&bat_priv->ap_isolation))return false; - tt_local_entry =tt_local_hash_find (bat_priv, dst); + tt_local_entry =batadv_tt_local_hash_find (bat_priv, dst);if (!tt_local_entry) goto out; - tt_global_entry =tt_global_hash_find (bat_priv, src); + tt_global_entry =batadv_tt_global_hash_find (bat_priv, src);if (!tt_global_entry) goto out; -if (_is_ap_isolated (tt_local_entry, tt_global_entry)) +if (_batadv_is_ap_isolated (tt_local_entry, tt_global_entry)) goto out; ret = false; out:if (tt_global_entry) -tt_global_entry_free_ref (tt_global_entry); +batadv_tt_global_entry_free_ref (tt_global_entry);if (tt_local_entry) -tt_local_entry_free_ref (tt_local_entry); +batadv_tt_local_entry_free_ref (tt_local_entry);return ret; }
@@ -2204,14 +2228,14 @@ void batadv_tt_update_orig(struct bat_priv *bat_priv, goto request_table; } -tt_update_changes (bat_priv, orig_node, tt_num_changes, ttvn, - (struct tt_change *)tt_buff); +batadv_tt_update_changes (bat_priv, orig_node, tt_num_changes, + ttvn, (struct tt_change *)tt_buff);/* Even if we received the precomputed crc with the OGM, we * prefer to recompute it to spot any possible inconsistency * in the global table */ - orig_node->tt_crc =tt_global_crc (bat_priv, orig_node); + orig_node->tt_crc =batadv_tt_global_crc (bat_priv, orig_node);/* The ttvn alone is not enough to guarantee consistency * because a single value could represent different states
@@ -2240,8 +2264,8 @@ request_table:"TT inconsistency for %pM. Need to retrieve the correct information (ttvn: %u last_ttvn: %u crc: %u last_crc: %u num_changes: %u)\n" , orig_node->orig, ttvn, orig_ttvn, tt_crc, orig_node->tt_crc, tt_num_changes); -send_tt_request (bat_priv, orig_node, ttvn, tt_crc, - full_table); +batadv_send_tt_request (bat_priv, orig_node, ttvn, + tt_crc, full_table);return ; } }
@@ -2257,12 +2281,12 @@ bool batadv_tt_global_client_is_roaming(struct bat_priv *bat_priv,struct tt_global_entry *tt_global_entry;bool ret = false; - tt_global_entry =tt_global_hash_find (bat_priv, addr); + tt_global_entry =batadv_tt_global_hash_find (bat_priv, addr);if (!tt_global_entry) goto out; ret = tt_global_entry->common.flags &TT_CLIENT_ROAM ; -tt_global_entry_free_ref (tt_global_entry); +batadv_tt_global_entry_free_ref (tt_global_entry); out:return ret; }
Signature · 1 line
1.7.10
PATCH 16/18 batman-adv: Prefix unicast local static functions with batadv_
In reply to Sven EckelmannAll non-static symbols of batman-adv were prefixed with batadv_ to avoid collisions with other symbols of the kernel. Other symbols of batman-adv should use the same prefix to keep the naming scheme consistent.
--- unicast.c | 47 +++++++++++++++++++++++++---------------------- 1 file changed, 25 insertions(+), 22 deletions(-)
unicast.c +25 -22
@@ -29,9 +29,10 @@#include "hard-interface.h" -static struct sk_buff *frag_merge_packet (struct list_head *head, -struct frag_packet_list_entry *tfp, -struct sk_buff *skb) +static struct sk_buff * +batadv_frag_merge_packet (struct list_head *head, +struct frag_packet_list_entry *tfp, +struct sk_buff *skb) {struct unicast_frag_packet *up = (struct unicast_frag_packet *)skb->data;
@@ -75,7 +76,8 @@ err:return NULL ; } -static void frag_create_entry (struct list_head *head,struct sk_buff *skb) +static void batadv_frag_create_entry (struct list_head *head, +struct sk_buff *skb) {struct frag_packet_list_entry *tfp; struct unicast_frag_packet *up =
@@ -91,7 +93,7 @@ static void frag_create_entry(struct list_head *head, struct sk_buff *skb)return ; } -static int frag_create_buffer (struct list_head *head) +static int batadv_frag_create_buffer (struct list_head *head) {int i;struct frag_packet_list_entry *tfp;
@@ -111,8 +113,9 @@ static int frag_create_buffer(struct list_head *head)return 0 ; } -static struct frag_packet_list_entry *frag_search_packet (struct list_head *head, -const struct unicast_frag_packet *up) +static struct frag_packet_list_entry * +batadv_frag_search_packet (struct list_head *head, +const struct unicast_frag_packet *up) {struct frag_packet_list_entry *tfp;struct unicast_frag_packet *tmp_up =NULL ;
@@ -188,22 +191,22 @@ int batadv_frag_reassemble_skb(struct sk_buff *skb, struct bat_priv *bat_priv, orig_node->last_frag_packet = jiffies;if (list_empty (&orig_node->frag_list) && -frag_create_buffer (&orig_node->frag_list)) { +batadv_frag_create_buffer (&orig_node->frag_list)) {pr_debug ("couldn't create frag buffer\n" ); goto out; } - tmp_frag_entry =frag_search_packet (&orig_node->frag_list, - unicast_packet); + tmp_frag_entry =batadv_frag_search_packet (&orig_node->frag_list, + unicast_packet);if (!tmp_frag_entry) { -frag_create_entry (&orig_node->frag_list, skb); +batadv_frag_create_entry (&orig_node->frag_list, skb); ret =NET_RX_SUCCESS ; goto out; } - *new_skb =frag_merge_packet (&orig_node->frag_list, tmp_frag_entry, - skb); + *new_skb =batadv_frag_merge_packet (&orig_node->frag_list, + tmp_frag_entry, skb);/* if not, merge failed */ if (*new_skb) ret =NET_RX_SUCCESS ;
@@ -281,8 +284,8 @@ out:return ret; } -static bool pull_and_fill_unicast (struct sk_buff *skb,int hdr_size, -struct orig_node *orig_node) +static bool batadv_pull_and_fill_unicast (struct sk_buff *skb,int hdr_size, +struct orig_node *orig_node) {struct unicast_packet *unicast_packet;
@@ -304,11 +307,11 @@ static bool pull_and_fill_unicast(struct sk_buff *skb, int hdr_size,return true; } -static bool prepare_unicast_packet (struct sk_buff *skb, -struct orig_node *orig_node) +static bool batadv_prepare_unicast_packet (struct sk_buff *skb, +struct orig_node *orig_node) { -return pull_and_fill_unicast (skb,sizeof (struct unicast_packet ), - orig_node); +return batadv_pull_and_fill_unicast (skb,sizeof (struct unicast_packet ), + orig_node); } bool batadv_prepare_unicast_4addr_packet(struct bat_priv *bat_priv,
@@ -328,8 +331,8 @@ bool batadv_prepare_unicast_4addr_packet(struct bat_priv *bat_priv,* We can do that because the first member of the unicast_4addr_packet * is of type struct unicast_packet */ -if (!pull_and_fill_unicast (skb,sizeof (*unicast_4addr_packet), - orig_node)) +if (!batadv_pull_and_fill_unicast (skb,sizeof (*unicast_4addr_packet), + orig_node)) goto out; unicast_4addr_packet = (struct unicast_4addr_packet *)skb->data;
@@ -379,7 +382,7 @@ find_router:switch (packet_type) {case BAT_UNICAST : -prepare_unicast_packet (skb, orig_node); +batadv_prepare_unicast_packet (skb, orig_node);break ;case BAT_UNICAST_4ADDR : batadv_prepare_unicast_4addr_packet(bat_priv, skb, orig_node,
Signature · 1 line
1.7.10
PATCH 17/18 batman-adv: Prefix vis local static functions with batadv_
In reply to Sven EckelmannAll non-static symbols of batman-adv were prefixed with batadv_ to avoid collisions with other symbols of the kernel. Other symbols of batman-adv should use the same prefix to keep the naming scheme consistent.
--- vis.c | 201 +++++++++++++++++++++++++++++++++-------------------------------- 1 file changed, 103 insertions(+), 98 deletions(-)
vis.c +103 -98
@@ -28,10 +28,10 @@#define MAX_VIS_PACKET_SIZE 1000 -static void start_vis_timer (struct bat_priv *bat_priv); +static void batadv_start_vis_timer (struct bat_priv *bat_priv);/* free the info */ -static void free_info (struct kref *ref) +static void batadv_free_info (struct kref *ref) { struct vis_info *info = container_of(ref, struct vis_info, refcount);struct bat_priv *bat_priv = info->bat_priv;
@@ -50,7 +50,7 @@ static void free_info(struct kref *ref) }/* Compare two vis packets, used by the hashing algorithm */ -static int vis_info_cmp (const struct hlist_node *node,const void *data2) +static int batadv_vis_info_cmp (const struct hlist_node *node,const void *data2) {const struct vis_info *d1, *d2;const struct vis_packet *p1, *p2;
@@ -65,7 +65,7 @@ static int vis_info_cmp(const struct hlist_node *node, const void *data2)/* hash function to choose an entry in a hash table of given size * hash algorithm from http://en.wikipedia.org/wiki/Hash_table */ -static uint32_t vis_info_choose (const void *data,uint32_t size) +static uint32_t batadv_vis_info_choose (const void *data,uint32_t size) {const struct vis_info *vis_info = data;const struct vis_packet *packet;
@@ -88,8 +88,8 @@ static uint32_t vis_info_choose(const void *data, uint32_t size)return hash % size; } -static struct vis_info *vis_hash_find (struct bat_priv *bat_priv, -const void *data) +static struct vis_info *batadv_vis_hash_find (struct bat_priv *bat_priv, +const void *data) {struct hashtable_t *hash = bat_priv->vis_hash;struct hlist_head *head;
@@ -100,12 +100,12 @@ static struct vis_info *vis_hash_find(struct bat_priv *bat_priv,if (!hash)return NULL ; - index =vis_info_choose (data, hash->size); + index =batadv_vis_info_choose (data, hash->size); head = &hash->table[index];rcu_read_lock ();hlist_for_each_entry_rcu (vis_info, node, head, hash_entry) { -if (!vis_info_cmp (node, data)) +if (!batadv_vis_info_cmp (node, data))continue ; vis_info_tmp = vis_info;
@@ -119,9 +119,9 @@ static struct vis_info *vis_hash_find(struct bat_priv *bat_priv,/* insert interface to the list of interfaces of one originator, if it * does not already exist in the list */ -static void vis_data_insert_interface (const uint8_t *interface, -struct hlist_head *if_list, -bool primary) +static void batadv_vis_data_insert_interface (const uint8_t *interface, +struct hlist_head *if_list, +bool primary) {struct if_list_entry *entry;struct hlist_node *pos;
@@ -140,8 +140,7 @@ static void vis_data_insert_interface(const uint8_t *interface,hlist_add_head (&entry->list, if_list); } -static ssize_t vis_data_read_prim_sec (char *buff, -const struct hlist_head *if_list) +static ssize_t batadv_vis_prim_sec (char *buff,const struct hlist_head *if_list) {struct if_list_entry *entry;struct hlist_node *pos;
@@ -157,7 +156,7 @@ static ssize_t vis_data_read_prim_sec(char *buff,return len; } -static size_t vis_data_count_prim_sec (struct hlist_head *if_list) +static size_t batadv_vis_cnt_prim_sec (struct hlist_head *if_list) {struct if_list_entry *entry;struct hlist_node *pos;
@@ -174,9 +173,9 @@ static size_t vis_data_count_prim_sec(struct hlist_head *if_list) }/* read an entry */ -static ssize_t vis_data_read_entry (char *buff, -const struct vis_info_entry *entry, -const uint8_t *src,bool primary) +static ssize_t batadv_vis_data_read_entry (char *buff, +const struct vis_info_entry *entry, +const uint8_t *src,bool primary) {/* maximal length: max(4+17+2, 3+17+1+3+2) == 26 */ if (primary && entry->quality ==0 )
@@ -227,8 +226,8 @@ int batadv_vis_seq_print_text(struct seq_file *seq, void *offset) entries = (struct vis_info_entry *) ((char *)packet +sizeof (*packet)); -vis_data_insert_interface (packet->vis_orig, - &vis_if_list, true); +batadv_vis_data_insert_interface (packet->vis_orig, + &vis_if_list, true);for (j =0 ; j < packet->entries; j++) {if (entries[j].quality ==0 )
@@ -236,9 +235,9 @@ int batadv_vis_seq_print_text(struct seq_file *seq, void *offset)if (batadv_compare_eth (entries[j].src, packet->vis_orig))continue ; -vis_data_insert_interface (entries[j].src, - &vis_if_list, - false); +batadv_vis_data_insert_interface (entries[j].src, + &vis_if_list, + false); }hlist_for_each_entry (entry, pos, &vis_if_list, list) {
@@ -248,7 +247,7 @@ int batadv_vis_seq_print_text(struct seq_file *seq, void *offset)if (batadv_compare_eth (entry->addr, packet->vis_orig)) buf_size += -vis_data_count_prim_sec (&vis_if_list); +batadv_vis_cnt_prim_sec (&vis_if_list); buf_size +=1 ; }
@@ -280,8 +279,8 @@ int batadv_vis_seq_print_text(struct seq_file *seq, void *offset) entries = (struct vis_info_entry *) ((char *)packet +sizeof (*packet)); -vis_data_insert_interface (packet->vis_orig, - &vis_if_list, true); +batadv_vis_data_insert_interface (packet->vis_orig, + &vis_if_list, true);for (j =0 ; j < packet->entries; j++) {if (entries[j].quality ==0 )
@@ -289,9 +288,9 @@ int batadv_vis_seq_print_text(struct seq_file *seq, void *offset)if (batadv_compare_eth (entries[j].src, packet->vis_orig))continue ; -vis_data_insert_interface (entries[j].src, - &vis_if_list, - false); +batadv_vis_data_insert_interface (entries[j].src, + &vis_if_list, + false); }hlist_for_each_entry (entry, pos, &vis_if_list, list) {
@@ -299,7 +298,7 @@ int batadv_vis_seq_print_text(struct seq_file *seq, void *offset) entry->addr);for (j =0 ; j < packet->entries; j++) - buff_pos += vis_data_read_entry( + buff_pos += batadv_vis_data_read_entry( buff + buff_pos, &entries[j], entry->addr,
@@ -309,8 +308,8 @@ int batadv_vis_seq_print_text(struct seq_file *seq, void *offset)if (batadv_compare_eth (entry->addr, packet->vis_orig)) buff_pos += -vis_data_read_prim_sec (buff + buff_pos, - &vis_if_list); +batadv_vis_prim_sec (buff + buff_pos, + &vis_if_list); buff_pos +=sprintf (buff + buff_pos,"\n" ); }
@@ -338,7 +337,8 @@ out:/* add the info packet to the send list, if it was not * already linked in. */ -static void send_list_add (struct bat_priv *bat_priv,struct vis_info *info) +static void batadv_send_list_add (struct bat_priv *bat_priv, +struct vis_info *info) {if (list_empty (&info->send_list)) {kref_get (&info->refcount);
@@ -349,17 +349,17 @@ static void send_list_add(struct bat_priv *bat_priv, struct vis_info *info)/* delete the info packet from the send list, if it was * linked in. */ -static void send_list_del (struct vis_info *info) +static void batadv_send_list_del (struct vis_info *info) {if (!list_empty (&info->send_list)) {list_del_init (&info->send_list); -kref_put (&info->refcount, free_info); +kref_put (&info->refcount, batadv_free_info); } }/* tries to add one entry to the receive list. */ -static void recv_list_add (struct bat_priv *bat_priv, -struct list_head *recv_list,const char *mac) +static void batadv_recv_list_add (struct bat_priv *bat_priv, +struct list_head *recv_list,const char *mac) {struct recvlist_node *entry;
@@ -374,8 +374,9 @@ static void recv_list_add(struct bat_priv *bat_priv, }/* returns 1 if this mac is in the recv_list */ -static int recv_list_is_in (struct bat_priv *bat_priv, -const struct list_head *recv_list,const char *mac) +static int batadv_recv_list_is_in (struct bat_priv *bat_priv, +const struct list_head *recv_list, +const char *mac) {const struct recvlist_node *entry;
@@ -394,10 +395,10 @@ static int recv_list_is_in(struct bat_priv *bat_priv,* broken.. ). vis hash must be locked outside. is_new is set when the packet * is newer than old entries in the hash. */ -static struct vis_info *add_packet (struct bat_priv *bat_priv, -struct vis_packet *vis_packet, -int vis_info_len,int *is_new, -int make_broadcast) +static struct vis_info *batadv_add_packet (struct bat_priv *bat_priv, +struct vis_packet *vis_packet, +int vis_info_len,int *is_new, +int make_broadcast) {struct vis_info *info, *old_info;struct vis_packet *search_packet, *old_packet;
@@ -418,7 +419,7 @@ static struct vis_info *add_packet(struct bat_priv *bat_priv, sizeof(*search_packet));memcpy (search_packet->vis_orig, vis_packet->vis_orig,ETH_ALEN ); - old_info =vis_hash_find (bat_priv, &search_elem); + old_info =batadv_vis_hash_find (bat_priv, &search_elem);kfree_skb (search_elem.skb_packet);if (old_info) {
@@ -426,8 +427,9 @@ static struct vis_info *add_packet(struct bat_priv *bat_priv,if (!seq_after (ntohl (vis_packet->seqno),ntohl (old_packet->seqno))) {if (old_packet->seqno == vis_packet->seqno) { -recv_list_add (bat_priv, &old_info->recv_list, - vis_packet->sender_orig); +batadv_recv_list_add (bat_priv, + &old_info->recv_list, + vis_packet->sender_orig);return old_info; }else {/* newer packet is already in hash. */
@@ -435,10 +437,10 @@ static struct vis_info *add_packet(struct bat_priv *bat_priv, } }/* remove old entry */ -batadv_hash_remove (bat_priv->vis_hash, vis_info_cmp, - vis_info_choose, old_info); -send_list_del (old_info); -kref_put (&old_info->refcount, free_info); +batadv_hash_remove (bat_priv->vis_hash, batadv_vis_info_cmp, + batadv_vis_info_choose, old_info); +batadv_send_list_del (old_info); +kref_put (&old_info->refcount, batadv_free_info); } info =kmalloc (sizeof (*info),GFP_ATOMIC );
@@ -473,14 +475,15 @@ static struct vis_info *add_packet(struct bat_priv *bat_priv,if (packet->entries *sizeof (struct vis_info_entry ) > vis_info_len) packet->entries = vis_info_len /sizeof (struct vis_info_entry ); -recv_list_add (bat_priv, &info->recv_list, packet->sender_orig); +batadv_recv_list_add (bat_priv, &info->recv_list, packet->sender_orig);/* try to add it */ - hash_added =batadv_hash_add (bat_priv->vis_hash, vis_info_cmp, - vis_info_choose, info, &info->hash_entry); + hash_added =batadv_hash_add (bat_priv->vis_hash, batadv_vis_info_cmp, + batadv_vis_info_choose, info, + &info->hash_entry);if (hash_added !=0 ) {/* did not work (for some reason) */ -kref_put (&info->refcount, free_info); +kref_put (&info->refcount, batadv_free_info); info =NULL ; }
@@ -499,8 +502,8 @@ void batadv_receive_server_sync_packet(struct bat_priv *bat_priv, make_broadcast = (vis_server ==VIS_TYPE_SERVER_SYNC );spin_lock_bh (&bat_priv->vis_hash_lock); - info =add_packet (bat_priv, vis_packet, vis_info_len, - &is_new, make_broadcast); + info =batadv_add_packet (bat_priv, vis_packet, vis_info_len, + &is_new, make_broadcast);if (!info) goto end;
@@ -508,7 +511,7 @@ void batadv_receive_server_sync_packet(struct bat_priv *bat_priv,* hash. */ if (vis_server ==VIS_TYPE_SERVER_SYNC && is_new) -send_list_add (bat_priv, info); +batadv_send_list_add (bat_priv, info); end:spin_unlock_bh (&bat_priv->vis_hash_lock); }
@@ -534,8 +537,8 @@ void batadv_receive_client_update_packet(struct bat_priv *bat_priv, are_target =1 ;spin_lock_bh (&bat_priv->vis_hash_lock); - info =add_packet (bat_priv, vis_packet, vis_info_len, - &is_new, are_target); + info =batadv_add_packet (bat_priv, vis_packet, vis_info_len, + &is_new, are_target);if (!info) goto end;
@@ -546,11 +549,11 @@ void batadv_receive_client_update_packet(struct bat_priv *bat_priv,/* send only if we're the target server or ... */ if (are_target && is_new) { packet->vis_type =VIS_TYPE_SERVER_SYNC ;/* upgrade! */ -send_list_add (bat_priv, info); +batadv_send_list_add (bat_priv, info);/* ... we're not the recipient (and thus need to forward). */ }else if (!batadv_is_my_mac (packet->target_orig)) { -send_list_add (bat_priv, info); +batadv_send_list_add (bat_priv, info); } end:
@@ -562,8 +565,8 @@ end:* * Must be called with the originator hash locked */ -static int find_best_vis_server (struct bat_priv *bat_priv, -struct vis_info *info) +static int batadv_find_best_vis_server (struct bat_priv *bat_priv, +struct vis_info *info) {struct hashtable_t *hash = bat_priv->orig_hash;struct neigh_node *router;
@@ -600,7 +603,7 @@ static int find_best_vis_server(struct bat_priv *bat_priv, }/* Return true if the vis packet is full. */ -static bool vis_packet_full (const struct vis_info *info) +static bool batadv_vis_packet_full (const struct vis_info *info) {const struct vis_packet *packet; packet = (struct vis_packet *)info->skb_packet->data;
@@ -614,7 +617,7 @@ static bool vis_packet_full(const struct vis_info *info)/* generates a packet of own vis data, * returns 0 on success, -1 if no packet could be generated */ -static int generate_vis_packet (struct bat_priv *bat_priv) +static int batadv_generate_vis_packet (struct bat_priv *bat_priv) {struct hashtable_t *hash = bat_priv->orig_hash;struct hlist_node *node;
@@ -638,7 +641,7 @@ static int generate_vis_packet(struct bat_priv *bat_priv)skb_trim (info->skb_packet,sizeof (*packet));if (packet->vis_type ==VIS_TYPE_CLIENT_UPDATE ) { - best_tq =find_best_vis_server (bat_priv, info); + best_tq =batadv_find_best_vis_server (bat_priv, info);if (best_tq <0 )return best_tq;
@@ -675,7 +678,7 @@ static int generate_vis_packet(struct bat_priv *bat_priv) next:batadv_neigh_node_free_ref (router); -if (vis_packet_full (info)) +if (batadv_vis_packet_full (info)) goto unlock; }rcu_read_unlock ();
@@ -697,7 +700,7 @@ next: entry->quality =0 ;/* 0 means TT */ packet->entries++; -if (vis_packet_full (info)) +if (batadv_vis_packet_full (info)) goto unlock; }rcu_read_unlock ();
@@ -713,7 +716,7 @@ unlock:/* free old vis packets. Must be called with this vis_hash_lock * held */ -static void purge_vis_packets (struct bat_priv *bat_priv) +static void batadv_purge_vis_packets (struct bat_priv *bat_priv) {uint32_t i;struct hashtable_t *hash = bat_priv->vis_hash;
@@ -733,15 +736,15 @@ static void purge_vis_packets(struct bat_priv *bat_priv)if (batadv_has_timed_out (info->first_seen,VIS_TIMEOUT )) {hlist_del (node); -send_list_del (info); -kref_put (&info->refcount, free_info); +batadv_send_list_del (info); +kref_put (&info->refcount, batadv_free_info); } } } } -static void broadcast_vis_packet (struct bat_priv *bat_priv, -struct vis_info *info) +static void batadv_broadcast_vis_packet (struct bat_priv *bat_priv, +struct vis_info *info) {struct neigh_node *router;struct hashtable_t *hash = bat_priv->orig_hash;
@@ -774,8 +777,8 @@ static void broadcast_vis_packet(struct bat_priv *bat_priv,/* don't send it if we already received the packet from * this node. */ -if (recv_list_is_in (bat_priv, &info->recv_list, - orig_node->orig)) { +if (batadv_recv_list_is_in (bat_priv, &info->recv_list, + orig_node->orig)) {batadv_neigh_node_free_ref (router);continue ; }
@@ -796,8 +799,8 @@ static void broadcast_vis_packet(struct bat_priv *bat_priv, } } -static void unicast_vis_packet (struct bat_priv *bat_priv, -struct vis_info *info) +static void batadv_unicast_vis_packet (struct bat_priv *bat_priv, +struct vis_info *info) {struct orig_node *orig_node;struct neigh_node *router =NULL ;
@@ -825,8 +828,9 @@ out:batadv_orig_node_free_ref (orig_node); } -/* only send one vis packet. called from send_vis_packets() */ -static void send_vis_packet (struct bat_priv *bat_priv,struct vis_info *info) +/* only send one vis packet. called from batadv_send_vis_packets() */ +static void batadv_send_vis_packet (struct bat_priv *bat_priv, +struct vis_info *info) {struct hard_iface *primary_if;struct vis_packet *packet;
@@ -845,9 +849,9 @@ static void send_vis_packet(struct bat_priv *bat_priv, struct vis_info *info) packet->header.ttl--;if (is_broadcast_ether_addr (packet->target_orig)) -broadcast_vis_packet (bat_priv, info); +batadv_broadcast_vis_packet (bat_priv, info);else -unicast_vis_packet (bat_priv, info); +batadv_unicast_vis_packet (bat_priv, info); packet->header.ttl++;/* restore TTL */ out:
@@ -856,7 +860,7 @@ out: }/* called from timer; send (and maybe generate) vis packet. */ -static void send_vis_packets (struct work_struct *work) +static void batadv_send_vis_packets (struct work_struct *work) {struct delayed_work *delayed_work = container_of(work, struct delayed_work, work);
@@ -865,11 +869,11 @@ static void send_vis_packets(struct work_struct *work)struct vis_info *info;spin_lock_bh (&bat_priv->vis_hash_lock); -purge_vis_packets (bat_priv); +batadv_purge_vis_packets (bat_priv); -if (generate_vis_packet (bat_priv) ==0 ) { +if (batadv_generate_vis_packet (bat_priv) ==0 ) {/* schedule if generation was successful */ -send_list_add (bat_priv, bat_priv->my_vis_info); +batadv_send_list_add (bat_priv, bat_priv->my_vis_info); }while (!list_empty (&bat_priv->vis_send_list)) {
@@ -879,14 +883,14 @@ static void send_vis_packets(struct work_struct *work)kref_get (&info->refcount);spin_unlock_bh (&bat_priv->vis_hash_lock); -send_vis_packet (bat_priv, info); +batadv_send_vis_packet (bat_priv, info);spin_lock_bh (&bat_priv->vis_hash_lock); -send_list_del (info); -kref_put (&info->refcount, free_info); +batadv_send_list_del (info); +kref_put (&info->refcount, batadv_free_info); }spin_unlock_bh (&bat_priv->vis_hash_lock); -start_vis_timer (bat_priv); +batadv_start_vis_timer (bat_priv); }/* init the vis server. this may only be called when if_list is already
@@ -937,18 +941,19 @@ int batadv_vis_init(struct bat_priv *bat_priv)INIT_LIST_HEAD (&bat_priv->vis_send_list); - hash_added =batadv_hash_add (bat_priv->vis_hash, vis_info_cmp, - vis_info_choose, bat_priv->my_vis_info, + hash_added =batadv_hash_add (bat_priv->vis_hash, batadv_vis_info_cmp, + batadv_vis_info_choose, + bat_priv->my_vis_info, &bat_priv->my_vis_info->hash_entry);if (hash_added !=0 ) {pr_err ("Can't add own vis packet into hash\n" );/* not in hash, need to remove it manually. */ -kref_put (&bat_priv->my_vis_info->refcount, free_info); +kref_put (&bat_priv->my_vis_info->refcount, batadv_free_info); goto err; }spin_unlock_bh (&bat_priv->vis_hash_lock); -start_vis_timer (bat_priv); +batadv_start_vis_timer (bat_priv);return 0 ; free_info:
@@ -961,13 +966,13 @@ err: }/* Decrease the reference count on a hash item info */ -static void free_info_ref (struct hlist_node *node,void *arg) +static void batadv_free_info_ref (struct hlist_node *node,void *arg) {struct vis_info *info; info = container_of(node, struct vis_info, hash_entry); -send_list_del (info); -kref_put (&info->refcount, free_info); +batadv_send_list_del (info); +kref_put (&info->refcount, batadv_free_info); }/* shutdown vis-server */
@@ -980,16 +985,16 @@ void batadv_vis_quit(struct bat_priv *bat_priv)spin_lock_bh (&bat_priv->vis_hash_lock);/* properly remove, kill timers ... */ -batadv_hash_delete (bat_priv->vis_hash, free_info_ref,NULL ); +batadv_hash_delete (bat_priv->vis_hash, batadv_free_info_ref,NULL ); bat_priv->vis_hash =NULL ; bat_priv->my_vis_info =NULL ;spin_unlock_bh (&bat_priv->vis_hash_lock); }/* schedule packets for (re)transmission */ -static void start_vis_timer (struct bat_priv *bat_priv) +static void batadv_start_vis_timer (struct bat_priv *bat_priv) { -INIT_DELAYED_WORK (&bat_priv->vis_work, send_vis_packets); +INIT_DELAYED_WORK (&bat_priv->vis_work, batadv_send_vis_packets);queue_delayed_work (batadv_event_workqueue, &bat_priv->vis_work,msecs_to_jiffies (VIS_INTERVAL )); }
Signature · 1 line
1.7.10
PATCH 18/18 batman-adv: Prefix main local static functions with batadv_
In reply to Sven EckelmannAll non-static symbols of batman-adv were prefixed with batadv_ to avoid collisions with other symbols of the kernel. Other symbols of batman-adv should use the same prefix to keep the naming scheme consistent.
--- main.c | 78 +++++++++++++++++++++++++++++++++------------------------------- 1 file changed, 40 insertions(+), 38 deletions(-)
main.c +40 -38
@@ -38,22 +38,23 @@* list traversals just rcu-locked */ struct list_head batadv_hardif_list; -static int (*recv_packet_handler[256 ])(struct sk_buff *,struct hard_iface *); +static int (*batadv_rx_handler[256 ])(struct sk_buff *, +struct hard_iface *);char batadv_routing_algo[20 ] ="BATMAN_IV" ; -static struct hlist_head bat_algo_list; +static struct hlist_head batadv_algo_list;unsigned char batadv_broadcast_addr[] = {0xff ,0xff ,0xff ,0xff ,0xff ,0xff };struct workqueue_struct *batadv_event_workqueue; -static void recv_handler_init (void ); +static void batadv_recv_handler_init (void ); -static int __init batman_init (void ) +static int __init batadv_init (void ) {INIT_LIST_HEAD (&batadv_hardif_list); -INIT_HLIST_HEAD (&bat_algo_list); +INIT_HLIST_HEAD (&batadv_algo_list); -recv_handler_init (); +batadv_recv_handler_init ();batadv_iv_init ();
@@ -76,7 +77,7 @@ static int __init batman_init(void)return 0 ; } -static void __exit batman_exit(void) +static void __exit batadv_exit(void) {batadv_debugfs_destroy ();unregister_netdevice_notifier (&batadv_hard_if_notifier);
@@ -189,8 +190,8 @@ int batadv_is_my_mac(const uint8_t *addr)return 0 ; } -static int recv_unhandled_packet (struct sk_buff *skb, -struct hard_iface *recv_if) +static int batadv_recv_unhandled_packet (struct sk_buff *skb, +struct hard_iface *recv_if) {return NET_RX_DROP ; }
@@ -248,7 +249,7 @@ int batadv_batman_skb_recv(struct sk_buff *skb, struct net_device *dev,* the supplied skb. if not, we have to free the skb. */ idx = batman_ogm_packet->header.packet_type; - ret = (*recv_packet_handler[idx])(skb, hard_iface); + ret = (*batadv_rx_handler[idx])(skb, hard_iface);if (ret ==NET_RX_DROP )kfree_skb (skb);
@@ -265,53 +266,53 @@ err_out:return NET_RX_DROP ; } -static void recv_handler_init (void ) +static void batadv_recv_handler_init (void ) {int i; -for (i =0 ; i <ARRAY_SIZE (recv_packet_handler); i++) - recv_packet_handler[i] = recv_unhandled_packet; +for (i =0 ; i <ARRAY_SIZE (batadv_rx_handler); i++) + batadv_rx_handler[i] = batadv_recv_unhandled_packet;/* batman icmp packet */ - recv_packet_handler[BAT_ICMP ] = batadv_recv_icmp_packet; + batadv_rx_handler[BAT_ICMP ] = batadv_recv_icmp_packet;/* unicast with 4 addresses packet */ - recv_packet_handler[BAT_UNICAST_4ADDR ] = batadv_recv_unicast_packet; + batadv_rx_handler[BAT_UNICAST_4ADDR ] = batadv_recv_unicast_packet;/* unicast packet */ - recv_packet_handler[BAT_UNICAST ] = batadv_recv_unicast_packet; + batadv_rx_handler[BAT_UNICAST ] = batadv_recv_unicast_packet;/* fragmented unicast packet */ - recv_packet_handler[BAT_UNICAST_FRAG ] = batadv_recv_ucast_frag_packet; + batadv_rx_handler[BAT_UNICAST_FRAG ] = batadv_recv_ucast_frag_packet;/* broadcast packet */ - recv_packet_handler[BAT_BCAST ] = batadv_recv_bcast_packet; + batadv_rx_handler[BAT_BCAST ] = batadv_recv_bcast_packet;/* vis packet */ - recv_packet_handler[BAT_VIS ] = batadv_recv_vis_packet; + batadv_rx_handler[BAT_VIS ] = batadv_recv_vis_packet;/* Translation table query (request or response) */ - recv_packet_handler[BAT_TT_QUERY ] = batadv_recv_tt_query; + batadv_rx_handler[BAT_TT_QUERY ] = batadv_recv_tt_query;/* Roaming advertisement */ - recv_packet_handler[BAT_ROAM_ADV ] = batadv_recv_roam_adv; + batadv_rx_handler[BAT_ROAM_ADV ] = batadv_recv_roam_adv; }int batadv_recv_handler_register (uint8_t packet_type,int (*recv_handler)(struct sk_buff *,struct hard_iface *)) { -if (recv_packet_handler[packet_type] != &recv_unhandled_packet) +if (batadv_rx_handler[packet_type] != &batadv_recv_unhandled_packet)return -EBUSY ; - recv_packet_handler[packet_type] = recv_handler; + batadv_rx_handler[packet_type] = recv_handler;return 0 ; }void batadv_recv_handler_unregister (uint8_t packet_type) { - recv_packet_handler[packet_type] = recv_unhandled_packet; + batadv_rx_handler[packet_type] = batadv_recv_unhandled_packet; } -static struct bat_algo_ops *bat_algo_get (char *name) +static struct bat_algo_ops *batadv_algo_get (char *name) {struct bat_algo_ops *bat_algo_ops =NULL , *bat_algo_ops_tmp;struct hlist_node *node; -hlist_for_each_entry (bat_algo_ops_tmp, node, &bat_algo_list, list) { +hlist_for_each_entry (bat_algo_ops_tmp, node, &batadv_algo_list, list) {if (strcmp (bat_algo_ops_tmp->name, name) !=0 )continue ;
@@ -327,7 +328,7 @@ int batadv_algo_register(struct bat_algo_ops *bat_algo_ops)struct bat_algo_ops *bat_algo_ops_tmp;int ret; - bat_algo_ops_tmp =bat_algo_get (bat_algo_ops->name); + bat_algo_ops_tmp =batadv_algo_get (bat_algo_ops->name);if (bat_algo_ops_tmp) {pr_info ("Trying to register already registered routing algorithm: %s\n" , bat_algo_ops->name);
@@ -349,7 +350,7 @@ int batadv_algo_register(struct bat_algo_ops *bat_algo_ops) }INIT_HLIST_NODE (&bat_algo_ops->list); -hlist_add_head (&bat_algo_ops->list, &bat_algo_list); +hlist_add_head (&bat_algo_ops->list, &batadv_algo_list); ret =0 ; out:
@@ -361,7 +362,7 @@ int batadv_algo_select(struct bat_priv *bat_priv, char *name)struct bat_algo_ops *bat_algo_ops;int ret = -EINVAL ; - bat_algo_ops =bat_algo_get (name); + bat_algo_ops =batadv_algo_get (name);if (!bat_algo_ops) goto out;
@@ -379,14 +380,14 @@ int batadv_algo_seq_print_text(struct seq_file *seq, void *offset)seq_printf (seq,"Available routing algorithms:\n" ); -hlist_for_each_entry (bat_algo_ops, node, &bat_algo_list, list) { +hlist_for_each_entry (bat_algo_ops, node, &batadv_algo_list, list) {seq_printf (seq,"%s\n" , bat_algo_ops->name); }return 0 ; } -static int param_set_ra (const char *val,const struct kernel_param *kp) +static int batadv_param_set_ra (const char *val,const struct kernel_param *kp) {struct bat_algo_ops *bat_algo_ops;char *algo_name = (char *)val;
@@ -395,7 +396,7 @@ static int param_set_ra(const char *val, const struct kernel_param *kp)if (algo_name[name_len -1 ] =='\n' ) algo_name[name_len -1 ] ='\0' ; - bat_algo_ops =bat_algo_get (algo_name); + bat_algo_ops =batadv_algo_get (algo_name);if (!bat_algo_ops) {pr_err ("Routing algorithm '%s' is not supported\n" , algo_name);return -EINVAL ;
@@ -404,19 +405,20 @@ static int param_set_ra(const char *val, const struct kernel_param *kp)return param_set_copystring (algo_name, kp); } -static const struct kernel_param_ops param_ops_ra = { - .set = param_set_ra, +static const struct kernel_param_ops batadv_param_ops_ra = { + .set = batadv_param_set_ra, .get = param_get_string, }; -static struct kparam_string __param_string_ra = { +static struct kparam_string batadv_param_string_ra = { .maxlen =sizeof (batadv_routing_algo), .string = batadv_routing_algo, }; -module_param_cb (routing_algo, ¶m_ops_ra, &__param_string_ra,0644 ); -module_init (batman_init); -module_exit (batman_exit); +module_param_cb (routing_algo, &batadv_param_ops_ra, &batadv_param_string_ra, +0644 ); +module_init (batadv_init); +module_exit (batadv_exit);MODULE_LICENSE ("GPL" );
Signature · 1 line
1.7.10
Marek Lindner
AppliedQuoted 9 lines · On Sunday, May 13, 2012 00:33:50 Sven Eckelmann wrote:
All non-static symbols of batman-adv were prefixed with
batadv_to avoid collisions with other symbols of the kernel. Other symbols of batman-adv should use the same prefix to keep the naming scheme consistent.Signed-off-by Sven Eckelmann <[email protected]>--- bat_debugfs.c | 143+++++++++++++++++++++++++++++---------------------------- 1 file changed, 72 insertions(+), 71 deletions(-)
Applied in revision 41214dc.
Thanks,
Marek