diff options
author | Antonio Quartulli <ordex@autistici.org> | 2011-10-30 07:17:33 -0400 |
---|---|---|
committer | Sven Eckelmann <sven@narfation.org> | 2011-11-20 07:08:35 -0500 |
commit | 48100bac89a6161ca53dd65697fe635f77986686 (patch) | |
tree | 369c12a754d2771d1b1fcc11a258b4e9de6567bd /net/batman-adv/vis.c | |
parent | ad24431277fc92717084d5b4c451e15982588206 (diff) |
batman-adv: create a common substructure for tt_global/local_entry
Several functions in the translation table management code assume that the
tt_global_entry and tt_local_entry structures have the same initial fields such
as 'addr' and 'hash_entry'. To improve the code readability and to avoid
mistakes in later changes, a common substructure that substitute the shared
fields has been introduced (struct tt_common_entry).
Thanks to this modification, it has also been possible to slightly reduce the
code length by merging some functions like compare_ltt/gtt() and
tt_local/global_hash_find()
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Diffstat (limited to 'net/batman-adv/vis.c')
-rw-r--r-- | net/batman-adv/vis.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/net/batman-adv/vis.c b/net/batman-adv/vis.c index 7445413253ca..cc3b9f2f3b5d 100644 --- a/net/batman-adv/vis.c +++ b/net/batman-adv/vis.c | |||
@@ -609,7 +609,7 @@ static int generate_vis_packet(struct bat_priv *bat_priv) | |||
609 | struct vis_info *info = bat_priv->my_vis_info; | 609 | struct vis_info *info = bat_priv->my_vis_info; |
610 | struct vis_packet *packet = (struct vis_packet *)info->skb_packet->data; | 610 | struct vis_packet *packet = (struct vis_packet *)info->skb_packet->data; |
611 | struct vis_info_entry *entry; | 611 | struct vis_info_entry *entry; |
612 | struct tt_local_entry *tt_local_entry; | 612 | struct tt_common_entry *tt_common_entry; |
613 | int best_tq = -1; | 613 | int best_tq = -1; |
614 | uint32_t i; | 614 | uint32_t i; |
615 | 615 | ||
@@ -672,13 +672,13 @@ next: | |||
672 | head = &hash->table[i]; | 672 | head = &hash->table[i]; |
673 | 673 | ||
674 | rcu_read_lock(); | 674 | rcu_read_lock(); |
675 | hlist_for_each_entry_rcu(tt_local_entry, node, head, | 675 | hlist_for_each_entry_rcu(tt_common_entry, node, head, |
676 | hash_entry) { | 676 | hash_entry) { |
677 | entry = (struct vis_info_entry *) | 677 | entry = (struct vis_info_entry *) |
678 | skb_put(info->skb_packet, | 678 | skb_put(info->skb_packet, |
679 | sizeof(*entry)); | 679 | sizeof(*entry)); |
680 | memset(entry->src, 0, ETH_ALEN); | 680 | memset(entry->src, 0, ETH_ALEN); |
681 | memcpy(entry->dest, tt_local_entry->addr, ETH_ALEN); | 681 | memcpy(entry->dest, tt_common_entry->addr, ETH_ALEN); |
682 | entry->quality = 0; /* 0 means TT */ | 682 | entry->quality = 0; /* 0 means TT */ |
683 | packet->entries++; | 683 | packet->entries++; |
684 | 684 | ||