Commit 1409a834 authored by Sven Eckelmann's avatar Sven Eckelmann Committed by Antonio Quartulli

batman-adv: Prefix gateway_client 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.
Signed-off-by: default avatarSven Eckelmann <sven@narfation.org>
parent 3b300de3
...@@ -36,13 +36,13 @@ ...@@ -36,13 +36,13 @@
#define DHCP_OPTIONS_OFFSET 240 #define DHCP_OPTIONS_OFFSET 240
#define DHCP_REQUEST 3 #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)) if (atomic_dec_and_test(&gw_node->refcount))
kfree_rcu(gw_node, rcu); 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; struct gw_node *gw_node;
...@@ -64,7 +64,7 @@ struct orig_node *batadv_gw_get_selected_orig(struct bat_priv *bat_priv) ...@@ -64,7 +64,7 @@ struct orig_node *batadv_gw_get_selected_orig(struct bat_priv *bat_priv)
struct gw_node *gw_node; struct gw_node *gw_node;
struct orig_node *orig_node = NULL; 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) if (!gw_node)
goto out; goto out;
...@@ -80,11 +80,12 @@ struct orig_node *batadv_gw_get_selected_orig(struct bat_priv *bat_priv) ...@@ -80,11 +80,12 @@ struct orig_node *batadv_gw_get_selected_orig(struct bat_priv *bat_priv)
rcu_read_unlock(); rcu_read_unlock();
out: out:
if (gw_node) if (gw_node)
gw_node_free_ref(gw_node); batadv_gw_node_free_ref(gw_node);
return orig_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; 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) ...@@ -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); rcu_assign_pointer(bat_priv->curr_gw, new_gw_node);
if (curr_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); spin_unlock_bh(&bat_priv->gw_list_lock);
} }
...@@ -107,7 +108,7 @@ void batadv_gw_deselect(struct bat_priv *bat_priv) ...@@ -107,7 +108,7 @@ void batadv_gw_deselect(struct bat_priv *bat_priv)
atomic_set(&bat_priv->gw_reselect, 1); 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 neigh_node *router;
struct hlist_node *node; struct hlist_node *node;
...@@ -144,7 +145,7 @@ static struct gw_node *gw_get_best_gw_node(struct bat_priv *bat_priv) ...@@ -144,7 +145,7 @@ static struct gw_node *gw_get_best_gw_node(struct bat_priv *bat_priv)
((tmp_gw_factor == max_gw_factor) && ((tmp_gw_factor == max_gw_factor) &&
(router->tq_avg > max_tq))) { (router->tq_avg > max_tq))) {
if (curr_gw) if (curr_gw)
gw_node_free_ref(curr_gw); batadv_gw_node_free_ref(curr_gw);
curr_gw = gw_node; curr_gw = gw_node;
atomic_inc(&curr_gw->refcount); atomic_inc(&curr_gw->refcount);
} }
...@@ -159,7 +160,7 @@ static struct gw_node *gw_get_best_gw_node(struct bat_priv *bat_priv) ...@@ -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 (router->tq_avg > max_tq) {
if (curr_gw) if (curr_gw)
gw_node_free_ref(curr_gw); batadv_gw_node_free_ref(curr_gw);
curr_gw = gw_node; curr_gw = gw_node;
atomic_inc(&curr_gw->refcount); atomic_inc(&curr_gw->refcount);
} }
...@@ -172,7 +173,7 @@ static struct gw_node *gw_get_best_gw_node(struct bat_priv *bat_priv) ...@@ -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) if (tmp_gw_factor > max_gw_factor)
max_gw_factor = tmp_gw_factor; max_gw_factor = tmp_gw_factor;
gw_node_free_ref(gw_node); batadv_gw_node_free_ref(gw_node);
next: next:
batadv_neigh_node_free_ref(router); batadv_neigh_node_free_ref(router);
...@@ -199,9 +200,9 @@ void batadv_gw_election(struct bat_priv *bat_priv) ...@@ -199,9 +200,9 @@ void batadv_gw_election(struct bat_priv *bat_priv)
if (!atomic_dec_not_zero(&bat_priv->gw_reselect)) if (!atomic_dec_not_zero(&bat_priv->gw_reselect))
goto out; 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) if (curr_gw == next_gw)
goto out; goto out;
...@@ -234,13 +235,13 @@ void batadv_gw_election(struct bat_priv *bat_priv) ...@@ -234,13 +235,13 @@ void batadv_gw_election(struct bat_priv *bat_priv)
batadv_throw_uevent(bat_priv, UEV_GW, UEV_CHANGE, gw_addr); 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: out:
if (curr_gw) if (curr_gw)
gw_node_free_ref(curr_gw); batadv_gw_node_free_ref(curr_gw);
if (next_gw) if (next_gw)
gw_node_free_ref(next_gw); batadv_gw_node_free_ref(next_gw);
if (router) if (router)
batadv_neigh_node_free_ref(router); batadv_neigh_node_free_ref(router);
} }
...@@ -299,8 +300,9 @@ void batadv_gw_check_election(struct bat_priv *bat_priv, ...@@ -299,8 +300,9 @@ void batadv_gw_check_election(struct bat_priv *bat_priv,
return; return;
} }
static void gw_node_add(struct bat_priv *bat_priv, static void batadv_gw_node_add(struct bat_priv *bat_priv,
struct orig_node *orig_node, uint8_t new_gwflags) struct orig_node *orig_node,
uint8_t new_gwflags)
{ {
struct gw_node *gw_node; struct gw_node *gw_node;
int down, up; int down, up;
...@@ -338,7 +340,7 @@ void batadv_gw_node_update(struct bat_priv *bat_priv, ...@@ -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 this gateway in our list (duplication check!) even though we
* have no currently selected gateway. * 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(); rcu_read_lock();
hlist_for_each_entry_rcu(gw_node, node, &bat_priv->gw_list, list) { 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, ...@@ -368,7 +370,7 @@ void batadv_gw_node_update(struct bat_priv *bat_priv,
if (new_gwflags == NO_FLAGS) if (new_gwflags == NO_FLAGS)
goto unlock; goto unlock;
gw_node_add(bat_priv, orig_node, new_gwflags); batadv_gw_node_add(bat_priv, orig_node, new_gwflags);
goto unlock; goto unlock;
deselect: deselect:
...@@ -377,7 +379,7 @@ void batadv_gw_node_update(struct bat_priv *bat_priv, ...@@ -377,7 +379,7 @@ void batadv_gw_node_update(struct bat_priv *bat_priv,
rcu_read_unlock(); rcu_read_unlock();
if (curr_gw) 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, void batadv_gw_node_delete(struct bat_priv *bat_priv,
...@@ -393,7 +395,7 @@ void batadv_gw_node_purge(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); unsigned long timeout = msecs_to_jiffies(2 * PURGE_TIMEOUT);
int do_deselect = 0; 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); spin_lock_bh(&bat_priv->gw_list_lock);
...@@ -408,7 +410,7 @@ void batadv_gw_node_purge(struct bat_priv *bat_priv) ...@@ -408,7 +410,7 @@ void batadv_gw_node_purge(struct bat_priv *bat_priv)
do_deselect = 1; do_deselect = 1;
hlist_del_rcu(&gw_node->list); 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); spin_unlock_bh(&bat_priv->gw_list_lock);
...@@ -418,12 +420,13 @@ void batadv_gw_node_purge(struct bat_priv *bat_priv) ...@@ -418,12 +420,13 @@ void batadv_gw_node_purge(struct bat_priv *bat_priv)
batadv_gw_deselect(bat_priv); batadv_gw_deselect(bat_priv);
if (curr_gw) if (curr_gw)
gw_node_free_ref(curr_gw); batadv_gw_node_free_ref(curr_gw);
} }
/* fails if orig_node has no router */ /* fails if orig_node has no router */
static int _write_buffer_text(struct bat_priv *bat_priv, struct seq_file *seq, static int batadv_write_buffer_text(struct bat_priv *bat_priv,
const struct gw_node *gw_node) struct seq_file *seq,
const struct gw_node *gw_node)
{ {
struct gw_node *curr_gw; struct gw_node *curr_gw;
struct neigh_node *router; struct neigh_node *router;
...@@ -435,7 +438,7 @@ static int _write_buffer_text(struct bat_priv *bat_priv, struct seq_file *seq, ...@@ -435,7 +438,7 @@ static int _write_buffer_text(struct bat_priv *bat_priv, struct seq_file *seq,
if (!router) if (!router)
goto out; 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", ret = seq_printf(seq, "%s %pM (%3i) %pM [%10s]: %3i - %i%s/%i%s\n",
(curr_gw == gw_node ? "=>" : " "), (curr_gw == gw_node ? "=>" : " "),
...@@ -450,7 +453,7 @@ static int _write_buffer_text(struct bat_priv *bat_priv, struct seq_file *seq, ...@@ -450,7 +453,7 @@ static int _write_buffer_text(struct bat_priv *bat_priv, struct seq_file *seq,
batadv_neigh_node_free_ref(router); batadv_neigh_node_free_ref(router);
if (curr_gw) if (curr_gw)
gw_node_free_ref(curr_gw); batadv_gw_node_free_ref(curr_gw);
out: out:
return ret; return ret;
} }
...@@ -491,7 +494,7 @@ int batadv_gw_client_seq_print_text(struct seq_file *seq, void *offset) ...@@ -491,7 +494,7 @@ int batadv_gw_client_seq_print_text(struct seq_file *seq, void *offset)
continue; continue;
/* fails if orig_node has no router */ /* 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; continue;
gw_count++; gw_count++;
...@@ -507,7 +510,7 @@ int batadv_gw_client_seq_print_text(struct seq_file *seq, void *offset) ...@@ -507,7 +510,7 @@ int batadv_gw_client_seq_print_text(struct seq_file *seq, void *offset)
return ret; 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; int ret = false;
unsigned char *p; unsigned char *p;
...@@ -655,7 +658,7 @@ bool batadv_gw_out_of_range(struct bat_priv *bat_priv, ...@@ -655,7 +658,7 @@ bool batadv_gw_out_of_range(struct bat_priv *bat_priv,
if (!orig_dst_node->gw_flags) if (!orig_dst_node->gw_flags)
goto out; goto out;
ret = is_type_dhcprequest(skb, header_len); ret = batadv_is_type_dhcprequest(skb, header_len);
if (!ret) if (!ret)
goto out; goto out;
...@@ -667,7 +670,7 @@ bool batadv_gw_out_of_range(struct bat_priv *bat_priv, ...@@ -667,7 +670,7 @@ bool batadv_gw_out_of_range(struct bat_priv *bat_priv,
curr_tq_avg = TQ_MAX_VALUE; curr_tq_avg = TQ_MAX_VALUE;
break; break;
case GW_MODE_CLIENT: 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) if (!curr_gw)
goto out; goto out;
...@@ -702,7 +705,7 @@ bool batadv_gw_out_of_range(struct bat_priv *bat_priv, ...@@ -702,7 +705,7 @@ bool batadv_gw_out_of_range(struct bat_priv *bat_priv,
if (orig_dst_node) if (orig_dst_node)
batadv_orig_node_free_ref(orig_dst_node); batadv_orig_node_free_ref(orig_dst_node);
if (curr_gw) if (curr_gw)
gw_node_free_ref(curr_gw); batadv_gw_node_free_ref(curr_gw);
if (neigh_old) if (neigh_old)
batadv_neigh_node_free_ref(neigh_old); batadv_neigh_node_free_ref(neigh_old);
if (neigh_curr) if (neigh_curr)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment