aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/hashtable.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/hashtable.h')
-rw-r--r--include/linux/hashtable.h40
1 files changed, 19 insertions, 21 deletions
diff --git a/include/linux/hashtable.h b/include/linux/hashtable.h
index 227c62424f3c..a9df51f5d54c 100644
--- a/include/linux/hashtable.h
+++ b/include/linux/hashtable.h
@@ -115,51 +115,50 @@ static inline void hash_del_rcu(struct hlist_node *node)
115 * hash_for_each - iterate over a hashtable 115 * hash_for_each - iterate over a hashtable
116 * @name: hashtable to iterate 116 * @name: hashtable to iterate
117 * @bkt: integer to use as bucket loop cursor 117 * @bkt: integer to use as bucket loop cursor
118 * @node: the &struct list_head to use as a loop cursor for each entry
119 * @obj: the type * to use as a loop cursor for each entry 118 * @obj: the type * to use as a loop cursor for each entry
120 * @member: the name of the hlist_node within the struct 119 * @member: the name of the hlist_node within the struct
121 */ 120 */
122#define hash_for_each(name, bkt, node, obj, member) \ 121#define hash_for_each(name, bkt, obj, member) \
123 for ((bkt) = 0, node = NULL; node == NULL && (bkt) < HASH_SIZE(name); (bkt)++)\ 122 for ((bkt) = 0, obj = NULL; obj == NULL && (bkt) < HASH_SIZE(name);\
124 hlist_for_each_entry(obj, node, &name[bkt], member) 123 (bkt)++)\
124 hlist_for_each_entry(obj, &name[bkt], member)
125 125
126/** 126/**
127 * hash_for_each_rcu - iterate over a rcu enabled hashtable 127 * hash_for_each_rcu - iterate over a rcu enabled hashtable
128 * @name: hashtable to iterate 128 * @name: hashtable to iterate
129 * @bkt: integer to use as bucket loop cursor 129 * @bkt: integer to use as bucket loop cursor
130 * @node: the &struct list_head to use as a loop cursor for each entry
131 * @obj: the type * to use as a loop cursor for each entry 130 * @obj: the type * to use as a loop cursor for each entry
132 * @member: the name of the hlist_node within the struct 131 * @member: the name of the hlist_node within the struct
133 */ 132 */
134#define hash_for_each_rcu(name, bkt, node, obj, member) \ 133#define hash_for_each_rcu(name, bkt, obj, member) \
135 for ((bkt) = 0, node = NULL; node == NULL && (bkt) < HASH_SIZE(name); (bkt)++)\ 134 for ((bkt) = 0, obj = NULL; obj == NULL && (bkt) < HASH_SIZE(name);\
136 hlist_for_each_entry_rcu(obj, node, &name[bkt], member) 135 (bkt)++)\
136 hlist_for_each_entry_rcu(obj, &name[bkt], member)
137 137
138/** 138/**
139 * hash_for_each_safe - iterate over a hashtable safe against removal of 139 * hash_for_each_safe - iterate over a hashtable safe against removal of
140 * hash entry 140 * hash entry
141 * @name: hashtable to iterate 141 * @name: hashtable to iterate
142 * @bkt: integer to use as bucket loop cursor 142 * @bkt: integer to use as bucket loop cursor
143 * @node: the &struct list_head to use as a loop cursor for each entry
144 * @tmp: a &struct used for temporary storage 143 * @tmp: a &struct used for temporary storage
145 * @obj: the type * to use as a loop cursor for each entry 144 * @obj: the type * to use as a loop cursor for each entry
146 * @member: the name of the hlist_node within the struct 145 * @member: the name of the hlist_node within the struct
147 */ 146 */
148#define hash_for_each_safe(name, bkt, node, tmp, obj, member) \ 147#define hash_for_each_safe(name, bkt, tmp, obj, member) \
149 for ((bkt) = 0, node = NULL; node == NULL && (bkt) < HASH_SIZE(name); (bkt)++)\ 148 for ((bkt) = 0, obj = NULL; obj == NULL && (bkt) < HASH_SIZE(name);\
150 hlist_for_each_entry_safe(obj, node, tmp, &name[bkt], member) 149 (bkt)++)\
150 hlist_for_each_entry_safe(obj, tmp, &name[bkt], member)
151 151
152/** 152/**
153 * hash_for_each_possible - iterate over all possible objects hashing to the 153 * hash_for_each_possible - iterate over all possible objects hashing to the
154 * same bucket 154 * same bucket
155 * @name: hashtable to iterate 155 * @name: hashtable to iterate
156 * @obj: the type * to use as a loop cursor for each entry 156 * @obj: the type * to use as a loop cursor for each entry
157 * @node: the &struct list_head to use as a loop cursor for each entry
158 * @member: the name of the hlist_node within the struct 157 * @member: the name of the hlist_node within the struct
159 * @key: the key of the objects to iterate over 158 * @key: the key of the objects to iterate over
160 */ 159 */
161#define hash_for_each_possible(name, obj, node, member, key) \ 160#define hash_for_each_possible(name, obj, member, key) \
162 hlist_for_each_entry(obj, node, &name[hash_min(key, HASH_BITS(name))], member) 161 hlist_for_each_entry(obj, &name[hash_min(key, HASH_BITS(name))], member)
163 162
164/** 163/**
165 * hash_for_each_possible_rcu - iterate over all possible objects hashing to the 164 * hash_for_each_possible_rcu - iterate over all possible objects hashing to the
@@ -167,25 +166,24 @@ static inline void hash_del_rcu(struct hlist_node *node)
167 * in a rcu enabled hashtable 166 * in a rcu enabled hashtable
168 * @name: hashtable to iterate 167 * @name: hashtable to iterate
169 * @obj: the type * to use as a loop cursor for each entry 168 * @obj: the type * to use as a loop cursor for each entry
170 * @node: the &struct list_head to use as a loop cursor for each entry
171 * @member: the name of the hlist_node within the struct 169 * @member: the name of the hlist_node within the struct
172 * @key: the key of the objects to iterate over 170 * @key: the key of the objects to iterate over
173 */ 171 */
174#define hash_for_each_possible_rcu(name, obj, node, member, key) \ 172#define hash_for_each_possible_rcu(name, obj, member, key) \
175 hlist_for_each_entry_rcu(obj, node, &name[hash_min(key, HASH_BITS(name))], member) 173 hlist_for_each_entry_rcu(obj, &name[hash_min(key, HASH_BITS(name))],\
174 member)
176 175
177/** 176/**
178 * hash_for_each_possible_safe - iterate over all possible objects hashing to the 177 * hash_for_each_possible_safe - iterate over all possible objects hashing to the
179 * same bucket safe against removals 178 * same bucket safe against removals
180 * @name: hashtable to iterate 179 * @name: hashtable to iterate
181 * @obj: the type * to use as a loop cursor for each entry 180 * @obj: the type * to use as a loop cursor for each entry
182 * @node: the &struct list_head to use as a loop cursor for each entry
183 * @tmp: a &struct used for temporary storage 181 * @tmp: a &struct used for temporary storage
184 * @member: the name of the hlist_node within the struct 182 * @member: the name of the hlist_node within the struct
185 * @key: the key of the objects to iterate over 183 * @key: the key of the objects to iterate over
186 */ 184 */
187#define hash_for_each_possible_safe(name, obj, node, tmp, member, key) \ 185#define hash_for_each_possible_safe(name, obj, tmp, member, key) \
188 hlist_for_each_entry_safe(obj, node, tmp, \ 186 hlist_for_each_entry_safe(obj, tmp,\
189 &name[hash_min(key, HASH_BITS(name))], member) 187 &name[hash_min(key, HASH_BITS(name))], member)
190 188
191 189