summaryrefslogtreecommitdiff
path: root/net/batman-adv/hash.h
diff options
context:
space:
mode:
authorSven Eckelmann <sven@narfation.org>2012-06-05 22:31:28 +0200
committerAntonio Quartulli <ordex@autistici.org>2012-07-01 22:47:20 +0200
commit5bf74e9ca1e618afe5a513f64ee4923115e67004 (patch)
tree6534af43c249344deaf881006b27240fb77ee4c2 /net/batman-adv/hash.h
parent7f223c0c323a9ac2e88714669994007776e966a8 (diff)
downloadlwn-5bf74e9ca1e618afe5a513f64ee4923115e67004.tar.gz
lwn-5bf74e9ca1e618afe5a513f64ee4923115e67004.zip
batman-adv: Prefix hash struct and typedef with batadv_
Reported-by: Martin Hundebøll <martin@hundeboll.net> Signed-off-by: Sven Eckelmann <sven@narfation.org>
Diffstat (limited to 'net/batman-adv/hash.h')
-rw-r--r--net/batman-adv/hash.h33
1 files changed, 18 insertions, 15 deletions
diff --git a/net/batman-adv/hash.h b/net/batman-adv/hash.h
index 7ec4e5b0bd41..83990e318e43 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;