Lines Matching refs: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,
87 if (!hash)
90 index = choose(data, hash->size);
91 head = &hash->table[index];
92 list_lock = &hash->list_locks[index];
106 atomic_inc(&hash->generation);
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,
139 index = choose(data, hash->size);
140 head = &hash->table[index];
142 spin_lock_bh(&hash->list_locks[index]);
149 atomic_inc(&hash->generation);
152 spin_unlock_bh(&hash->list_locks[index]);