batman-adv: Prefix hash struct and typedef with batadv_
[deliverable/linux.git] / net / batman-adv / hash.c
index 117687bedf25e2a7a68da42ed2c8fe82c011cb1e..0759c707e974f640420f732f56422fc2ebb0fbe5 100644 (file)
@@ -1,5 +1,4 @@
-/*
- * Copyright (C) 2006-2012 B.A.T.M.A.N. contributors:
+/* Copyright (C) 2006-2012 B.A.T.M.A.N. contributors:
  *
  * Simon Wunderlich, Marek Lindner
  *
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  * 02110-1301, USA
- *
  */
 
 #include "main.h"
 #include "hash.h"
 
 /* clears the hash */
-static void hash_init(struct hashtable_t *hash)
+static void batadv_hash_init(struct batadv_hashtable *hash)
 {
        uint32_t i;
 
@@ -34,7 +32,7 @@ static void hash_init(struct hashtable_t *hash)
 }
 
 /* free only the hashtable and the hash itself. */
-void hash_destroy(struct hashtable_t *hash)
+void batadv_hash_destroy(struct batadv_hashtable *hash)
 {
        kfree(hash->list_locks);
        kfree(hash->table);
@@ -42,9 +40,9 @@ void hash_destroy(struct hashtable_t *hash)
 }
 
 /* allocates and clears the hash */
-struct hashtable_t *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)
@@ -60,7 +58,7 @@ struct hashtable_t *hash_new(uint32_t size)
                goto free_table;
 
        hash->size = size;
-       hash_init(hash);
+       batadv_hash_init(hash);
        return hash;
 
 free_table:
@@ -69,3 +67,12 @@ free_hash:
        kfree(hash);
        return NULL;
 }
+
+void batadv_hash_set_lock_class(struct batadv_hashtable *hash,
+                               struct lock_class_key *key)
+{
+       uint32_t i;
+
+       for (i = 0; i < hash->size; i++)
+               lockdep_set_class(&hash->list_locks[i], key);
+}
This page took 0.088381 seconds and 5 git commands to generate.