From 5bf74e9ca1e618afe5a513f64ee4923115e67004 Mon Sep 17 00:00:00 2001 From: Sven Eckelmann Date: Tue, 5 Jun 2012 22:31:28 +0200 Subject: batman-adv: Prefix hash struct and typedef with batadv_ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reported-by: Martin Hundebøll Signed-off-by: Sven Eckelmann --- net/batman-adv/hash.h | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) (limited to 'net/batman-adv/hash.h') diff --git a/net/batman-adv/hash.h b/net/batman-adv/hash.h index 7ec4e5b0bd4..83990e318e4 100644 --- a/net/batman-adv/hash.h +++ b/net/batman-adv/hash.h @@ -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; @@ -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) { @@ -134,9 +136,10 @@ out: * 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; -- cgit v1.2.3-18-g5258