aboutsummaryrefslogtreecommitdiffstats
path: root/net/batman-adv/hash.h
diff options
context:
space:
mode:
authorSven Eckelmann <sven@narfation.org>2012-05-11 20:09:43 -0400
committerAntonio Quartulli <ordex@autistici.org>2012-06-20 16:15:33 -0400
commit9cfc7bd608b97463993b4f3e4775d99022253f8d (patch)
treefcfcf1e714a91943a740dcaa2744ee66448f9f73 /net/batman-adv/hash.h
parent3193e8fdfa355289892661d206d1954114a7be95 (diff)
batman-adv: Reformat multiline comments to consistent style
batman-adv doesn't follow the style for multiline comments that David S. Miller prefers. All comments should be reformatted to follow this consistent style to make the code slightly more readable. Signed-off-by: Sven Eckelmann <sven@narfation.org>
Diffstat (limited to 'net/batman-adv/hash.h')
-rw-r--r--net/batman-adv/hash.h24
1 files changed, 11 insertions, 13 deletions
diff --git a/net/batman-adv/hash.h b/net/batman-adv/hash.h
index e75df6be4f22..eba8f2a55ccc 100644
--- a/net/batman-adv/hash.h
+++ b/net/batman-adv/hash.h
@@ -1,5 +1,4 @@
1/* 1/* Copyright (C) 2006-2012 B.A.T.M.A.N. contributors:
2 * Copyright (C) 2006-2012 B.A.T.M.A.N. contributors:
3 * 2 *
4 * Simon Wunderlich, Marek Lindner 3 * Simon Wunderlich, Marek Lindner
5 * 4 *
@@ -16,7 +15,6 @@
16 * along with this program; if not, write to the Free Software 15 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 * 02110-1301, USA 17 * 02110-1301, USA
19 *
20 */ 18 */
21 19
22#ifndef _NET_BATMAN_ADV_HASH_H_ 20#ifndef _NET_BATMAN_ADV_HASH_H_
@@ -24,15 +22,15 @@
24 22
25#include <linux/list.h> 23#include <linux/list.h>
26 24
27/* callback to a compare function. should 25/* callback to a compare function. should compare 2 element datas for their
28 * compare 2 element datas for their keys, 26 * keys, return 0 if same and not 0 if not same
29 * return 0 if same and not 0 if not 27 */
30 * same */
31typedef int (*hashdata_compare_cb)(const struct hlist_node *, const void *); 28typedef int (*hashdata_compare_cb)(const struct hlist_node *, const void *);
32 29
33/* the hashfunction, should return an index 30/* the hashfunction, should return an index
34 * based on the key in the data of the first 31 * based on the key in the data of the first
35 * argument and the size the second */ 32 * argument and the size the second
33 */
36typedef uint32_t (*hashdata_choose_cb)(const void *, uint32_t); 34typedef uint32_t (*hashdata_choose_cb)(const void *, uint32_t);
37typedef void (*hashdata_free_cb)(struct hlist_node *, void *); 35typedef void (*hashdata_free_cb)(struct hlist_node *, void *);
38 36
@@ -54,7 +52,8 @@ void batadv_hash_destroy(struct hashtable_t *hash);
54 52
55/* remove the hash structure. if hashdata_free_cb != NULL, this function will be 53/* remove the hash structure. if hashdata_free_cb != NULL, this function will be
56 * called to remove the elements inside of the hash. if you don't remove the 54 * called to remove the elements inside of the hash. if you don't remove the
57 * elements, memory might be leaked. */ 55 * elements, memory might be leaked.
56 */
58static inline void hash_delete(struct hashtable_t *hash, 57static inline void hash_delete(struct hashtable_t *hash,
59 hashdata_free_cb free_cb, void *arg) 58 hashdata_free_cb free_cb, void *arg)
60{ 59{
@@ -80,8 +79,7 @@ static inline void hash_delete(struct hashtable_t *hash,
80 batadv_hash_destroy(hash); 79 batadv_hash_destroy(hash);
81} 80}
82 81
83/** 82/* hash_add - adds data to the hashtable
84 * hash_add - adds data to the hashtable
85 * @hash: storage hash table 83 * @hash: storage hash table
86 * @compare: callback to determine if 2 hash elements are identical 84 * @compare: callback to determine if 2 hash elements are identical
87 * @choose: callback calculating the hash index 85 * @choose: callback calculating the hash index
@@ -91,7 +89,6 @@ static inline void hash_delete(struct hashtable_t *hash,
91 * Returns 0 on success, 1 if the element already is in the hash 89 * Returns 0 on success, 1 if the element already is in the hash
92 * and -1 on error. 90 * and -1 on error.
93 */ 91 */
94
95static inline int hash_add(struct hashtable_t *hash, 92static inline int hash_add(struct hashtable_t *hash,
96 hashdata_compare_cb compare, 93 hashdata_compare_cb compare,
97 hashdata_choose_cb choose, 94 hashdata_choose_cb choose,
@@ -134,7 +131,8 @@ out:
134/* removes data from hash, if found. returns pointer do data on success, so you 131/* removes data from hash, if found. returns pointer do data on success, so you
135 * can remove the used structure yourself, or NULL on error . data could be the 132 * can remove the used structure yourself, or NULL on error . data could be the
136 * structure you use with just the key filled, we just need the key for 133 * structure you use with just the key filled, we just need the key for
137 * comparing. */ 134 * comparing.
135 */
138static inline void *hash_remove(struct hashtable_t *hash, 136static inline void *hash_remove(struct hashtable_t *hash,
139 hashdata_compare_cb compare, 137 hashdata_compare_cb compare,
140 hashdata_choose_cb choose, void *data) 138 hashdata_choose_cb choose, void *data)