diff options
author | Sven Eckelmann <sven.eckelmann@gmx.de> | 2010-11-21 23:56:00 (GMT) |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-11-29 19:09:13 (GMT) |
commit | bd204952cf161404eae0aa6478fb1b4c586ac678 (patch) | |
tree | 66042f5b26236aacceeaa693a95d6478666ead68 /drivers/staging/batman-adv/routing.c | |
parent | a3238c3b379146a2d480dfee4c7f76c4692d7466 (diff) | |
download | linux-fsl-qoriq-bd204952cf161404eae0aa6478fb1b4c586ac678.tar.xz |
Staging: batman-adv: Rewrite hash using hlist_*
The hash implementation is a complete implementation of a hash using
buckets as hash entries and overflow buckets attached to them.
The kernel already provides datastructures hlist_head and hlist_node
which can be used to implement an hash using lists as hash buckets. So
it is better to implement heavily used functionality on top of those
instead of providing a full hash implementation.
The rewrite changes the behavior of some functions slightly:
* hash_add add elements to the front instead of the tail
* hash_iterate doesn't provide pointer to access bucket->data directly,
but it can be accessed using hlist_entry
Reported-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/batman-adv/routing.c')
-rw-r--r-- | drivers/staging/batman-adv/routing.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/staging/batman-adv/routing.c b/drivers/staging/batman-adv/routing.c index 9cbb195..77e5d14 100644 --- a/drivers/staging/batman-adv/routing.c +++ b/drivers/staging/batman-adv/routing.c @@ -38,6 +38,7 @@ void slide_own_bcast_window(struct batman_if *batman_if) { struct bat_priv *bat_priv = netdev_priv(batman_if->soft_iface); HASHIT(hashit); + struct element_t *bucket; struct orig_node *orig_node; TYPE_OF_WORD *word; unsigned long flags; @@ -45,7 +46,8 @@ void slide_own_bcast_window(struct batman_if *batman_if) spin_lock_irqsave(&bat_priv->orig_hash_lock, flags); while (hash_iterate(bat_priv->orig_hash, &hashit)) { - orig_node = hashit.bucket->data; + bucket = hlist_entry(hashit.walk, struct element_t, hlist); + orig_node = bucket->data; word = &(orig_node->bcast_own[batman_if->if_num * NUM_WORDS]); bit_get_packet(bat_priv, word, 1, 0); |