Loading net/batman-adv/bridge_loop_avoidance.c +10 −10 Original line number Diff line number Diff line Loading @@ -133,7 +133,7 @@ static void batadv_claim_free_ref(struct claim *claim) static struct claim *batadv_claim_hash_find(struct bat_priv *bat_priv, struct claim *data) { struct hashtable_t *hash = bat_priv->claim_hash; struct batadv_hashtable *hash = bat_priv->claim_hash; struct hlist_head *head; struct hlist_node *node; struct claim *claim; Loading Loading @@ -172,7 +172,7 @@ static struct claim *batadv_claim_hash_find(struct bat_priv *bat_priv, static struct backbone_gw *batadv_backbone_hash_find(struct bat_priv *bat_priv, uint8_t *addr, short vid) { struct hashtable_t *hash = bat_priv->backbone_hash; struct batadv_hashtable *hash = bat_priv->backbone_hash; struct hlist_head *head; struct hlist_node *node; struct backbone_gw search_entry, *backbone_gw; Loading Loading @@ -208,7 +208,7 @@ static struct backbone_gw *batadv_backbone_hash_find(struct bat_priv *bat_priv, /* delete all claims for a backbone */ static void batadv_bla_del_backbone_claims(struct backbone_gw *backbone_gw) { struct hashtable_t *hash; struct batadv_hashtable *hash; struct hlist_node *node, *node_tmp; struct hlist_head *head; struct claim *claim; Loading Loading @@ -434,7 +434,7 @@ static void batadv_bla_answer_request(struct bat_priv *bat_priv, { struct hlist_node *node; struct hlist_head *head; struct hashtable_t *hash; struct batadv_hashtable *hash; struct claim *claim; struct backbone_gw *backbone_gw; int i; Loading Loading @@ -931,7 +931,7 @@ static void batadv_bla_purge_backbone_gw(struct bat_priv *bat_priv, int now) struct backbone_gw *backbone_gw; struct hlist_node *node, *node_tmp; struct hlist_head *head; struct hashtable_t *hash; struct batadv_hashtable *hash; spinlock_t *list_lock; /* protects write access to the hash lists */ int i; Loading Loading @@ -983,7 +983,7 @@ static void batadv_bla_purge_claims(struct bat_priv *bat_priv, struct claim *claim; struct hlist_node *node; struct hlist_head *head; struct hashtable_t *hash; struct batadv_hashtable *hash; int i; hash = bat_priv->claim_hash; Loading Loading @@ -1030,7 +1030,7 @@ void batadv_bla_update_orig_address(struct bat_priv *bat_priv, struct backbone_gw *backbone_gw; struct hlist_node *node; struct hlist_head *head; struct hashtable_t *hash; struct batadv_hashtable *hash; int i; /* reset bridge loop avoidance group id */ Loading Loading @@ -1091,7 +1091,7 @@ static void batadv_bla_periodic_work(struct work_struct *work) struct hlist_node *node; struct hlist_head *head; struct backbone_gw *backbone_gw; struct hashtable_t *hash; struct batadv_hashtable *hash; struct hard_iface *primary_if; int i; Loading Loading @@ -1262,7 +1262,7 @@ int batadv_bla_check_bcast_duplist(struct bat_priv *bat_priv, */ int batadv_bla_is_backbone_gw_orig(struct bat_priv *bat_priv, uint8_t *orig) { struct hashtable_t *hash = bat_priv->backbone_hash; struct batadv_hashtable *hash = bat_priv->backbone_hash; struct hlist_head *head; struct hlist_node *node; struct backbone_gw *backbone_gw; Loading Loading @@ -1534,7 +1534,7 @@ int batadv_bla_claim_table_seq_print_text(struct seq_file *seq, void *offset) { struct net_device *net_dev = (struct net_device *)seq->private; struct bat_priv *bat_priv = netdev_priv(net_dev); struct hashtable_t *hash = bat_priv->claim_hash; struct batadv_hashtable *hash = bat_priv->claim_hash; struct claim *claim; struct hard_iface *primary_if; struct hlist_node *node; Loading net/batman-adv/hash.c +5 −5 Original line number Diff line number Diff line Loading @@ -21,7 +21,7 @@ #include "hash.h" /* clears the hash */ static void batadv_hash_init(struct hashtable_t *hash) static void batadv_hash_init(struct batadv_hashtable *hash) { uint32_t i; Loading @@ -32,7 +32,7 @@ static void batadv_hash_init(struct hashtable_t *hash) } /* free only the hashtable and the hash itself. */ void batadv_hash_destroy(struct hashtable_t *hash) void batadv_hash_destroy(struct batadv_hashtable *hash) { kfree(hash->list_locks); kfree(hash->table); Loading @@ -40,9 +40,9 @@ void batadv_hash_destroy(struct hashtable_t *hash) } /* allocates and clears the hash */ struct hashtable_t *batadv_hash_new(uint32_t size) struct batadv_hashtable *batadv_hash_new(uint32_t size) { struct hashtable_t *hash; struct batadv_hashtable *hash; hash = kmalloc(sizeof(*hash), GFP_ATOMIC); if (!hash) Loading @@ -68,7 +68,7 @@ struct hashtable_t *batadv_hash_new(uint32_t size) return NULL; } void batadv_hash_set_lock_class(struct hashtable_t *hash, void batadv_hash_set_lock_class(struct batadv_hashtable *hash, struct lock_class_key *key) { uint32_t i; Loading net/batman-adv/hash.h +18 −15 Original line number Diff line number Diff line Loading @@ -25,37 +25,39 @@ /* callback to a compare function. should compare 2 element datas for their * keys, return 0 if same and not 0 if not same */ typedef int (*hashdata_compare_cb)(const struct hlist_node *, const void *); typedef int (*batadv_hashdata_compare_cb)(const struct hlist_node *, const void *); /* the hashfunction, should return an index * based on the key in the data of the first * argument and the size the second */ typedef uint32_t (*hashdata_choose_cb)(const void *, uint32_t); typedef void (*hashdata_free_cb)(struct hlist_node *, void *); typedef uint32_t (*batadv_hashdata_choose_cb)(const void *, uint32_t); typedef void (*batadv_hashdata_free_cb)(struct hlist_node *, void *); struct hashtable_t { struct batadv_hashtable { struct hlist_head *table; /* the hashtable itself with the buckets */ spinlock_t *list_locks; /* spinlock for each hash list entry */ uint32_t size; /* size of hashtable */ }; /* allocates and clears the hash */ struct hashtable_t *batadv_hash_new(uint32_t size); struct batadv_hashtable *batadv_hash_new(uint32_t size); /* set class key for all locks */ void batadv_hash_set_lock_class(struct hashtable_t *hash, void batadv_hash_set_lock_class(struct batadv_hashtable *hash, struct lock_class_key *key); /* free only the hashtable and the hash itself. */ void batadv_hash_destroy(struct hashtable_t *hash); void batadv_hash_destroy(struct batadv_hashtable *hash); /* remove the hash structure. if hashdata_free_cb != NULL, this function will be * called to remove the elements inside of the hash. if you don't remove the * elements, memory might be leaked. */ static inline void batadv_hash_delete(struct hashtable_t *hash, hashdata_free_cb free_cb, void *arg) static inline void batadv_hash_delete(struct batadv_hashtable *hash, batadv_hashdata_free_cb free_cb, void *arg) { struct hlist_head *head; struct hlist_node *node, *node_tmp; Loading Loading @@ -89,9 +91,9 @@ static inline void batadv_hash_delete(struct hashtable_t *hash, * Returns 0 on success, 1 if the element already is in the hash * and -1 on error. */ static inline int batadv_hash_add(struct hashtable_t *hash, hashdata_compare_cb compare, hashdata_choose_cb choose, static inline int batadv_hash_add(struct batadv_hashtable *hash, batadv_hashdata_compare_cb compare, batadv_hashdata_choose_cb choose, const void *data, struct hlist_node *data_node) { Loading Loading @@ -134,9 +136,10 @@ static inline int batadv_hash_add(struct hashtable_t *hash, * structure you use with just the key filled, we just need the key for * comparing. */ static inline void *batadv_hash_remove(struct hashtable_t *hash, hashdata_compare_cb compare, hashdata_choose_cb choose, void *data) static inline void *batadv_hash_remove(struct batadv_hashtable *hash, batadv_hashdata_compare_cb compare, batadv_hashdata_choose_cb choose, void *data) { uint32_t index; struct hlist_node *node; Loading net/batman-adv/originator.c +5 −5 Original line number Diff line number Diff line Loading @@ -154,7 +154,7 @@ void batadv_orig_node_free_ref(struct orig_node *orig_node) void batadv_originator_free(struct bat_priv *bat_priv) { struct hashtable_t *hash = bat_priv->orig_hash; struct batadv_hashtable *hash = bat_priv->orig_hash; struct hlist_node *node, *node_tmp; struct hlist_head *head; spinlock_t *list_lock; /* spinlock to protect write access */ Loading Loading @@ -343,7 +343,7 @@ static bool batadv_purge_orig_node(struct bat_priv *bat_priv, static void _batadv_purge_orig(struct bat_priv *bat_priv) { struct hashtable_t *hash = bat_priv->orig_hash; struct batadv_hashtable *hash = bat_priv->orig_hash; struct hlist_node *node, *node_tmp; struct hlist_head *head; spinlock_t *list_lock; /* spinlock to protect write access */ Loading Loading @@ -401,7 +401,7 @@ int batadv_orig_seq_print_text(struct seq_file *seq, void *offset) { struct net_device *net_dev = (struct net_device *)seq->private; struct bat_priv *bat_priv = netdev_priv(net_dev); struct hashtable_t *hash = bat_priv->orig_hash; struct batadv_hashtable *hash = bat_priv->orig_hash; struct hlist_node *node, *node_tmp; struct hlist_head *head; struct hard_iface *primary_if; Loading Loading @@ -514,7 +514,7 @@ static int batadv_orig_node_add_if(struct orig_node *orig_node, int max_if_num) int batadv_orig_hash_add_if(struct hard_iface *hard_iface, int max_if_num) { struct bat_priv *bat_priv = netdev_priv(hard_iface->soft_iface); struct hashtable_t *hash = bat_priv->orig_hash; struct batadv_hashtable *hash = bat_priv->orig_hash; struct hlist_node *node; struct hlist_head *head; struct orig_node *orig_node; Loading Loading @@ -597,7 +597,7 @@ static int batadv_orig_node_del_if(struct orig_node *orig_node, int batadv_orig_hash_del_if(struct hard_iface *hard_iface, int max_if_num) { struct bat_priv *bat_priv = netdev_priv(hard_iface->soft_iface); struct hashtable_t *hash = bat_priv->orig_hash; struct batadv_hashtable *hash = bat_priv->orig_hash; struct hlist_node *node; struct hlist_head *head; struct hard_iface *hard_iface_tmp; Loading net/batman-adv/originator.h +1 −1 Original line number Diff line number Diff line Loading @@ -63,7 +63,7 @@ static inline uint32_t batadv_choose_orig(const void *data, uint32_t size) static inline struct orig_node *batadv_orig_hash_find(struct bat_priv *bat_priv, const void *data) { struct hashtable_t *hash = bat_priv->orig_hash; struct batadv_hashtable *hash = bat_priv->orig_hash; struct hlist_head *head; struct hlist_node *node; struct orig_node *orig_node, *orig_node_tmp = NULL; Loading Loading
net/batman-adv/bridge_loop_avoidance.c +10 −10 Original line number Diff line number Diff line Loading @@ -133,7 +133,7 @@ static void batadv_claim_free_ref(struct claim *claim) static struct claim *batadv_claim_hash_find(struct bat_priv *bat_priv, struct claim *data) { struct hashtable_t *hash = bat_priv->claim_hash; struct batadv_hashtable *hash = bat_priv->claim_hash; struct hlist_head *head; struct hlist_node *node; struct claim *claim; Loading Loading @@ -172,7 +172,7 @@ static struct claim *batadv_claim_hash_find(struct bat_priv *bat_priv, static struct backbone_gw *batadv_backbone_hash_find(struct bat_priv *bat_priv, uint8_t *addr, short vid) { struct hashtable_t *hash = bat_priv->backbone_hash; struct batadv_hashtable *hash = bat_priv->backbone_hash; struct hlist_head *head; struct hlist_node *node; struct backbone_gw search_entry, *backbone_gw; Loading Loading @@ -208,7 +208,7 @@ static struct backbone_gw *batadv_backbone_hash_find(struct bat_priv *bat_priv, /* delete all claims for a backbone */ static void batadv_bla_del_backbone_claims(struct backbone_gw *backbone_gw) { struct hashtable_t *hash; struct batadv_hashtable *hash; struct hlist_node *node, *node_tmp; struct hlist_head *head; struct claim *claim; Loading Loading @@ -434,7 +434,7 @@ static void batadv_bla_answer_request(struct bat_priv *bat_priv, { struct hlist_node *node; struct hlist_head *head; struct hashtable_t *hash; struct batadv_hashtable *hash; struct claim *claim; struct backbone_gw *backbone_gw; int i; Loading Loading @@ -931,7 +931,7 @@ static void batadv_bla_purge_backbone_gw(struct bat_priv *bat_priv, int now) struct backbone_gw *backbone_gw; struct hlist_node *node, *node_tmp; struct hlist_head *head; struct hashtable_t *hash; struct batadv_hashtable *hash; spinlock_t *list_lock; /* protects write access to the hash lists */ int i; Loading Loading @@ -983,7 +983,7 @@ static void batadv_bla_purge_claims(struct bat_priv *bat_priv, struct claim *claim; struct hlist_node *node; struct hlist_head *head; struct hashtable_t *hash; struct batadv_hashtable *hash; int i; hash = bat_priv->claim_hash; Loading Loading @@ -1030,7 +1030,7 @@ void batadv_bla_update_orig_address(struct bat_priv *bat_priv, struct backbone_gw *backbone_gw; struct hlist_node *node; struct hlist_head *head; struct hashtable_t *hash; struct batadv_hashtable *hash; int i; /* reset bridge loop avoidance group id */ Loading Loading @@ -1091,7 +1091,7 @@ static void batadv_bla_periodic_work(struct work_struct *work) struct hlist_node *node; struct hlist_head *head; struct backbone_gw *backbone_gw; struct hashtable_t *hash; struct batadv_hashtable *hash; struct hard_iface *primary_if; int i; Loading Loading @@ -1262,7 +1262,7 @@ int batadv_bla_check_bcast_duplist(struct bat_priv *bat_priv, */ int batadv_bla_is_backbone_gw_orig(struct bat_priv *bat_priv, uint8_t *orig) { struct hashtable_t *hash = bat_priv->backbone_hash; struct batadv_hashtable *hash = bat_priv->backbone_hash; struct hlist_head *head; struct hlist_node *node; struct backbone_gw *backbone_gw; Loading Loading @@ -1534,7 +1534,7 @@ int batadv_bla_claim_table_seq_print_text(struct seq_file *seq, void *offset) { struct net_device *net_dev = (struct net_device *)seq->private; struct bat_priv *bat_priv = netdev_priv(net_dev); struct hashtable_t *hash = bat_priv->claim_hash; struct batadv_hashtable *hash = bat_priv->claim_hash; struct claim *claim; struct hard_iface *primary_if; struct hlist_node *node; Loading
net/batman-adv/hash.c +5 −5 Original line number Diff line number Diff line Loading @@ -21,7 +21,7 @@ #include "hash.h" /* clears the hash */ static void batadv_hash_init(struct hashtable_t *hash) static void batadv_hash_init(struct batadv_hashtable *hash) { uint32_t i; Loading @@ -32,7 +32,7 @@ static void batadv_hash_init(struct hashtable_t *hash) } /* free only the hashtable and the hash itself. */ void batadv_hash_destroy(struct hashtable_t *hash) void batadv_hash_destroy(struct batadv_hashtable *hash) { kfree(hash->list_locks); kfree(hash->table); Loading @@ -40,9 +40,9 @@ void batadv_hash_destroy(struct hashtable_t *hash) } /* allocates and clears the hash */ struct hashtable_t *batadv_hash_new(uint32_t size) struct batadv_hashtable *batadv_hash_new(uint32_t size) { struct hashtable_t *hash; struct batadv_hashtable *hash; hash = kmalloc(sizeof(*hash), GFP_ATOMIC); if (!hash) Loading @@ -68,7 +68,7 @@ struct hashtable_t *batadv_hash_new(uint32_t size) return NULL; } void batadv_hash_set_lock_class(struct hashtable_t *hash, void batadv_hash_set_lock_class(struct batadv_hashtable *hash, struct lock_class_key *key) { uint32_t i; Loading
net/batman-adv/hash.h +18 −15 Original line number Diff line number Diff line Loading @@ -25,37 +25,39 @@ /* callback to a compare function. should compare 2 element datas for their * keys, return 0 if same and not 0 if not same */ typedef int (*hashdata_compare_cb)(const struct hlist_node *, const void *); typedef int (*batadv_hashdata_compare_cb)(const struct hlist_node *, const void *); /* the hashfunction, should return an index * based on the key in the data of the first * argument and the size the second */ typedef uint32_t (*hashdata_choose_cb)(const void *, uint32_t); typedef void (*hashdata_free_cb)(struct hlist_node *, void *); typedef uint32_t (*batadv_hashdata_choose_cb)(const void *, uint32_t); typedef void (*batadv_hashdata_free_cb)(struct hlist_node *, void *); struct hashtable_t { struct batadv_hashtable { struct hlist_head *table; /* the hashtable itself with the buckets */ spinlock_t *list_locks; /* spinlock for each hash list entry */ uint32_t size; /* size of hashtable */ }; /* allocates and clears the hash */ struct hashtable_t *batadv_hash_new(uint32_t size); struct batadv_hashtable *batadv_hash_new(uint32_t size); /* set class key for all locks */ void batadv_hash_set_lock_class(struct hashtable_t *hash, void batadv_hash_set_lock_class(struct batadv_hashtable *hash, struct lock_class_key *key); /* free only the hashtable and the hash itself. */ void batadv_hash_destroy(struct hashtable_t *hash); void batadv_hash_destroy(struct batadv_hashtable *hash); /* remove the hash structure. if hashdata_free_cb != NULL, this function will be * called to remove the elements inside of the hash. if you don't remove the * elements, memory might be leaked. */ static inline void batadv_hash_delete(struct hashtable_t *hash, hashdata_free_cb free_cb, void *arg) static inline void batadv_hash_delete(struct batadv_hashtable *hash, batadv_hashdata_free_cb free_cb, void *arg) { struct hlist_head *head; struct hlist_node *node, *node_tmp; Loading Loading @@ -89,9 +91,9 @@ static inline void batadv_hash_delete(struct hashtable_t *hash, * Returns 0 on success, 1 if the element already is in the hash * and -1 on error. */ static inline int batadv_hash_add(struct hashtable_t *hash, hashdata_compare_cb compare, hashdata_choose_cb choose, static inline int batadv_hash_add(struct batadv_hashtable *hash, batadv_hashdata_compare_cb compare, batadv_hashdata_choose_cb choose, const void *data, struct hlist_node *data_node) { Loading Loading @@ -134,9 +136,10 @@ static inline int batadv_hash_add(struct hashtable_t *hash, * structure you use with just the key filled, we just need the key for * comparing. */ static inline void *batadv_hash_remove(struct hashtable_t *hash, hashdata_compare_cb compare, hashdata_choose_cb choose, void *data) static inline void *batadv_hash_remove(struct batadv_hashtable *hash, batadv_hashdata_compare_cb compare, batadv_hashdata_choose_cb choose, void *data) { uint32_t index; struct hlist_node *node; Loading
net/batman-adv/originator.c +5 −5 Original line number Diff line number Diff line Loading @@ -154,7 +154,7 @@ void batadv_orig_node_free_ref(struct orig_node *orig_node) void batadv_originator_free(struct bat_priv *bat_priv) { struct hashtable_t *hash = bat_priv->orig_hash; struct batadv_hashtable *hash = bat_priv->orig_hash; struct hlist_node *node, *node_tmp; struct hlist_head *head; spinlock_t *list_lock; /* spinlock to protect write access */ Loading Loading @@ -343,7 +343,7 @@ static bool batadv_purge_orig_node(struct bat_priv *bat_priv, static void _batadv_purge_orig(struct bat_priv *bat_priv) { struct hashtable_t *hash = bat_priv->orig_hash; struct batadv_hashtable *hash = bat_priv->orig_hash; struct hlist_node *node, *node_tmp; struct hlist_head *head; spinlock_t *list_lock; /* spinlock to protect write access */ Loading Loading @@ -401,7 +401,7 @@ int batadv_orig_seq_print_text(struct seq_file *seq, void *offset) { struct net_device *net_dev = (struct net_device *)seq->private; struct bat_priv *bat_priv = netdev_priv(net_dev); struct hashtable_t *hash = bat_priv->orig_hash; struct batadv_hashtable *hash = bat_priv->orig_hash; struct hlist_node *node, *node_tmp; struct hlist_head *head; struct hard_iface *primary_if; Loading Loading @@ -514,7 +514,7 @@ static int batadv_orig_node_add_if(struct orig_node *orig_node, int max_if_num) int batadv_orig_hash_add_if(struct hard_iface *hard_iface, int max_if_num) { struct bat_priv *bat_priv = netdev_priv(hard_iface->soft_iface); struct hashtable_t *hash = bat_priv->orig_hash; struct batadv_hashtable *hash = bat_priv->orig_hash; struct hlist_node *node; struct hlist_head *head; struct orig_node *orig_node; Loading Loading @@ -597,7 +597,7 @@ static int batadv_orig_node_del_if(struct orig_node *orig_node, int batadv_orig_hash_del_if(struct hard_iface *hard_iface, int max_if_num) { struct bat_priv *bat_priv = netdev_priv(hard_iface->soft_iface); struct hashtable_t *hash = bat_priv->orig_hash; struct batadv_hashtable *hash = bat_priv->orig_hash; struct hlist_node *node; struct hlist_head *head; struct hard_iface *hard_iface_tmp; Loading
net/batman-adv/originator.h +1 −1 Original line number Diff line number Diff line Loading @@ -63,7 +63,7 @@ static inline uint32_t batadv_choose_orig(const void *data, uint32_t size) static inline struct orig_node *batadv_orig_hash_find(struct bat_priv *bat_priv, const void *data) { struct hashtable_t *hash = bat_priv->orig_hash; struct batadv_hashtable *hash = bat_priv->orig_hash; struct hlist_head *head; struct hlist_node *node; struct orig_node *orig_node, *orig_node_tmp = NULL; Loading