diff options
author | Sven Eckelmann <sven@narfation.org> | 2012-06-05 16:31:31 -0400 |
---|---|---|
committer | Antonio Quartulli <ordex@autistici.org> | 2012-07-01 16:47:21 -0400 |
commit | 56303d34a332be8e2f4daf7891ebc12cb7900529 (patch) | |
tree | bc972916771e698bd8a88fd66917950ce0bd48c1 /net/batman-adv/gateway_client.c | |
parent | 96412690116afcc1b2705615b5a7c8dc6c5e905f (diff) |
batman-adv: Prefix types structs with batadv_
Reported-by: Martin Hundebøll <martin@hundeboll.net>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Diffstat (limited to 'net/batman-adv/gateway_client.c')
-rw-r--r-- | net/batman-adv/gateway_client.c | 90 |
1 files changed, 47 insertions, 43 deletions
diff --git a/net/batman-adv/gateway_client.c b/net/batman-adv/gateway_client.c index 00273b92d76f..43b9c1763fff 100644 --- a/net/batman-adv/gateway_client.c +++ b/net/batman-adv/gateway_client.c | |||
@@ -36,15 +36,16 @@ | |||
36 | #define BATADV_DHCP_OPTIONS_OFFSET 240 | 36 | #define BATADV_DHCP_OPTIONS_OFFSET 240 |
37 | #define BATADV_DHCP_REQUEST 3 | 37 | #define BATADV_DHCP_REQUEST 3 |
38 | 38 | ||
39 | static void batadv_gw_node_free_ref(struct gw_node *gw_node) | 39 | static void batadv_gw_node_free_ref(struct batadv_gw_node *gw_node) |
40 | { | 40 | { |
41 | if (atomic_dec_and_test(&gw_node->refcount)) | 41 | if (atomic_dec_and_test(&gw_node->refcount)) |
42 | kfree_rcu(gw_node, rcu); | 42 | kfree_rcu(gw_node, rcu); |
43 | } | 43 | } |
44 | 44 | ||
45 | static struct gw_node *batadv_gw_get_selected_gw_node(struct bat_priv *bat_priv) | 45 | static struct batadv_gw_node * |
46 | batadv_gw_get_selected_gw_node(struct batadv_priv *bat_priv) | ||
46 | { | 47 | { |
47 | struct gw_node *gw_node; | 48 | struct batadv_gw_node *gw_node; |
48 | 49 | ||
49 | rcu_read_lock(); | 50 | rcu_read_lock(); |
50 | gw_node = rcu_dereference(bat_priv->curr_gw); | 51 | gw_node = rcu_dereference(bat_priv->curr_gw); |
@@ -59,10 +60,11 @@ out: | |||
59 | return gw_node; | 60 | return gw_node; |
60 | } | 61 | } |
61 | 62 | ||
62 | struct orig_node *batadv_gw_get_selected_orig(struct bat_priv *bat_priv) | 63 | struct batadv_orig_node * |
64 | batadv_gw_get_selected_orig(struct batadv_priv *bat_priv) | ||
63 | { | 65 | { |
64 | struct gw_node *gw_node; | 66 | struct batadv_gw_node *gw_node; |
65 | struct orig_node *orig_node = NULL; | 67 | struct batadv_orig_node *orig_node = NULL; |
66 | 68 | ||
67 | gw_node = batadv_gw_get_selected_gw_node(bat_priv); | 69 | gw_node = batadv_gw_get_selected_gw_node(bat_priv); |
68 | if (!gw_node) | 70 | if (!gw_node) |
@@ -84,10 +86,10 @@ out: | |||
84 | return orig_node; | 86 | return orig_node; |
85 | } | 87 | } |
86 | 88 | ||
87 | static void batadv_gw_select(struct bat_priv *bat_priv, | 89 | static void batadv_gw_select(struct batadv_priv *bat_priv, |
88 | struct gw_node *new_gw_node) | 90 | struct batadv_gw_node *new_gw_node) |
89 | { | 91 | { |
90 | struct gw_node *curr_gw_node; | 92 | struct batadv_gw_node *curr_gw_node; |
91 | 93 | ||
92 | spin_lock_bh(&bat_priv->gw_list_lock); | 94 | spin_lock_bh(&bat_priv->gw_list_lock); |
93 | 95 | ||
@@ -103,20 +105,21 @@ static void batadv_gw_select(struct bat_priv *bat_priv, | |||
103 | spin_unlock_bh(&bat_priv->gw_list_lock); | 105 | spin_unlock_bh(&bat_priv->gw_list_lock); |
104 | } | 106 | } |
105 | 107 | ||
106 | void batadv_gw_deselect(struct bat_priv *bat_priv) | 108 | void batadv_gw_deselect(struct batadv_priv *bat_priv) |
107 | { | 109 | { |
108 | atomic_set(&bat_priv->gw_reselect, 1); | 110 | atomic_set(&bat_priv->gw_reselect, 1); |
109 | } | 111 | } |
110 | 112 | ||
111 | static struct gw_node *batadv_gw_get_best_gw_node(struct bat_priv *bat_priv) | 113 | static struct batadv_gw_node * |
114 | batadv_gw_get_best_gw_node(struct batadv_priv *bat_priv) | ||
112 | { | 115 | { |
113 | struct neigh_node *router; | 116 | struct batadv_neigh_node *router; |
114 | struct hlist_node *node; | 117 | struct hlist_node *node; |
115 | struct gw_node *gw_node, *curr_gw = NULL; | 118 | struct batadv_gw_node *gw_node, *curr_gw = NULL; |
116 | uint32_t max_gw_factor = 0, tmp_gw_factor = 0; | 119 | uint32_t max_gw_factor = 0, tmp_gw_factor = 0; |
117 | uint8_t max_tq = 0; | 120 | uint8_t max_tq = 0; |
118 | int down, up; | 121 | int down, up; |
119 | struct orig_node *orig_node; | 122 | struct batadv_orig_node *orig_node; |
120 | 123 | ||
121 | rcu_read_lock(); | 124 | rcu_read_lock(); |
122 | hlist_for_each_entry_rcu(gw_node, node, &bat_priv->gw_list, list) { | 125 | hlist_for_each_entry_rcu(gw_node, node, &bat_priv->gw_list, list) { |
@@ -183,10 +186,10 @@ next: | |||
183 | return curr_gw; | 186 | return curr_gw; |
184 | } | 187 | } |
185 | 188 | ||
186 | void batadv_gw_election(struct bat_priv *bat_priv) | 189 | void batadv_gw_election(struct batadv_priv *bat_priv) |
187 | { | 190 | { |
188 | struct gw_node *curr_gw = NULL, *next_gw = NULL; | 191 | struct batadv_gw_node *curr_gw = NULL, *next_gw = NULL; |
189 | struct neigh_node *router = NULL; | 192 | struct batadv_neigh_node *router = NULL; |
190 | char gw_addr[18] = { '\0' }; | 193 | char gw_addr[18] = { '\0' }; |
191 | 194 | ||
192 | /* The batman daemon checks here if we already passed a full originator | 195 | /* The batman daemon checks here if we already passed a full originator |
@@ -249,11 +252,11 @@ out: | |||
249 | batadv_neigh_node_free_ref(router); | 252 | batadv_neigh_node_free_ref(router); |
250 | } | 253 | } |
251 | 254 | ||
252 | void batadv_gw_check_election(struct bat_priv *bat_priv, | 255 | void batadv_gw_check_election(struct batadv_priv *bat_priv, |
253 | struct orig_node *orig_node) | 256 | struct batadv_orig_node *orig_node) |
254 | { | 257 | { |
255 | struct orig_node *curr_gw_orig; | 258 | struct batadv_orig_node *curr_gw_orig; |
256 | struct neigh_node *router_gw = NULL, *router_orig = NULL; | 259 | struct batadv_neigh_node *router_gw = NULL, *router_orig = NULL; |
257 | uint8_t gw_tq_avg, orig_tq_avg; | 260 | uint8_t gw_tq_avg, orig_tq_avg; |
258 | 261 | ||
259 | curr_gw_orig = batadv_gw_get_selected_orig(bat_priv); | 262 | curr_gw_orig = batadv_gw_get_selected_orig(bat_priv); |
@@ -303,11 +306,11 @@ out: | |||
303 | return; | 306 | return; |
304 | } | 307 | } |
305 | 308 | ||
306 | static void batadv_gw_node_add(struct bat_priv *bat_priv, | 309 | static void batadv_gw_node_add(struct batadv_priv *bat_priv, |
307 | struct orig_node *orig_node, | 310 | struct batadv_orig_node *orig_node, |
308 | uint8_t new_gwflags) | 311 | uint8_t new_gwflags) |
309 | { | 312 | { |
310 | struct gw_node *gw_node; | 313 | struct batadv_gw_node *gw_node; |
311 | int down, up; | 314 | int down, up; |
312 | 315 | ||
313 | gw_node = kzalloc(sizeof(*gw_node), GFP_ATOMIC); | 316 | gw_node = kzalloc(sizeof(*gw_node), GFP_ATOMIC); |
@@ -332,11 +335,12 @@ static void batadv_gw_node_add(struct bat_priv *bat_priv, | |||
332 | (up > 2048 ? "MBit" : "KBit")); | 335 | (up > 2048 ? "MBit" : "KBit")); |
333 | } | 336 | } |
334 | 337 | ||
335 | void batadv_gw_node_update(struct bat_priv *bat_priv, | 338 | void batadv_gw_node_update(struct batadv_priv *bat_priv, |
336 | struct orig_node *orig_node, uint8_t new_gwflags) | 339 | struct batadv_orig_node *orig_node, |
340 | uint8_t new_gwflags) | ||
337 | { | 341 | { |
338 | struct hlist_node *node; | 342 | struct hlist_node *node; |
339 | struct gw_node *gw_node, *curr_gw; | 343 | struct batadv_gw_node *gw_node, *curr_gw; |
340 | 344 | ||
341 | /* Note: We don't need a NULL check here, since curr_gw never gets | 345 | /* Note: We don't need a NULL check here, since curr_gw never gets |
342 | * dereferenced. If curr_gw is NULL we also should not exit as we may | 346 | * dereferenced. If curr_gw is NULL we also should not exit as we may |
@@ -385,15 +389,15 @@ unlock: | |||
385 | batadv_gw_node_free_ref(curr_gw); | 389 | batadv_gw_node_free_ref(curr_gw); |
386 | } | 390 | } |
387 | 391 | ||
388 | void batadv_gw_node_delete(struct bat_priv *bat_priv, | 392 | void batadv_gw_node_delete(struct batadv_priv *bat_priv, |
389 | struct orig_node *orig_node) | 393 | struct batadv_orig_node *orig_node) |
390 | { | 394 | { |
391 | batadv_gw_node_update(bat_priv, orig_node, 0); | 395 | batadv_gw_node_update(bat_priv, orig_node, 0); |
392 | } | 396 | } |
393 | 397 | ||
394 | void batadv_gw_node_purge(struct bat_priv *bat_priv) | 398 | void batadv_gw_node_purge(struct batadv_priv *bat_priv) |
395 | { | 399 | { |
396 | struct gw_node *gw_node, *curr_gw; | 400 | struct batadv_gw_node *gw_node, *curr_gw; |
397 | struct hlist_node *node, *node_tmp; | 401 | struct hlist_node *node, *node_tmp; |
398 | unsigned long timeout = msecs_to_jiffies(2 * BATADV_PURGE_TIMEOUT); | 402 | unsigned long timeout = msecs_to_jiffies(2 * BATADV_PURGE_TIMEOUT); |
399 | int do_deselect = 0; | 403 | int do_deselect = 0; |
@@ -427,12 +431,12 @@ void batadv_gw_node_purge(struct bat_priv *bat_priv) | |||
427 | } | 431 | } |
428 | 432 | ||
429 | /* fails if orig_node has no router */ | 433 | /* fails if orig_node has no router */ |
430 | static int batadv_write_buffer_text(struct bat_priv *bat_priv, | 434 | static int batadv_write_buffer_text(struct batadv_priv *bat_priv, |
431 | struct seq_file *seq, | 435 | struct seq_file *seq, |
432 | const struct gw_node *gw_node) | 436 | const struct batadv_gw_node *gw_node) |
433 | { | 437 | { |
434 | struct gw_node *curr_gw; | 438 | struct batadv_gw_node *curr_gw; |
435 | struct neigh_node *router; | 439 | struct batadv_neigh_node *router; |
436 | int down, up, ret = -1; | 440 | int down, up, ret = -1; |
437 | 441 | ||
438 | batadv_gw_bandwidth_to_kbit(gw_node->orig_node->gw_flags, &down, &up); | 442 | batadv_gw_bandwidth_to_kbit(gw_node->orig_node->gw_flags, &down, &up); |
@@ -464,9 +468,9 @@ out: | |||
464 | int batadv_gw_client_seq_print_text(struct seq_file *seq, void *offset) | 468 | int batadv_gw_client_seq_print_text(struct seq_file *seq, void *offset) |
465 | { | 469 | { |
466 | struct net_device *net_dev = (struct net_device *)seq->private; | 470 | struct net_device *net_dev = (struct net_device *)seq->private; |
467 | struct bat_priv *bat_priv = netdev_priv(net_dev); | 471 | struct batadv_priv *bat_priv = netdev_priv(net_dev); |
468 | struct hard_iface *primary_if; | 472 | struct batadv_hard_iface *primary_if; |
469 | struct gw_node *gw_node; | 473 | struct batadv_gw_node *gw_node; |
470 | struct hlist_node *node; | 474 | struct hlist_node *node; |
471 | int gw_count = 0, ret = 0; | 475 | int gw_count = 0, ret = 0; |
472 | 476 | ||
@@ -639,12 +643,12 @@ bool batadv_gw_is_dhcp_target(struct sk_buff *skb, unsigned int *header_len) | |||
639 | return true; | 643 | return true; |
640 | } | 644 | } |
641 | 645 | ||
642 | bool batadv_gw_out_of_range(struct bat_priv *bat_priv, | 646 | bool batadv_gw_out_of_range(struct batadv_priv *bat_priv, |
643 | struct sk_buff *skb, struct ethhdr *ethhdr) | 647 | struct sk_buff *skb, struct ethhdr *ethhdr) |
644 | { | 648 | { |
645 | struct neigh_node *neigh_curr = NULL, *neigh_old = NULL; | 649 | struct batadv_neigh_node *neigh_curr = NULL, *neigh_old = NULL; |
646 | struct orig_node *orig_dst_node = NULL; | 650 | struct batadv_orig_node *orig_dst_node = NULL; |
647 | struct gw_node *curr_gw = NULL; | 651 | struct batadv_gw_node *curr_gw = NULL; |
648 | bool ret, out_of_range = false; | 652 | bool ret, out_of_range = false; |
649 | unsigned int header_len = 0; | 653 | unsigned int header_len = 0; |
650 | uint8_t curr_tq_avg; | 654 | uint8_t curr_tq_avg; |