aboutsummaryrefslogtreecommitdiffstats
path: root/net/batman-adv/vis.c
diff options
context:
space:
mode:
authorSven Eckelmann <sven@narfation.org>2012-05-11 20:09:43 -0400
committerAntonio Quartulli <ordex@autistici.org>2012-06-20 16:15:33 -0400
commit9cfc7bd608b97463993b4f3e4775d99022253f8d (patch)
treefcfcf1e714a91943a740dcaa2744ee66448f9f73 /net/batman-adv/vis.c
parent3193e8fdfa355289892661d206d1954114a7be95 (diff)
batman-adv: Reformat multiline comments to consistent style
batman-adv doesn't follow the style for multiline comments that David S. Miller prefers. All comments should be reformatted to follow this consistent style to make the code slightly more readable. Signed-off-by: Sven Eckelmann <sven@narfation.org>
Diffstat (limited to 'net/batman-adv/vis.c')
-rw-r--r--net/batman-adv/vis.c39
1 files changed, 24 insertions, 15 deletions
diff --git a/net/batman-adv/vis.c b/net/batman-adv/vis.c
index 83c931fa5c2..20eef04645b 100644
--- a/net/batman-adv/vis.c
+++ b/net/batman-adv/vis.c
@@ -1,5 +1,4 @@
1/* 1/* Copyright (C) 2008-2012 B.A.T.M.A.N. contributors:
2 * Copyright (C) 2008-2012 B.A.T.M.A.N. contributors:
3 * 2 *
4 * Simon Wunderlich 3 * Simon Wunderlich
5 * 4 *
@@ -16,7 +15,6 @@
16 * along with this program; if not, write to the Free Software 15 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 * 02110-1301, USA 17 * 02110-1301, USA
19 *
20 */ 18 */
21 19
22#include "main.h" 20#include "main.h"
@@ -64,8 +62,9 @@ static int vis_info_cmp(const struct hlist_node *node, const void *data2)
64 return compare_eth(p1->vis_orig, p2->vis_orig); 62 return compare_eth(p1->vis_orig, p2->vis_orig);
65} 63}
66 64
67/* hash function to choose an entry in a hash table of given size */ 65/* hash function to choose an entry in a hash table of given size
68/* hash algorithm from http://en.wikipedia.org/wiki/Hash_table */ 66 * hash algorithm from http://en.wikipedia.org/wiki/Hash_table
67 */
69static uint32_t vis_info_choose(const void *data, uint32_t size) 68static uint32_t vis_info_choose(const void *data, uint32_t size)
70{ 69{
71 const struct vis_info *vis_info = data; 70 const struct vis_info *vis_info = data;
@@ -118,7 +117,8 @@ static struct vis_info *vis_hash_find(struct bat_priv *bat_priv,
118} 117}
119 118
120/* insert interface to the list of interfaces of one originator, if it 119/* insert interface to the list of interfaces of one originator, if it
121 * does not already exist in the list */ 120 * does not already exist in the list
121 */
122static void vis_data_insert_interface(const uint8_t *interface, 122static void vis_data_insert_interface(const uint8_t *interface,
123 struct hlist_head *if_list, 123 struct hlist_head *if_list,
124 bool primary) 124 bool primary)
@@ -334,7 +334,8 @@ out:
334} 334}
335 335
336/* add the info packet to the send list, if it was not 336/* add the info packet to the send list, if it was not
337 * already linked in. */ 337 * already linked in.
338 */
338static void send_list_add(struct bat_priv *bat_priv, struct vis_info *info) 339static void send_list_add(struct bat_priv *bat_priv, struct vis_info *info)
339{ 340{
340 if (list_empty(&info->send_list)) { 341 if (list_empty(&info->send_list)) {
@@ -344,7 +345,8 @@ static void send_list_add(struct bat_priv *bat_priv, struct vis_info *info)
344} 345}
345 346
346/* delete the info packet from the send list, if it was 347/* delete the info packet from the send list, if it was
347 * linked in. */ 348 * linked in.
349 */
348static void send_list_del(struct vis_info *info) 350static void send_list_del(struct vis_info *info)
349{ 351{
350 if (!list_empty(&info->send_list)) { 352 if (!list_empty(&info->send_list)) {
@@ -388,7 +390,8 @@ static int recv_list_is_in(struct bat_priv *bat_priv,
388 390
389/* try to add the packet to the vis_hash. return NULL if invalid (e.g. too old, 391/* try to add the packet to the vis_hash. return NULL if invalid (e.g. too old,
390 * broken.. ). vis hash must be locked outside. is_new is set when the packet 392 * broken.. ). vis hash must be locked outside. is_new is set when the packet
391 * is newer than old entries in the hash. */ 393 * is newer than old entries in the hash.
394 */
392static struct vis_info *add_packet(struct bat_priv *bat_priv, 395static struct vis_info *add_packet(struct bat_priv *bat_priv,
393 struct vis_packet *vis_packet, 396 struct vis_packet *vis_packet,
394 int vis_info_len, int *is_new, 397 int vis_info_len, int *is_new,
@@ -500,7 +503,8 @@ void batadv_receive_server_sync_packet(struct bat_priv *bat_priv,
500 goto end; 503 goto end;
501 504
502 /* only if we are server ourselves and packet is newer than the one in 505 /* only if we are server ourselves and packet is newer than the one in
503 * hash.*/ 506 * hash.
507 */
504 if (vis_server == VIS_TYPE_SERVER_SYNC && is_new) 508 if (vis_server == VIS_TYPE_SERVER_SYNC && is_new)
505 send_list_add(bat_priv, info); 509 send_list_add(bat_priv, info);
506end: 510end:
@@ -554,7 +558,8 @@ end:
554/* Walk the originators and find the VIS server with the best tq. Set the packet 558/* Walk the originators and find the VIS server with the best tq. Set the packet
555 * address to its address and return the best_tq. 559 * address to its address and return the best_tq.
556 * 560 *
557 * Must be called with the originator hash locked */ 561 * Must be called with the originator hash locked
562 */
558static int find_best_vis_server(struct bat_priv *bat_priv, 563static int find_best_vis_server(struct bat_priv *bat_priv,
559 struct vis_info *info) 564 struct vis_info *info)
560{ 565{
@@ -605,7 +610,8 @@ static bool vis_packet_full(const struct vis_info *info)
605} 610}
606 611
607/* generates a packet of own vis data, 612/* generates a packet of own vis data,
608 * returns 0 on success, -1 if no packet could be generated */ 613 * returns 0 on success, -1 if no packet could be generated
614 */
609static int generate_vis_packet(struct bat_priv *bat_priv) 615static int generate_vis_packet(struct bat_priv *bat_priv)
610{ 616{
611 struct hashtable_t *hash = bat_priv->orig_hash; 617 struct hashtable_t *hash = bat_priv->orig_hash;
@@ -703,7 +709,8 @@ unlock:
703} 709}
704 710
705/* free old vis packets. Must be called with this vis_hash_lock 711/* free old vis packets. Must be called with this vis_hash_lock
706 * held */ 712 * held
713 */
707static void purge_vis_packets(struct bat_priv *bat_priv) 714static void purge_vis_packets(struct bat_priv *bat_priv)
708{ 715{
709 uint32_t i; 716 uint32_t i;
@@ -762,7 +769,8 @@ static void broadcast_vis_packet(struct bat_priv *bat_priv,
762 continue; 769 continue;
763 770
764 /* don't send it if we already received the packet from 771 /* don't send it if we already received the packet from
765 * this node. */ 772 * this node.
773 */
766 if (recv_list_is_in(bat_priv, &info->recv_list, 774 if (recv_list_is_in(bat_priv, &info->recv_list,
767 orig_node->orig)) { 775 orig_node->orig)) {
768 batadv_neigh_node_free_ref(router); 776 batadv_neigh_node_free_ref(router);
@@ -879,7 +887,8 @@ static void send_vis_packets(struct work_struct *work)
879} 887}
880 888
881/* init the vis server. this may only be called when if_list is already 889/* init the vis server. this may only be called when if_list is already
882 * initialized (e.g. bat0 is initialized, interfaces have been added) */ 890 * initialized (e.g. bat0 is initialized, interfaces have been added)
891 */
883int batadv_vis_init(struct bat_priv *bat_priv) 892int batadv_vis_init(struct bat_priv *bat_priv)
884{ 893{
885 struct vis_packet *packet; 894 struct vis_packet *packet;