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/vis.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/vis.c')
-rw-r--r-- | net/batman-adv/vis.c | 173 |
1 files changed, 90 insertions, 83 deletions
diff --git a/net/batman-adv/vis.c b/net/batman-adv/vis.c index 309493d9128a..f09cc9ad6ad8 100644 --- a/net/batman-adv/vis.c +++ b/net/batman-adv/vis.c | |||
@@ -28,14 +28,17 @@ | |||
28 | 28 | ||
29 | #define BATADV_MAX_VIS_PACKET_SIZE 1000 | 29 | #define BATADV_MAX_VIS_PACKET_SIZE 1000 |
30 | 30 | ||
31 | static void batadv_start_vis_timer(struct bat_priv *bat_priv); | 31 | static void batadv_start_vis_timer(struct batadv_priv *bat_priv); |
32 | 32 | ||
33 | /* free the info */ | 33 | /* free the info */ |
34 | static void batadv_free_info(struct kref *ref) | 34 | static void batadv_free_info(struct kref *ref) |
35 | { | 35 | { |
36 | struct vis_info *info = container_of(ref, struct vis_info, refcount); | 36 | struct batadv_vis_info *info; |
37 | struct bat_priv *bat_priv = info->bat_priv; | 37 | struct batadv_priv *bat_priv; |
38 | struct recvlist_node *entry, *tmp; | 38 | struct batadv_recvlist_node *entry, *tmp; |
39 | |||
40 | info = container_of(ref, struct batadv_vis_info, refcount); | ||
41 | bat_priv = info->bat_priv; | ||
39 | 42 | ||
40 | list_del_init(&info->send_list); | 43 | list_del_init(&info->send_list); |
41 | spin_lock_bh(&bat_priv->vis_list_lock); | 44 | spin_lock_bh(&bat_priv->vis_list_lock); |
@@ -52,10 +55,10 @@ static void batadv_free_info(struct kref *ref) | |||
52 | /* Compare two vis packets, used by the hashing algorithm */ | 55 | /* Compare two vis packets, used by the hashing algorithm */ |
53 | static int batadv_vis_info_cmp(const struct hlist_node *node, const void *data2) | 56 | static int batadv_vis_info_cmp(const struct hlist_node *node, const void *data2) |
54 | { | 57 | { |
55 | const struct vis_info *d1, *d2; | 58 | const struct batadv_vis_info *d1, *d2; |
56 | const struct batadv_vis_packet *p1, *p2; | 59 | const struct batadv_vis_packet *p1, *p2; |
57 | 60 | ||
58 | d1 = container_of(node, struct vis_info, hash_entry); | 61 | d1 = container_of(node, struct batadv_vis_info, hash_entry); |
59 | d2 = data2; | 62 | d2 = data2; |
60 | p1 = (struct batadv_vis_packet *)d1->skb_packet->data; | 63 | p1 = (struct batadv_vis_packet *)d1->skb_packet->data; |
61 | p2 = (struct batadv_vis_packet *)d2->skb_packet->data; | 64 | p2 = (struct batadv_vis_packet *)d2->skb_packet->data; |
@@ -67,7 +70,7 @@ static int batadv_vis_info_cmp(const struct hlist_node *node, const void *data2) | |||
67 | */ | 70 | */ |
68 | static uint32_t batadv_vis_info_choose(const void *data, uint32_t size) | 71 | static uint32_t batadv_vis_info_choose(const void *data, uint32_t size) |
69 | { | 72 | { |
70 | const struct vis_info *vis_info = data; | 73 | const struct batadv_vis_info *vis_info = data; |
71 | const struct batadv_vis_packet *packet; | 74 | const struct batadv_vis_packet *packet; |
72 | const unsigned char *key; | 75 | const unsigned char *key; |
73 | uint32_t hash = 0; | 76 | uint32_t hash = 0; |
@@ -88,13 +91,13 @@ static uint32_t batadv_vis_info_choose(const void *data, uint32_t size) | |||
88 | return hash % size; | 91 | return hash % size; |
89 | } | 92 | } |
90 | 93 | ||
91 | static struct vis_info *batadv_vis_hash_find(struct bat_priv *bat_priv, | 94 | static struct batadv_vis_info * |
92 | const void *data) | 95 | batadv_vis_hash_find(struct batadv_priv *bat_priv, const void *data) |
93 | { | 96 | { |
94 | struct batadv_hashtable *hash = bat_priv->vis_hash; | 97 | struct batadv_hashtable *hash = bat_priv->vis_hash; |
95 | struct hlist_head *head; | 98 | struct hlist_head *head; |
96 | struct hlist_node *node; | 99 | struct hlist_node *node; |
97 | struct vis_info *vis_info, *vis_info_tmp = NULL; | 100 | struct batadv_vis_info *vis_info, *vis_info_tmp = NULL; |
98 | uint32_t index; | 101 | uint32_t index; |
99 | 102 | ||
100 | if (!hash) | 103 | if (!hash) |
@@ -123,7 +126,7 @@ static void batadv_vis_data_insert_interface(const uint8_t *interface, | |||
123 | struct hlist_head *if_list, | 126 | struct hlist_head *if_list, |
124 | bool primary) | 127 | bool primary) |
125 | { | 128 | { |
126 | struct if_list_entry *entry; | 129 | struct batadv_if_list_entry *entry; |
127 | struct hlist_node *pos; | 130 | struct hlist_node *pos; |
128 | 131 | ||
129 | hlist_for_each_entry(entry, pos, if_list, list) { | 132 | hlist_for_each_entry(entry, pos, if_list, list) { |
@@ -143,7 +146,7 @@ static void batadv_vis_data_insert_interface(const uint8_t *interface, | |||
143 | static void batadv_vis_data_read_prim_sec(struct seq_file *seq, | 146 | static void batadv_vis_data_read_prim_sec(struct seq_file *seq, |
144 | const struct hlist_head *if_list) | 147 | const struct hlist_head *if_list) |
145 | { | 148 | { |
146 | struct if_list_entry *entry; | 149 | struct batadv_if_list_entry *entry; |
147 | struct hlist_node *pos; | 150 | struct hlist_node *pos; |
148 | 151 | ||
149 | hlist_for_each_entry(entry, pos, if_list, list) { | 152 | hlist_for_each_entry(entry, pos, if_list, list) { |
@@ -155,9 +158,10 @@ static void batadv_vis_data_read_prim_sec(struct seq_file *seq, | |||
155 | } | 158 | } |
156 | 159 | ||
157 | /* read an entry */ | 160 | /* read an entry */ |
158 | static ssize_t batadv_vis_data_read_entry(struct seq_file *seq, | 161 | static ssize_t |
159 | const struct vis_info_entry *entry, | 162 | batadv_vis_data_read_entry(struct seq_file *seq, |
160 | const uint8_t *src, bool primary) | 163 | const struct batadv_vis_info_entry *entry, |
164 | const uint8_t *src, bool primary) | ||
161 | { | 165 | { |
162 | if (primary && entry->quality == 0) | 166 | if (primary && entry->quality == 0) |
163 | return seq_printf(seq, "TT %pM, ", entry->dest); | 167 | return seq_printf(seq, "TT %pM, ", entry->dest); |
@@ -168,9 +172,10 @@ static ssize_t batadv_vis_data_read_entry(struct seq_file *seq, | |||
168 | return 0; | 172 | return 0; |
169 | } | 173 | } |
170 | 174 | ||
171 | static void batadv_vis_data_insert_interfaces(struct hlist_head *list, | 175 | static void |
172 | struct batadv_vis_packet *packet, | 176 | batadv_vis_data_insert_interfaces(struct hlist_head *list, |
173 | struct vis_info_entry *entries) | 177 | struct batadv_vis_packet *packet, |
178 | struct batadv_vis_info_entry *entries) | ||
174 | { | 179 | { |
175 | int i; | 180 | int i; |
176 | 181 | ||
@@ -188,10 +193,10 @@ static void batadv_vis_data_insert_interfaces(struct hlist_head *list, | |||
188 | static void batadv_vis_data_read_entries(struct seq_file *seq, | 193 | static void batadv_vis_data_read_entries(struct seq_file *seq, |
189 | struct hlist_head *list, | 194 | struct hlist_head *list, |
190 | struct batadv_vis_packet *packet, | 195 | struct batadv_vis_packet *packet, |
191 | struct vis_info_entry *entries) | 196 | struct batadv_vis_info_entry *entries) |
192 | { | 197 | { |
193 | int i; | 198 | int i; |
194 | struct if_list_entry *entry; | 199 | struct batadv_if_list_entry *entry; |
195 | struct hlist_node *pos; | 200 | struct hlist_node *pos; |
196 | 201 | ||
197 | hlist_for_each_entry(entry, pos, list, list) { | 202 | hlist_for_each_entry(entry, pos, list, list) { |
@@ -213,11 +218,11 @@ static void batadv_vis_seq_print_text_bucket(struct seq_file *seq, | |||
213 | const struct hlist_head *head) | 218 | const struct hlist_head *head) |
214 | { | 219 | { |
215 | struct hlist_node *node; | 220 | struct hlist_node *node; |
216 | struct vis_info *info; | 221 | struct batadv_vis_info *info; |
217 | struct batadv_vis_packet *packet; | 222 | struct batadv_vis_packet *packet; |
218 | uint8_t *entries_pos; | 223 | uint8_t *entries_pos; |
219 | struct vis_info_entry *entries; | 224 | struct batadv_vis_info_entry *entries; |
220 | struct if_list_entry *entry; | 225 | struct batadv_if_list_entry *entry; |
221 | struct hlist_node *pos, *n; | 226 | struct hlist_node *pos, *n; |
222 | 227 | ||
223 | HLIST_HEAD(vis_if_list); | 228 | HLIST_HEAD(vis_if_list); |
@@ -225,7 +230,7 @@ static void batadv_vis_seq_print_text_bucket(struct seq_file *seq, | |||
225 | hlist_for_each_entry_rcu(info, node, head, hash_entry) { | 230 | hlist_for_each_entry_rcu(info, node, head, hash_entry) { |
226 | packet = (struct batadv_vis_packet *)info->skb_packet->data; | 231 | packet = (struct batadv_vis_packet *)info->skb_packet->data; |
227 | entries_pos = (uint8_t *)packet + sizeof(*packet); | 232 | entries_pos = (uint8_t *)packet + sizeof(*packet); |
228 | entries = (struct vis_info_entry *)entries_pos; | 233 | entries = (struct batadv_vis_info_entry *)entries_pos; |
229 | 234 | ||
230 | batadv_vis_data_insert_interface(packet->vis_orig, &vis_if_list, | 235 | batadv_vis_data_insert_interface(packet->vis_orig, &vis_if_list, |
231 | true); | 236 | true); |
@@ -243,10 +248,10 @@ static void batadv_vis_seq_print_text_bucket(struct seq_file *seq, | |||
243 | 248 | ||
244 | int batadv_vis_seq_print_text(struct seq_file *seq, void *offset) | 249 | int batadv_vis_seq_print_text(struct seq_file *seq, void *offset) |
245 | { | 250 | { |
246 | struct hard_iface *primary_if; | 251 | struct batadv_hard_iface *primary_if; |
247 | struct hlist_head *head; | 252 | struct hlist_head *head; |
248 | struct net_device *net_dev = (struct net_device *)seq->private; | 253 | struct net_device *net_dev = (struct net_device *)seq->private; |
249 | struct bat_priv *bat_priv = netdev_priv(net_dev); | 254 | struct batadv_priv *bat_priv = netdev_priv(net_dev); |
250 | struct batadv_hashtable *hash = bat_priv->vis_hash; | 255 | struct batadv_hashtable *hash = bat_priv->vis_hash; |
251 | uint32_t i; | 256 | uint32_t i; |
252 | int ret = 0; | 257 | int ret = 0; |
@@ -275,8 +280,8 @@ out: | |||
275 | /* add the info packet to the send list, if it was not | 280 | /* add the info packet to the send list, if it was not |
276 | * already linked in. | 281 | * already linked in. |
277 | */ | 282 | */ |
278 | static void batadv_send_list_add(struct bat_priv *bat_priv, | 283 | static void batadv_send_list_add(struct batadv_priv *bat_priv, |
279 | struct vis_info *info) | 284 | struct batadv_vis_info *info) |
280 | { | 285 | { |
281 | if (list_empty(&info->send_list)) { | 286 | if (list_empty(&info->send_list)) { |
282 | kref_get(&info->refcount); | 287 | kref_get(&info->refcount); |
@@ -287,7 +292,7 @@ static void batadv_send_list_add(struct bat_priv *bat_priv, | |||
287 | /* delete the info packet from the send list, if it was | 292 | /* delete the info packet from the send list, if it was |
288 | * linked in. | 293 | * linked in. |
289 | */ | 294 | */ |
290 | static void batadv_send_list_del(struct vis_info *info) | 295 | static void batadv_send_list_del(struct batadv_vis_info *info) |
291 | { | 296 | { |
292 | if (!list_empty(&info->send_list)) { | 297 | if (!list_empty(&info->send_list)) { |
293 | list_del_init(&info->send_list); | 298 | list_del_init(&info->send_list); |
@@ -296,10 +301,10 @@ static void batadv_send_list_del(struct vis_info *info) | |||
296 | } | 301 | } |
297 | 302 | ||
298 | /* tries to add one entry to the receive list. */ | 303 | /* tries to add one entry to the receive list. */ |
299 | static void batadv_recv_list_add(struct bat_priv *bat_priv, | 304 | static void batadv_recv_list_add(struct batadv_priv *bat_priv, |
300 | struct list_head *recv_list, const char *mac) | 305 | struct list_head *recv_list, const char *mac) |
301 | { | 306 | { |
302 | struct recvlist_node *entry; | 307 | struct batadv_recvlist_node *entry; |
303 | 308 | ||
304 | entry = kmalloc(sizeof(*entry), GFP_ATOMIC); | 309 | entry = kmalloc(sizeof(*entry), GFP_ATOMIC); |
305 | if (!entry) | 310 | if (!entry) |
@@ -312,11 +317,11 @@ static void batadv_recv_list_add(struct bat_priv *bat_priv, | |||
312 | } | 317 | } |
313 | 318 | ||
314 | /* returns 1 if this mac is in the recv_list */ | 319 | /* returns 1 if this mac is in the recv_list */ |
315 | static int batadv_recv_list_is_in(struct bat_priv *bat_priv, | 320 | static int batadv_recv_list_is_in(struct batadv_priv *bat_priv, |
316 | const struct list_head *recv_list, | 321 | const struct list_head *recv_list, |
317 | const char *mac) | 322 | const char *mac) |
318 | { | 323 | { |
319 | const struct recvlist_node *entry; | 324 | const struct batadv_recvlist_node *entry; |
320 | 325 | ||
321 | spin_lock_bh(&bat_priv->vis_list_lock); | 326 | spin_lock_bh(&bat_priv->vis_list_lock); |
322 | list_for_each_entry(entry, recv_list, list) { | 327 | list_for_each_entry(entry, recv_list, list) { |
@@ -333,18 +338,19 @@ static int batadv_recv_list_is_in(struct bat_priv *bat_priv, | |||
333 | * broken.. ). vis hash must be locked outside. is_new is set when the packet | 338 | * broken.. ). vis hash must be locked outside. is_new is set when the packet |
334 | * is newer than old entries in the hash. | 339 | * is newer than old entries in the hash. |
335 | */ | 340 | */ |
336 | static struct vis_info *batadv_add_packet(struct bat_priv *bat_priv, | 341 | static struct batadv_vis_info * |
337 | struct batadv_vis_packet *vis_packet, | 342 | batadv_add_packet(struct batadv_priv *bat_priv, |
338 | int vis_info_len, int *is_new, | 343 | struct batadv_vis_packet *vis_packet, int vis_info_len, |
339 | int make_broadcast) | 344 | int *is_new, int make_broadcast) |
340 | { | 345 | { |
341 | struct vis_info *info, *old_info; | 346 | struct batadv_vis_info *info, *old_info; |
342 | struct batadv_vis_packet *search_packet, *old_packet; | 347 | struct batadv_vis_packet *search_packet, *old_packet; |
343 | struct vis_info search_elem; | 348 | struct batadv_vis_info search_elem; |
344 | struct batadv_vis_packet *packet; | 349 | struct batadv_vis_packet *packet; |
345 | struct sk_buff *tmp_skb; | 350 | struct sk_buff *tmp_skb; |
346 | int hash_added; | 351 | int hash_added; |
347 | size_t len; | 352 | size_t len; |
353 | size_t max_entries; | ||
348 | 354 | ||
349 | *is_new = 0; | 355 | *is_new = 0; |
350 | /* sanity check */ | 356 | /* sanity check */ |
@@ -413,8 +419,9 @@ static struct vis_info *batadv_add_packet(struct bat_priv *bat_priv, | |||
413 | memcpy(packet->target_orig, batadv_broadcast_addr, ETH_ALEN); | 419 | memcpy(packet->target_orig, batadv_broadcast_addr, ETH_ALEN); |
414 | 420 | ||
415 | /* repair if entries is longer than packet. */ | 421 | /* repair if entries is longer than packet. */ |
416 | if (packet->entries * sizeof(struct vis_info_entry) > vis_info_len) | 422 | max_entries = vis_info_len / sizeof(struct batadv_vis_info_entry); |
417 | packet->entries = vis_info_len / sizeof(struct vis_info_entry); | 423 | if (packet->entries > max_entries) |
424 | packet->entries = max_entries; | ||
418 | 425 | ||
419 | batadv_recv_list_add(bat_priv, &info->recv_list, packet->sender_orig); | 426 | batadv_recv_list_add(bat_priv, &info->recv_list, packet->sender_orig); |
420 | 427 | ||
@@ -432,11 +439,11 @@ static struct vis_info *batadv_add_packet(struct bat_priv *bat_priv, | |||
432 | } | 439 | } |
433 | 440 | ||
434 | /* handle the server sync packet, forward if needed. */ | 441 | /* handle the server sync packet, forward if needed. */ |
435 | void batadv_receive_server_sync_packet(struct bat_priv *bat_priv, | 442 | void batadv_receive_server_sync_packet(struct batadv_priv *bat_priv, |
436 | struct batadv_vis_packet *vis_packet, | 443 | struct batadv_vis_packet *vis_packet, |
437 | int vis_info_len) | 444 | int vis_info_len) |
438 | { | 445 | { |
439 | struct vis_info *info; | 446 | struct batadv_vis_info *info; |
440 | int is_new, make_broadcast; | 447 | int is_new, make_broadcast; |
441 | int vis_server = atomic_read(&bat_priv->vis_mode); | 448 | int vis_server = atomic_read(&bat_priv->vis_mode); |
442 | 449 | ||
@@ -458,11 +465,11 @@ end: | |||
458 | } | 465 | } |
459 | 466 | ||
460 | /* handle an incoming client update packet and schedule forward if needed. */ | 467 | /* handle an incoming client update packet and schedule forward if needed. */ |
461 | void batadv_receive_client_update_packet(struct bat_priv *bat_priv, | 468 | void batadv_receive_client_update_packet(struct batadv_priv *bat_priv, |
462 | struct batadv_vis_packet *vis_packet, | 469 | struct batadv_vis_packet *vis_packet, |
463 | int vis_info_len) | 470 | int vis_info_len) |
464 | { | 471 | { |
465 | struct vis_info *info; | 472 | struct batadv_vis_info *info; |
466 | struct batadv_vis_packet *packet; | 473 | struct batadv_vis_packet *packet; |
467 | int is_new; | 474 | int is_new; |
468 | int vis_server = atomic_read(&bat_priv->vis_mode); | 475 | int vis_server = atomic_read(&bat_priv->vis_mode); |
@@ -506,14 +513,14 @@ end: | |||
506 | * | 513 | * |
507 | * Must be called with the originator hash locked | 514 | * Must be called with the originator hash locked |
508 | */ | 515 | */ |
509 | static int batadv_find_best_vis_server(struct bat_priv *bat_priv, | 516 | static int batadv_find_best_vis_server(struct batadv_priv *bat_priv, |
510 | struct vis_info *info) | 517 | struct batadv_vis_info *info) |
511 | { | 518 | { |
512 | struct batadv_hashtable *hash = bat_priv->orig_hash; | 519 | struct batadv_hashtable *hash = bat_priv->orig_hash; |
513 | struct neigh_node *router; | 520 | struct batadv_neigh_node *router; |
514 | struct hlist_node *node; | 521 | struct hlist_node *node; |
515 | struct hlist_head *head; | 522 | struct hlist_head *head; |
516 | struct orig_node *orig_node; | 523 | struct batadv_orig_node *orig_node; |
517 | struct batadv_vis_packet *packet; | 524 | struct batadv_vis_packet *packet; |
518 | int best_tq = -1; | 525 | int best_tq = -1; |
519 | uint32_t i; | 526 | uint32_t i; |
@@ -544,15 +551,15 @@ static int batadv_find_best_vis_server(struct bat_priv *bat_priv, | |||
544 | } | 551 | } |
545 | 552 | ||
546 | /* Return true if the vis packet is full. */ | 553 | /* Return true if the vis packet is full. */ |
547 | static bool batadv_vis_packet_full(const struct vis_info *info) | 554 | static bool batadv_vis_packet_full(const struct batadv_vis_info *info) |
548 | { | 555 | { |
549 | const struct batadv_vis_packet *packet; | 556 | const struct batadv_vis_packet *packet; |
550 | size_t num_items; | 557 | size_t num; |
551 | 558 | ||
552 | packet = (struct batadv_vis_packet *)info->skb_packet->data; | 559 | packet = (struct batadv_vis_packet *)info->skb_packet->data; |
553 | num_items = BATADV_MAX_VIS_PACKET_SIZE / sizeof(struct vis_info_entry); | 560 | num = BATADV_MAX_VIS_PACKET_SIZE / sizeof(struct batadv_vis_info_entry); |
554 | 561 | ||
555 | if (num_items < packet->entries + 1) | 562 | if (num < packet->entries + 1) |
556 | return true; | 563 | return true; |
557 | return false; | 564 | return false; |
558 | } | 565 | } |
@@ -560,17 +567,17 @@ static bool batadv_vis_packet_full(const struct vis_info *info) | |||
560 | /* generates a packet of own vis data, | 567 | /* generates a packet of own vis data, |
561 | * returns 0 on success, -1 if no packet could be generated | 568 | * returns 0 on success, -1 if no packet could be generated |
562 | */ | 569 | */ |
563 | static int batadv_generate_vis_packet(struct bat_priv *bat_priv) | 570 | static int batadv_generate_vis_packet(struct batadv_priv *bat_priv) |
564 | { | 571 | { |
565 | struct batadv_hashtable *hash = bat_priv->orig_hash; | 572 | struct batadv_hashtable *hash = bat_priv->orig_hash; |
566 | struct hlist_node *node; | 573 | struct hlist_node *node; |
567 | struct hlist_head *head; | 574 | struct hlist_head *head; |
568 | struct orig_node *orig_node; | 575 | struct batadv_orig_node *orig_node; |
569 | struct neigh_node *router; | 576 | struct batadv_neigh_node *router; |
570 | struct vis_info *info = bat_priv->my_vis_info; | 577 | struct batadv_vis_info *info = bat_priv->my_vis_info; |
571 | struct batadv_vis_packet *packet; | 578 | struct batadv_vis_packet *packet; |
572 | struct vis_info_entry *entry; | 579 | struct batadv_vis_info_entry *entry; |
573 | struct tt_common_entry *tt_common_entry; | 580 | struct batadv_tt_common_entry *tt_common_entry; |
574 | int best_tq = -1; | 581 | int best_tq = -1; |
575 | uint32_t i; | 582 | uint32_t i; |
576 | 583 | ||
@@ -610,7 +617,7 @@ static int batadv_generate_vis_packet(struct bat_priv *bat_priv) | |||
610 | goto next; | 617 | goto next; |
611 | 618 | ||
612 | /* fill one entry into buffer. */ | 619 | /* fill one entry into buffer. */ |
613 | entry = (struct vis_info_entry *) | 620 | entry = (struct batadv_vis_info_entry *) |
614 | skb_put(info->skb_packet, sizeof(*entry)); | 621 | skb_put(info->skb_packet, sizeof(*entry)); |
615 | memcpy(entry->src, | 622 | memcpy(entry->src, |
616 | router->if_incoming->net_dev->dev_addr, | 623 | router->if_incoming->net_dev->dev_addr, |
@@ -636,7 +643,7 @@ next: | |||
636 | rcu_read_lock(); | 643 | rcu_read_lock(); |
637 | hlist_for_each_entry_rcu(tt_common_entry, node, head, | 644 | hlist_for_each_entry_rcu(tt_common_entry, node, head, |
638 | hash_entry) { | 645 | hash_entry) { |
639 | entry = (struct vis_info_entry *) | 646 | entry = (struct batadv_vis_info_entry *) |
640 | skb_put(info->skb_packet, | 647 | skb_put(info->skb_packet, |
641 | sizeof(*entry)); | 648 | sizeof(*entry)); |
642 | memset(entry->src, 0, ETH_ALEN); | 649 | memset(entry->src, 0, ETH_ALEN); |
@@ -660,13 +667,13 @@ unlock: | |||
660 | /* free old vis packets. Must be called with this vis_hash_lock | 667 | /* free old vis packets. Must be called with this vis_hash_lock |
661 | * held | 668 | * held |
662 | */ | 669 | */ |
663 | static void batadv_purge_vis_packets(struct bat_priv *bat_priv) | 670 | static void batadv_purge_vis_packets(struct batadv_priv *bat_priv) |
664 | { | 671 | { |
665 | uint32_t i; | 672 | uint32_t i; |
666 | struct batadv_hashtable *hash = bat_priv->vis_hash; | 673 | struct batadv_hashtable *hash = bat_priv->vis_hash; |
667 | struct hlist_node *node, *node_tmp; | 674 | struct hlist_node *node, *node_tmp; |
668 | struct hlist_head *head; | 675 | struct hlist_head *head; |
669 | struct vis_info *info; | 676 | struct batadv_vis_info *info; |
670 | 677 | ||
671 | for (i = 0; i < hash->size; i++) { | 678 | for (i = 0; i < hash->size; i++) { |
672 | head = &hash->table[i]; | 679 | head = &hash->table[i]; |
@@ -687,17 +694,17 @@ static void batadv_purge_vis_packets(struct bat_priv *bat_priv) | |||
687 | } | 694 | } |
688 | } | 695 | } |
689 | 696 | ||
690 | static void batadv_broadcast_vis_packet(struct bat_priv *bat_priv, | 697 | static void batadv_broadcast_vis_packet(struct batadv_priv *bat_priv, |
691 | struct vis_info *info) | 698 | struct batadv_vis_info *info) |
692 | { | 699 | { |
693 | struct neigh_node *router; | 700 | struct batadv_neigh_node *router; |
694 | struct batadv_hashtable *hash = bat_priv->orig_hash; | 701 | struct batadv_hashtable *hash = bat_priv->orig_hash; |
695 | struct hlist_node *node; | 702 | struct hlist_node *node; |
696 | struct hlist_head *head; | 703 | struct hlist_head *head; |
697 | struct orig_node *orig_node; | 704 | struct batadv_orig_node *orig_node; |
698 | struct batadv_vis_packet *packet; | 705 | struct batadv_vis_packet *packet; |
699 | struct sk_buff *skb; | 706 | struct sk_buff *skb; |
700 | struct hard_iface *hard_iface; | 707 | struct batadv_hard_iface *hard_iface; |
701 | uint8_t dstaddr[ETH_ALEN]; | 708 | uint8_t dstaddr[ETH_ALEN]; |
702 | uint32_t i; | 709 | uint32_t i; |
703 | 710 | ||
@@ -743,11 +750,11 @@ static void batadv_broadcast_vis_packet(struct bat_priv *bat_priv, | |||
743 | } | 750 | } |
744 | } | 751 | } |
745 | 752 | ||
746 | static void batadv_unicast_vis_packet(struct bat_priv *bat_priv, | 753 | static void batadv_unicast_vis_packet(struct batadv_priv *bat_priv, |
747 | struct vis_info *info) | 754 | struct batadv_vis_info *info) |
748 | { | 755 | { |
749 | struct orig_node *orig_node; | 756 | struct batadv_orig_node *orig_node; |
750 | struct neigh_node *router = NULL; | 757 | struct batadv_neigh_node *router = NULL; |
751 | struct sk_buff *skb; | 758 | struct sk_buff *skb; |
752 | struct batadv_vis_packet *packet; | 759 | struct batadv_vis_packet *packet; |
753 | 760 | ||
@@ -773,10 +780,10 @@ out: | |||
773 | } | 780 | } |
774 | 781 | ||
775 | /* only send one vis packet. called from batadv_send_vis_packets() */ | 782 | /* only send one vis packet. called from batadv_send_vis_packets() */ |
776 | static void batadv_send_vis_packet(struct bat_priv *bat_priv, | 783 | static void batadv_send_vis_packet(struct batadv_priv *bat_priv, |
777 | struct vis_info *info) | 784 | struct batadv_vis_info *info) |
778 | { | 785 | { |
779 | struct hard_iface *primary_if; | 786 | struct batadv_hard_iface *primary_if; |
780 | struct batadv_vis_packet *packet; | 787 | struct batadv_vis_packet *packet; |
781 | 788 | ||
782 | primary_if = batadv_primary_if_get_selected(bat_priv); | 789 | primary_if = batadv_primary_if_get_selected(bat_priv); |
@@ -808,10 +815,10 @@ static void batadv_send_vis_packets(struct work_struct *work) | |||
808 | { | 815 | { |
809 | struct delayed_work *delayed_work = | 816 | struct delayed_work *delayed_work = |
810 | container_of(work, struct delayed_work, work); | 817 | container_of(work, struct delayed_work, work); |
811 | struct bat_priv *bat_priv = | 818 | struct batadv_priv *bat_priv; |
812 | container_of(delayed_work, struct bat_priv, vis_work); | 819 | struct batadv_vis_info *info; |
813 | struct vis_info *info; | ||
814 | 820 | ||
821 | bat_priv = container_of(delayed_work, struct batadv_priv, vis_work); | ||
815 | spin_lock_bh(&bat_priv->vis_hash_lock); | 822 | spin_lock_bh(&bat_priv->vis_hash_lock); |
816 | batadv_purge_vis_packets(bat_priv); | 823 | batadv_purge_vis_packets(bat_priv); |
817 | 824 | ||
@@ -840,7 +847,7 @@ static void batadv_send_vis_packets(struct work_struct *work) | |||
840 | /* init the vis server. this may only be called when if_list is already | 847 | /* init the vis server. this may only be called when if_list is already |
841 | * initialized (e.g. bat0 is initialized, interfaces have been added) | 848 | * initialized (e.g. bat0 is initialized, interfaces have been added) |
842 | */ | 849 | */ |
843 | int batadv_vis_init(struct bat_priv *bat_priv) | 850 | int batadv_vis_init(struct batadv_priv *bat_priv) |
844 | { | 851 | { |
845 | struct batadv_vis_packet *packet; | 852 | struct batadv_vis_packet *packet; |
846 | int hash_added; | 853 | int hash_added; |
@@ -914,15 +921,15 @@ err: | |||
914 | /* Decrease the reference count on a hash item info */ | 921 | /* Decrease the reference count on a hash item info */ |
915 | static void batadv_free_info_ref(struct hlist_node *node, void *arg) | 922 | static void batadv_free_info_ref(struct hlist_node *node, void *arg) |
916 | { | 923 | { |
917 | struct vis_info *info; | 924 | struct batadv_vis_info *info; |
918 | 925 | ||
919 | info = container_of(node, struct vis_info, hash_entry); | 926 | info = container_of(node, struct batadv_vis_info, hash_entry); |
920 | batadv_send_list_del(info); | 927 | batadv_send_list_del(info); |
921 | kref_put(&info->refcount, batadv_free_info); | 928 | kref_put(&info->refcount, batadv_free_info); |
922 | } | 929 | } |
923 | 930 | ||
924 | /* shutdown vis-server */ | 931 | /* shutdown vis-server */ |
925 | void batadv_vis_quit(struct bat_priv *bat_priv) | 932 | void batadv_vis_quit(struct batadv_priv *bat_priv) |
926 | { | 933 | { |
927 | if (!bat_priv->vis_hash) | 934 | if (!bat_priv->vis_hash) |
928 | return; | 935 | return; |
@@ -938,7 +945,7 @@ void batadv_vis_quit(struct bat_priv *bat_priv) | |||
938 | } | 945 | } |
939 | 946 | ||
940 | /* schedule packets for (re)transmission */ | 947 | /* schedule packets for (re)transmission */ |
941 | static void batadv_start_vis_timer(struct bat_priv *bat_priv) | 948 | static void batadv_start_vis_timer(struct batadv_priv *bat_priv) |
942 | { | 949 | { |
943 | INIT_DELAYED_WORK(&bat_priv->vis_work, batadv_send_vis_packets); | 950 | INIT_DELAYED_WORK(&bat_priv->vis_work, batadv_send_vis_packets); |
944 | queue_delayed_work(batadv_event_workqueue, &bat_priv->vis_work, | 951 | queue_delayed_work(batadv_event_workqueue, &bat_priv->vis_work, |