Lines Matching +full:n +full:- +full:1
8 * http://www.apache.org/licenses/LICENSE-2.0
51 #define INIT_HLIST_HEAD(ptr) ((ptr)->first = NULL)
63 h->next = NULL; in INIT_HLIST_NODE()
64 h->pprev = NULL; in INIT_HLIST_NODE()
69 return !h->pprev; in hlist_unhashed()
74 return !READ_ONCE(h->first); in hlist_empty()
77 static inline void __hlist_del(struct hlist_node *n) in __hlist_del() argument
79 struct hlist_node *next = n->next; in __hlist_del()
80 struct hlist_node **pprev = n->pprev; in __hlist_del()
84 next->pprev = pprev; in __hlist_del()
87 static inline void hlist_del(struct hlist_node *n) in hlist_del() argument
89 __hlist_del(n); in hlist_del()
90 n->next = (struct hlist_node*)LIST_POISON1; in hlist_del()
91 n->pprev = (struct hlist_node**)LIST_POISON2; in hlist_del()
94 static inline void hlist_del_init(struct hlist_node *n) in hlist_del_init() argument
96 if (!hlist_unhashed(n)) { in hlist_del_init()
97 __hlist_del(n); in hlist_del_init()
98 INIT_HLIST_NODE(n); in hlist_del_init()
102 static inline void hlist_add_head(struct hlist_node *n, struct hlist_head *h) in hlist_add_head() argument
104 struct hlist_node *first = h->first; in hlist_add_head()
105 n->next = first; in hlist_add_head()
107 first->pprev = &n->next; in hlist_add_head()
108 WRITE_ONCE(h->first, n); in hlist_add_head()
109 n->pprev = &h->first; in hlist_add_head()
112 static inline void hlist_add_before(struct hlist_node *n, struct hlist_node *next) in hlist_add_before() argument
114 n->pprev = next->pprev; in hlist_add_before()
115 n->next = next; in hlist_add_before()
116 next->pprev = &n->next; in hlist_add_before()
117 WRITE_ONCE(*(n->pprev), n); in hlist_add_before()
120 static inline void hlist_add_behind(struct hlist_node *n, struct hlist_node *prev) in hlist_add_behind() argument
122 n->next = prev->next; in hlist_add_behind()
123 WRITE_ONCE(prev->next, n); in hlist_add_behind()
124 n->pprev = &prev->next; in hlist_add_behind()
126 if (n->next) in hlist_add_behind()
127 n->next->pprev = &n->next; in hlist_add_behind()
130 static inline void hlist_add_fake(struct hlist_node *n) in hlist_add_fake() argument
132 n->pprev = &n->next; in hlist_add_fake()
137 return h->pprev == &h->next; in hlist_fake()
141 hlist_is_singular_node(struct hlist_node *n, struct hlist_head *h) in hlist_is_singular_node() argument
143 return !n->next && n->pprev == &h->first; in hlist_is_singular_node()
149 _new->first = old->first; in hlist_move_list()
150 if (_new->first) in hlist_move_list()
151 _new->first->pprev = &_new->first; in hlist_move_list()
152 old->first = NULL; in hlist_move_list()
158 for (pos = (head)->first; pos ; pos = pos->next)
160 #define hlist_for_each_safe(pos, n, head) \ argument
161 for (pos = (head)->first; pos && ({ n = pos->next; 1; }); \
162 pos = n)
170 for (pos = hlist_entry_safe((head)->first, typeof(*(pos)), member);\
172 pos = hlist_entry_safe((pos)->member.next, typeof(*(pos)), member))
175 for (pos = hlist_entry_safe((pos)->member.next, typeof(*(pos)), member);\
177 pos = hlist_entry_safe((pos)->member.next, typeof(*(pos)), member))
181 pos = hlist_entry_safe((pos)->member.next, typeof(*(pos)), member))
183 #define hlist_for_each_entry_safe(pos, n, head, member) \ argument
184 for (pos = hlist_entry_safe((head)->first, typeof(*pos), member);\
185 pos && ({ n = pos->member.next; 1; }); \
186 pos = hlist_entry_safe(n, typeof(*pos), member))
189 struct hlist_head name[1 << (bits)] = \
190 { [0 ... ((1 << (bits)) - 1)] = HLIST_HEAD_INIT }
193 struct hlist_head name[1 << (bits)]
197 #define ilog2(n) \ argument
199 (n) & (1ULL << 63) ? 63 : \
200 (n) & (1ULL << 62) ? 62 : \
201 (n) & (1ULL << 61) ? 61 : \
202 (n) & (1ULL << 60) ? 60 : \
203 (n) & (1ULL << 59) ? 59 : \
204 (n) & (1ULL << 58) ? 58 : \
205 (n) & (1ULL << 57) ? 57 : \
206 (n) & (1ULL << 56) ? 56 : \
207 (n) & (1ULL << 55) ? 55 : \
208 (n) & (1ULL << 54) ? 54 : \
209 (n) & (1ULL << 53) ? 53 : \
210 (n) & (1ULL << 52) ? 52 : \
211 (n) & (1ULL << 51) ? 51 : \
212 (n) & (1ULL << 50) ? 50 : \
213 (n) & (1ULL << 49) ? 49 : \
214 (n) & (1ULL << 48) ? 48 : \
215 (n) & (1ULL << 47) ? 47 : \
216 (n) & (1ULL << 46) ? 46 : \
217 (n) & (1ULL << 45) ? 45 : \
218 (n) & (1ULL << 44) ? 44 : \
219 (n) & (1ULL << 43) ? 43 : \
220 (n) & (1ULL << 42) ? 42 : \
221 (n) & (1ULL << 41) ? 41 : \
222 (n) & (1ULL << 40) ? 40 : \
223 (n) & (1ULL << 39) ? 39 : \
224 (n) & (1ULL << 38) ? 38 : \
225 (n) & (1ULL << 37) ? 37 : \
226 (n) & (1ULL << 36) ? 36 : \
227 (n) & (1ULL << 35) ? 35 : \
228 (n) & (1ULL << 34) ? 34 : \
229 (n) & (1ULL << 33) ? 33 : \
230 (n) & (1ULL << 32) ? 32 : \
231 (n) & (1ULL << 31) ? 31 : \
232 (n) & (1ULL << 30) ? 30 : \
233 (n) & (1ULL << 29) ? 29 : \
234 (n) & (1ULL << 28) ? 28 : \
235 (n) & (1ULL << 27) ? 27 : \
236 (n) & (1ULL << 26) ? 26 : \
237 (n) & (1ULL << 25) ? 25 : \
238 (n) & (1ULL << 24) ? 24 : \
239 (n) & (1ULL << 23) ? 23 : \
240 (n) & (1ULL << 22) ? 22 : \
241 (n) & (1ULL << 21) ? 21 : \
242 (n) & (1ULL << 20) ? 20 : \
243 (n) & (1ULL << 19) ? 19 : \
244 (n) & (1ULL << 18) ? 18 : \
245 (n) & (1ULL << 17) ? 17 : \
246 (n) & (1ULL << 16) ? 16 : \
247 (n) & (1ULL << 15) ? 15 : \
248 (n) & (1ULL << 14) ? 14 : \
249 (n) & (1ULL << 13) ? 13 : \
250 (n) & (1ULL << 12) ? 12 : \
251 (n) & (1ULL << 11) ? 11 : \
252 (n) & (1ULL << 10) ? 10 : \
253 (n) & (1ULL << 9) ? 9 : \
254 (n) & (1ULL << 8) ? 8 : \
255 (n) & (1ULL << 7) ? 7 : \
256 (n) & (1ULL << 6) ? 6 : \
257 (n) & (1ULL << 5) ? 5 : \
258 (n) & (1ULL << 4) ? 4 : \
259 (n) & (1ULL << 3) ? 3 : \
260 (n) & (1ULL << 2) ? 2 : \
261 (n) & (1ULL << 1) ? 1 : 0 \
275 * hash_empty - check whether a hashtable is empty
284 * hash_for_each - iterate over a hashtable
296 * hash_for_each_safe - iterate over a hashtable safe against removal of
318 return hash >> (32 - bits); in hash_32()
329 /* 64x64-bit multiply is efficient on all 64-bit processors */ in hash_64()
330 return val * GOLDEN_RATIO_64 >> (64 - bits); in hash_64()
332 /* Hash 64 bits using only 32x32-bit multiply. */ in hash_64()
354 * hash_hashed - check whether an object is in any hashtable
374 * hash_del - remove an object from a hashtable