Lines Matching full:hash
44 /** @list_locks: spinlock for each hash list entry */
54 /* allocates and clears the hash */
58 void batadv_hash_set_lock_class(struct batadv_hashtable *hash,
61 /* free only the hashtable and the hash itself. */
62 void batadv_hash_destroy(struct batadv_hashtable *hash);
66 * @hash: storage hash table
67 * @compare: callback to determine if 2 hash elements are identical
68 * @choose: callback calculating the hash index
72 * Return: 0 on success, 1 if the element already is in the hash
75 static inline int batadv_hash_add(struct batadv_hashtable *hash, in batadv_hash_add() argument
87 if (!hash) in batadv_hash_add()
90 index = choose(data, hash->size); in batadv_hash_add()
91 head = &hash->table[index]; in batadv_hash_add()
92 list_lock = &hash->list_locks[index]; in batadv_hash_add()
106 atomic_inc(&hash->generation); in batadv_hash_add()
117 * batadv_hash_remove() - Removes data from hash, if found
118 * @hash: hash table
119 * @compare: callback to determine if 2 hash elements are identical
120 * @choose: callback calculating the hash index
129 static inline void *batadv_hash_remove(struct batadv_hashtable *hash, in batadv_hash_remove() argument
139 index = choose(data, hash->size); in batadv_hash_remove()
140 head = &hash->table[index]; in batadv_hash_remove()
142 spin_lock_bh(&hash->list_locks[index]); in batadv_hash_remove()
149 atomic_inc(&hash->generation); in batadv_hash_remove()
152 spin_unlock_bh(&hash->list_locks[index]); in batadv_hash_remove()