Debian Codegraph @

include/linux_list.h

raw symbols SCIP
1 #cxx . . $ `<file>/include/linux_list.h`/ifndef _LINUX_LIST_H
2 #define _LINUX_LIST_Hcxx . . $ `include/linux_list.h:2:9`!
3
4 #include <stddef.h>
5
6 #undef offsetofcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:431:9`!
7 #define offsetofcxx . . $ `include/linux_list.h:7:9`!(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
8
9 /**
10 * container_of - cast a member of a structure out to the containing structure
11 *
12 * @ptr: the pointer to the member.
13 * @type: the type of the container struct this is embedded in.
14 * @member: the name of the member within the struct.
15 *
16 */
17 #define container_ofcxx . . $ `include/linux_list.h:17:9`!(ptr, type, member) ({ \
18 typeof( ((type *)0)->member ) *__mptr = (ptr); \
19 (type *)( (char *)__mptr - offsetof(type,member) );})
20
21 /*
22 * Check at compile time that something is of a particular type.
23 * Always evaluates to 1 so you may use it easily in comparisons.
24 */
25 #define typecheckcxx . . $ `include/linux_list.h:25:9`!(type,x) \
26 ({ type __dummy; \
27 typeof(x) __dummy2; \
28 (void)(&__dummy == &__dummy2); \
29 1; \
30 })
31
32 #define prefetchcxx . . $ `include/linux_list.h:32:9`!(x) ((void)0)
33
34 /* empty define to make this work in userspace -HW */
35 #ifndef smp_wmb
36 #define smp_wmbcxx . . $ `include/linux_list.h:36:9`!()
37 #endif
38
39 /*
40 * These are non-NULL pointers that will result in page faults
41 * under normal circumstances, used to verify that nobody uses
42 * non-initialized list entries.
43 */
44 #define LIST_POISON1cxx . . $ `include/linux_list.h:44:9`! ((void *) 0x00100100)
45 #define LIST_POISON2cxx . . $ `include/linux_list.h:45:9`! ((void *) 0x00200200)
46
47 /*
48 * Simple doubly linked list implementation.
49 *
50 * Some of the internal functions ("__xxx") are useful when
51 * manipulating whole lists rather than single entries, as
52 * sometimes we already know the next/prev entries and we can
53 * generate better code by using them directly rather than
54 * using the generic single-entry routines.
55 */
56
57 struct list_headcxx . . $ list_head# {
58 struct list_headcxx . . $ list_head# *nextcxx . . $ list_head#next., *prevcxx . . $ list_head#prev.;
59 };
60
61 #define LIST_HEAD_INITcxx . . $ `include/linux_list.h:61:9`!(name) { &(name), &(name) }
62
63 #define LIST_HEADcxx . . $ `include/linux_list.h:63:9`!(name) \
64 struct list_head name = LIST_HEAD_INIT(name)
65
66 #define INIT_LIST_HEADcxx . . $ `include/linux_list.h:66:9`!(ptr) do { \
67 (ptr)->next = (ptr); (ptr)->prev = (ptr); \
68 } while (0)
69
70 /*
71 * Insert a new entry between two known consecutive entries.
72 *
73 * This is only for internal list manipulation where we know
74 * the prev/next entries already!
75 */
76 static inline void __list_addcxx . . $ __list_add(a574ce21b3779bd1).(struct list_headcxx . . $ list_head# *new,
77 struct list_headcxx . . $ list_head# *prev,
78 struct list_headcxx . . $ list_head# *next)
79 {
80 next->prevcxx . . $ list_head#prev. = new;
81 new->nextcxx . . $ list_head#next. = next;
82 new->prevcxx . . $ list_head#prev. = prev;
83 prev->nextcxx . . $ list_head#next. = new;
84 }
85
86 /**
87 * list_add - add a new entry
88 * @new: new entry to be added
89 * @head: list head to add it after
90 *
91 * Insert a new entry after the specified head.
92 * This is good for implementing stacks.
93 */
94 static inline void list_addcxx . . $ list_add(6c3f7387ec573de3).(struct list_headcxx . . $ list_head# *new, struct list_headcxx . . $ list_head# *head)
95 {
96 __list_addcxx . . $ __list_add(a574ce21b3779bd1).(new, head, head->nextcxx . . $ list_head#next.);
97 }
98
99 /**
100 * list_add_tail - add a new entry
101 * @new: new entry to be added
102 * @head: list head to add it before
103 *
104 * Insert a new entry before the specified head.
105 * This is useful for implementing queues.
106 */
107 static inline void list_add_tailcxx . . $ list_add_tail(6c3f7387ec573de3).(struct list_headcxx . . $ list_head# *new, struct list_headcxx . . $ list_head# *head)
108 {
109 __list_addcxx . . $ __list_add(a574ce21b3779bd1).(new, head->prevcxx . . $ list_head#prev., head);
110 }
111
112 /*
113 * Insert a new entry between two known consecutive entries.
114 *
115 * This is only for internal list manipulation where we know
116 * the prev/next entries already!
117 */
118 static inline void __list_add_rcucxx . . $ __list_add_rcu(a574ce21b3779bd1).(struct list_headcxx . . $ list_head# * new,
119 struct list_headcxx . . $ list_head# * prev, struct list_headcxx . . $ list_head# * next)
120 {
121 new->nextcxx . . $ list_head#next. = next;
122 new->prevcxx . . $ list_head#prev. = prev;
123 smp_wmbcxx . . $ `include/linux_list.h:36:9`!();
124 next->prevcxx . . $ list_head#prev. = new;
125 prev->nextcxx . . $ list_head#next. = new;
126 }
127
128 /**
129 * list_add_rcu - add a new entry to rcu-protected list
130 * @new: new entry to be added
131 * @head: list head to add it after
132 *
133 * Insert a new entry after the specified head.
134 * This is good for implementing stacks.
135 *
136 * The caller must take whatever precautions are necessary
137 * (such as holding appropriate locks) to avoid racing
138 * with another list-mutation primitive, such as list_add_rcu()
139 * or list_del_rcu(), running on this same list.
140 * However, it is perfectly legal to run concurrently with
141 * the _rcu list-traversal primitives, such as
142 * list_for_each_entry_rcu().
143 */
144 static inline void list_add_rcucxx . . $ list_add_rcu(6c3f7387ec573de3).(struct list_headcxx . . $ list_head# *new, struct list_headcxx . . $ list_head# *head)
145 {
146 __list_add_rcucxx . . $ __list_add_rcu(a574ce21b3779bd1).(new, head, head->nextcxx . . $ list_head#next.);
147 }
148
149 /**
150 * list_add_tail_rcu - add a new entry to rcu-protected list
151 * @new: new entry to be added
152 * @head: list head to add it before
153 *
154 * Insert a new entry before the specified head.
155 * This is useful for implementing queues.
156 *
157 * The caller must take whatever precautions are necessary
158 * (such as holding appropriate locks) to avoid racing
159 * with another list-mutation primitive, such as list_add_tail_rcu()
160 * or list_del_rcu(), running on this same list.
161 * However, it is perfectly legal to run concurrently with
162 * the _rcu list-traversal primitives, such as
163 * list_for_each_entry_rcu().
164 */
165 static inline void list_add_tail_rcucxx . . $ list_add_tail_rcu(6c3f7387ec573de3).(struct list_headcxx . . $ list_head# *new,
166 struct list_headcxx . . $ list_head# *head)
167 {
168 __list_add_rcucxx . . $ __list_add_rcu(a574ce21b3779bd1).(new, head->prevcxx . . $ list_head#prev., head);
169 }
170
171 /*
172 * Delete a list entry by making the prev/next entries
173 * point to each other.
174 *
175 * This is only for internal list manipulation where we know
176 * the prev/next entries already!
177 */
178 static inline void __list_delcxx . . $ __list_del(6c3f7387ec573de3).(struct list_headcxx . . $ list_head# * prev, struct list_headcxx . . $ list_head# * next)
179 {
180 next->prevcxx . . $ list_head#prev. = prev;
181 prev->nextcxx . . $ list_head#next. = next;
182 }
183
184 /**
185 * list_del - deletes entry from list.
186 * @entry: the element to delete from the list.
187 * Note: list_empty on entry does not return true after this, the entry is
188 * in an undefined state.
189 */
190 static inline void list_delcxx . . $ list_del(35ab6d74de6aba0a).(struct list_headcxx . . $ list_head# *entry)
191 {
192 __list_delcxx . . $ __list_del(6c3f7387ec573de3).(entry->prevcxx . . $ list_head#prev., entry->nextcxx . . $ list_head#next.);
193 entry->nextcxx . . $ list_head#next. = LIST_POISON1cxx . . $ `include/linux_list.h:44:9`!;
194 entry->prevcxx . . $ list_head#prev. = LIST_POISON2cxx . . $ `include/linux_list.h:45:9`!;
195 }
196
197 /**
198 * list_del_rcu - deletes entry from list without re-initialization
199 * @entry: the element to delete from the list.
200 *
201 * Note: list_empty on entry does not return true after this,
202 * the entry is in an undefined state. It is useful for RCU based
203 * lockfree traversal.
204 *
205 * In particular, it means that we can not poison the forward
206 * pointers that may still be used for walking the list.
207 *
208 * The caller must take whatever precautions are necessary
209 * (such as holding appropriate locks) to avoid racing
210 * with another list-mutation primitive, such as list_del_rcu()
211 * or list_add_rcu(), running on this same list.
212 * However, it is perfectly legal to run concurrently with
213 * the _rcu list-traversal primitives, such as
214 * list_for_each_entry_rcu().
215 *
216 * Note that the caller is not permitted to immediately free
217 * the newly deleted entry. Instead, either synchronize_kernel()
218 * or call_rcu() must be used to defer freeing until an RCU
219 * grace period has elapsed.
220 */
221 static inline void list_del_rcucxx . . $ list_del_rcu(35ab6d74de6aba0a).(struct list_headcxx . . $ list_head# *entry)
222 {
223 __list_delcxx . . $ __list_del(6c3f7387ec573de3).(entry->prevcxx . . $ list_head#prev., entry->nextcxx . . $ list_head#next.);
224 entry->prevcxx . . $ list_head#prev. = LIST_POISON2cxx . . $ `include/linux_list.h:45:9`!;
225 }
226
227 /**
228 * list_del_init - deletes entry from list and reinitialize it.
229 * @entry: the element to delete from the list.
230 */
231 static inline void list_del_initcxx . . $ list_del_init(35ab6d74de6aba0a).(struct list_headcxx . . $ list_head# *entry)
232 {
233 __list_delcxx . . $ __list_del(6c3f7387ec573de3).(entry->prevcxx . . $ list_head#prev., entry->nextcxx . . $ list_head#next.);
234 INIT_LIST_HEADcxx . . $ `include/linux_list.h:66:9`!(entry);
235 }
236
237 /**
238 * list_move - delete from one list and add as another's head
239 * @list: the entry to move
240 * @head: the head that will precede our entry
241 */
242 static inline void list_movecxx . . $ list_move(6c3f7387ec573de3).(struct list_headcxx . . $ list_head# *list, struct list_headcxx . . $ list_head# *head)
243 {
244 __list_delcxx . . $ __list_del(6c3f7387ec573de3).(list->prevcxx . . $ list_head#prev., list->nextcxx . . $ list_head#next.);
245 list_addcxx . . $ list_add(6c3f7387ec573de3).(list, head);
246 }
247
248 /**
249 * list_move_tail - delete from one list and add as another's tail
250 * @list: the entry to move
251 * @head: the head that will follow our entry
252 */
253 static inline void list_move_tailcxx . . $ list_move_tail(6c3f7387ec573de3).(struct list_headcxx . . $ list_head# *list,
254 struct list_headcxx . . $ list_head# *head)
255 {
256 __list_delcxx . . $ __list_del(6c3f7387ec573de3).(list->prevcxx . . $ list_head#prev., list->nextcxx . . $ list_head#next.);
257 list_add_tailcxx . . $ list_add_tail(6c3f7387ec573de3).(list, head);
258 }
259
260 /**
261 * list_empty - tests whether a list is empty
262 * @head: the list to test.
263 */
264 static inline int list_emptycxx . . $ list_empty(df525b6afabf24a2).(const struct list_headcxx . . $ list_head# *head)
265 {
266 return head->nextcxx . . $ list_head#next. == head;
267 }
268
269 /**
270 * list_empty_careful - tests whether a list is
271 * empty _and_ checks that no other CPU might be
272 * in the process of still modifying either member
273 *
274 * NOTE: using list_empty_careful() without synchronization
275 * can only be safe if the only activity that can happen
276 * to the list entry is list_del_init(). Eg. it cannot be used
277 * if another CPU could re-list_add() it.
278 *
279 * @head: the list to test.
280 */
281 static inline int list_empty_carefulcxx . . $ list_empty_careful(df525b6afabf24a2).(const struct list_headcxx . . $ list_head# *head)
282 {
283 struct list_headcxx . . $ list_head# *next = head->nextcxx . . $ list_head#next.;
284 return (next == head) && (next == head->prevcxx . . $ list_head#prev.);
285 }
286
287 static inline void __list_splicecxx . . $ __list_splice(6c3f7387ec573de3).(struct list_headcxx . . $ list_head# *list,
288 struct list_headcxx . . $ list_head# *head)
289 {
290 struct list_headcxx . . $ list_head# *first = list->nextcxx . . $ list_head#next.;
291 struct list_headcxx . . $ list_head# *last = list->prevcxx . . $ list_head#prev.;
292 struct list_headcxx . . $ list_head# *at = head->nextcxx . . $ list_head#next.;
293
294 first->prevcxx . . $ list_head#prev. = head;
295 head->nextcxx . . $ list_head#next. = first;
296
297 last->nextcxx . . $ list_head#next. = at;
298 at->prevcxx . . $ list_head#prev. = last;
299 }
300
301 /**
302 * list_splice - join two lists
303 * @list: the new list to add.
304 * @head: the place to add it in the first list.
305 */
306 static inline void list_splicecxx . . $ list_splice(6c3f7387ec573de3).(struct list_headcxx . . $ list_head# *list, struct list_headcxx . . $ list_head# *head)
307 {
308 if (!list_emptycxx . . $ list_empty(df525b6afabf24a2).(list))
309 __list_splicecxx . . $ __list_splice(6c3f7387ec573de3).(list, head);
310 }
311
312 /**
313 * list_splice_init - join two lists and reinitialise the emptied list.
314 * @list: the new list to add.
315 * @head: the place to add it in the first list.
316 *
317 * The list at @list is reinitialised
318 */
319 static inline void list_splice_initcxx . . $ list_splice_init(6c3f7387ec573de3).(struct list_headcxx . . $ list_head# *list,
320 struct list_headcxx . . $ list_head# *head)
321 {
322 if (!list_emptycxx . . $ list_empty(df525b6afabf24a2).(list)) {
323 __list_splicecxx . . $ __list_splice(6c3f7387ec573de3).(list, head);
324 INIT_LIST_HEADcxx . . $ `include/linux_list.h:66:9`!(list);
325 }
326 }
327
328 /**
329 * list_entry - get the struct for this entry
330 * @ptr: the &struct list_head pointer.
331 * @type: the type of the struct this is embedded in.
332 * @member: the name of the list_struct within the struct.
333 */
334 #define list_entrycxx . . $ `include/linux_list.h:334:9`!(ptr, type, member) \
335 container_of(ptr, type, member)
336
337 /**
338 * list_for_each - iterate over a list
339 * @pos: the &struct list_head to use as a loop counter.
340 * @head: the head for your list.
341 */
342 #define list_for_eachcxx . . $ `include/linux_list.h:342:9`!(pos, head) \
343 for (pos = (head)->next, prefetch(pos->next); pos != (head); \
344 pos = pos->next, prefetch(pos->next))
345
346 /**
347 * __list_for_each - iterate over a list
348 * @pos: the &struct list_head to use as a loop counter.
349 * @head: the head for your list.
350 *
351 * This variant differs from list_for_each() in that it's the
352 * simplest possible list iteration code, no prefetching is done.
353 * Use this for code that knows the list to be very short (empty
354 * or 1 entry) most of the time.
355 */
356 #define __list_for_eachcxx . . $ `include/linux_list.h:356:9`!(pos, head) \
357 for (pos = (head)->next; pos != (head); pos = pos->next)
358
359 /**
360 * list_for_each_prev - iterate over a list backwards
361 * @pos: the &struct list_head to use as a loop counter.
362 * @head: the head for your list.
363 */
364 #define list_for_each_prevcxx . . $ `include/linux_list.h:364:9`!(pos, head) \
365 for (pos = (head)->prev, prefetch(pos->prev); pos != (head); \
366 pos = pos->prev, prefetch(pos->prev))
367
368 /**
369 * list_for_each_safe - iterate over a list safe against removal of list entry
370 * @pos: the &struct list_head to use as a loop counter.
371 * @n: another &struct list_head to use as temporary storage
372 * @head: the head for your list.
373 */
374 #define list_for_each_safecxx . . $ `include/linux_list.h:374:9`!(pos, n, head) \
375 for (pos = (head)->next, n = pos->next; pos != (head); \
376 pos = n, n = pos->next)
377
378 /**
379 * list_for_each_entry - iterate over list of given type
380 * @pos: the type * to use as a loop counter.
381 * @head: the head for your list.
382 * @member: the name of the list_struct within the struct.
383 */
384 #define list_for_each_entrycxx . . $ `include/linux_list.h:384:9`!(pos, head, member) \
385 for (pos = list_entry((head)->next, typeof(*pos), member), \
386 prefetch(pos->member.next); \
387 &pos->member != (head); \
388 pos = list_entry(pos->member.next, typeof(*pos), member), \
389 prefetch(pos->member.next))
390
391 /**
392 * list_for_each_entry_reverse - iterate backwards over list of given type.
393 * @pos: the type * to use as a loop counter.
394 * @head: the head for your list.
395 * @member: the name of the list_struct within the struct.
396 */
397 #define list_for_each_entry_reversecxx . . $ `include/linux_list.h:397:9`!(pos, head, member) \
398 for (pos = list_entry((head)->prev, typeof(*pos), member), \
399 prefetch(pos->member.prev); \
400 &pos->member != (head); \
401 pos = list_entry(pos->member.prev, typeof(*pos), member), \
402 prefetch(pos->member.prev))
403
404 /**
405 * list_prepare_entry - prepare a pos entry for use as a start point in
406 * list_for_each_entry_continue
407 * @pos: the type * to use as a start point
408 * @head: the head of the list
409 * @member: the name of the list_struct within the struct.
410 */
411 #define list_prepare_entrycxx . . $ `include/linux_list.h:411:9`!(pos, head, member) \
412 ((pos) ? : list_entry(head, typeof(*pos), member))
413
414 /**
415 * list_for_each_entry_continue - iterate over list of given type
416 * continuing after existing point
417 * @pos: the type * to use as a loop counter.
418 * @head: the head for your list.
419 * @member: the name of the list_struct within the struct.
420 */
421 #define list_for_each_entry_continuecxx . . $ `include/linux_list.h:421:9`!(pos, head, member) \
422 for (pos = list_entry(pos->member.next, typeof(*pos), member), \
423 prefetch(pos->member.next); \
424 &pos->member != (head); \
425 pos = list_entry(pos->member.next, typeof(*pos), member), \
426 prefetch(pos->member.next))
427
428 /**
429 * list_for_each_entry_safe - iterate over list of given type safe against removal of list entry
430 * @pos: the type * to use as a loop counter.
431 * @n: another type * to use as temporary storage
432 * @head: the head for your list.
433 * @member: the name of the list_struct within the struct.
434 */
435 #define list_for_each_entry_safecxx . . $ `include/linux_list.h:435:9`!(pos, n, head, member) \
436 for (pos = list_entry((head)->next, typeof(*pos), member), \
437 n = list_entry(pos->member.next, typeof(*pos), member); \
438 &pos->member != (head); \
439 pos = n, n = list_entry(n->member.next, typeof(*n), member))
440
441 /**
442 * list_for_each_rcu - iterate over an rcu-protected list
443 * @pos: the &struct list_head to use as a loop counter.
444 * @head: the head for your list.
445 *
446 * This list-traversal primitive may safely run concurrently with
447 * the _rcu list-mutation primitives such as list_add_rcu()
448 * as long as the traversal is guarded by rcu_read_lock().
449 */
450 #define list_for_each_rcucxx . . $ `include/linux_list.h:450:9`!(pos, head) \
451 for (pos = (head)->next, prefetch(pos->next); pos != (head); \
452 pos = pos->next, ({ smp_read_barrier_depends(); 0;}), prefetch(pos->next))
453
454 #define __list_for_each_rcucxx . . $ `include/linux_list.h:454:9`!(pos, head) \
455 for (pos = (head)->next; pos != (head); \
456 pos = pos->next, ({ smp_read_barrier_depends(); 0;}))
457
458 /**
459 * list_for_each_safe_rcu - iterate over an rcu-protected list safe
460 * against removal of list entry
461 * @pos: the &struct list_head to use as a loop counter.
462 * @n: another &struct list_head to use as temporary storage
463 * @head: the head for your list.
464 *
465 * This list-traversal primitive may safely run concurrently with
466 * the _rcu list-mutation primitives such as list_add_rcu()
467 * as long as the traversal is guarded by rcu_read_lock().
468 */
469 #define list_for_each_safe_rcucxx . . $ `include/linux_list.h:469:9`!(pos, n, head) \
470 for (pos = (head)->next, n = pos->next; pos != (head); \
471 pos = n, ({ smp_read_barrier_depends(); 0;}), n = pos->next)
472
473 /**
474 * list_for_each_entry_rcu - iterate over rcu list of given type
475 * @pos: the type * to use as a loop counter.
476 * @head: the head for your list.
477 * @member: the name of the list_struct within the struct.
478 *
479 * This list-traversal primitive may safely run concurrently with
480 * the _rcu list-mutation primitives such as list_add_rcu()
481 * as long as the traversal is guarded by rcu_read_lock().
482 */
483 #define list_for_each_entry_rcucxx . . $ `include/linux_list.h:483:9`!(pos, head, member) \
484 for (pos = list_entry((head)->next, typeof(*pos), member), \
485 prefetch(pos->member.next); \
486 &pos->member != (head); \
487 pos = list_entry(pos->member.next, typeof(*pos), member), \
488 ({ smp_read_barrier_depends(); 0;}), \
489 prefetch(pos->member.next))
490
491
492 /**
493 * list_for_each_continue_rcu - iterate over an rcu-protected list
494 * continuing after existing point.
495 * @pos: the &struct list_head to use as a loop counter.
496 * @head: the head for your list.
497 *
498 * This list-traversal primitive may safely run concurrently with
499 * the _rcu list-mutation primitives such as list_add_rcu()
500 * as long as the traversal is guarded by rcu_read_lock().
501 */
502 #define list_for_each_continue_rcucxx . . $ `include/linux_list.h:502:9`!(pos, head) \
503 for ((pos) = (pos)->next, prefetch((pos)->next); (pos) != (head); \
504 (pos) = (pos)->next, ({ smp_read_barrier_depends(); 0;}), prefetch((pos)->next))
505
506 /*
507 * Double linked lists with a single pointer list head.
508 * Mostly useful for hash tables where the two pointer list head is
509 * too wasteful.
510 * You lose the ability to access the tail in O(1).
511 */
512
513 struct hlist_headcxx . . $ hlist_head# {
514 struct hlist_nodecxx . . $ hlist_node# *firstcxx . . $ hlist_head#first.;
515 };
516
517 struct hlist_nodecxx . . $ hlist_node# {
518 struct hlist_nodecxx . . $ hlist_node# *nextcxx . . $ hlist_node#next., **pprevcxx . . $ hlist_node#pprev.;
519 };
520
521 #define HLIST_HEAD_INITcxx . . $ `include/linux_list.h:521:9`! { .first = NULL }
522 #define HLIST_HEADcxx . . $ `include/linux_list.h:522:9`!(name) struct hlist_head name = { .first = NULL }
523 #define INIT_HLIST_HEADcxx . . $ `include/linux_list.h:523:9`!(ptr) ((ptr)->first = NULL)
524 #define INIT_HLIST_NODEcxx . . $ `include/linux_list.h:524:9`!(ptr) ((ptr)->next = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, (ptr)->pprev = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!)
525
526 static inline int hlist_unhashedcxx . . $ hlist_unhashed(751786016ec4fcf6).(const struct hlist_nodecxx . . $ hlist_node# *h)
527 {
528 return !h->pprevcxx . . $ hlist_node#pprev.;
529 }
530
531 static inline int hlist_emptycxx . . $ hlist_empty(56484b5b10ea2f23).(const struct hlist_headcxx . . $ hlist_head# *h)
532 {
533 return !h->firstcxx . . $ hlist_head#first.;
534 }
535
536 static inline void __hlist_delcxx . . $ __hlist_del(9568863142661c75).(struct hlist_nodecxx . . $ hlist_node# *n)
537 {
538 struct hlist_nodecxx . . $ hlist_node# *next = n->nextcxx . . $ hlist_node#next.;
539 struct hlist_nodecxx . . $ hlist_node# **pprev = n->pprevcxx . . $ hlist_node#pprev.;
540 *pprev = next;
541 if (next)
542 next->pprevcxx . . $ hlist_node#pprev. = pprev;
543 }
544
545 static inline void hlist_delcxx . . $ hlist_del(9568863142661c75).(struct hlist_nodecxx . . $ hlist_node# *n)
546 {
547 __hlist_delcxx . . $ __hlist_del(9568863142661c75).(n);
548 n->nextcxx . . $ hlist_node#next. = LIST_POISON1cxx . . $ `include/linux_list.h:44:9`!;
549 n->pprevcxx . . $ hlist_node#pprev. = LIST_POISON2cxx . . $ `include/linux_list.h:45:9`!;
550 }
551
552 /**
553 * hlist_del_rcu - deletes entry from hash list without re-initialization
554 * @n: the element to delete from the hash list.
555 *
556 * Note: list_unhashed() on entry does not return true after this,
557 * the entry is in an undefined state. It is useful for RCU based
558 * lockfree traversal.
559 *
560 * In particular, it means that we can not poison the forward
561 * pointers that may still be used for walking the hash list.
562 *
563 * The caller must take whatever precautions are necessary
564 * (such as holding appropriate locks) to avoid racing
565 * with another list-mutation primitive, such as hlist_add_head_rcu()
566 * or hlist_del_rcu(), running on this same list.
567 * However, it is perfectly legal to run concurrently with
568 * the _rcu list-traversal primitives, such as
569 * hlist_for_each_entry().
570 */
571 static inline void hlist_del_rcucxx . . $ hlist_del_rcu(9568863142661c75).(struct hlist_nodecxx . . $ hlist_node# *n)
572 {
573 __hlist_delcxx . . $ __hlist_del(9568863142661c75).(n);
574 n->pprevcxx . . $ hlist_node#pprev. = LIST_POISON2cxx . . $ `include/linux_list.h:45:9`!;
575 }
576
577 static inline void hlist_del_initcxx . . $ hlist_del_init(9568863142661c75).(struct hlist_nodecxx . . $ hlist_node# *n)
578 {
579 if (n->pprevcxx . . $ hlist_node#pprev.) {
580 __hlist_delcxx . . $ __hlist_del(9568863142661c75).(n);
581 INIT_HLIST_NODEcxx . . $ `include/linux_list.h:524:9`!(n);
582 }
583 }
584
585 #define hlist_del_rcu_initcxx . . $ `include/linux_list.h:585:9`! hlist_del_init
586
587 static inline void hlist_add_headcxx . . $ hlist_add_head(32b7a2e391003461).(struct hlist_nodecxx . . $ hlist_node# *n, struct hlist_headcxx . . $ hlist_head# *h)
588 {
589 struct hlist_nodecxx . . $ hlist_node# *first = h->firstcxx . . $ hlist_head#first.;
590 n->nextcxx . . $ hlist_node#next. = first;
591 if (first)
592 first->pprevcxx . . $ hlist_node#pprev. = &n->nextcxx . . $ hlist_node#next.;
593 h->firstcxx . . $ hlist_head#first. = n;
594 n->pprevcxx . . $ hlist_node#pprev. = &h->firstcxx . . $ hlist_head#first.;
595 }
596
597
598 /**
599 * hlist_add_head_rcu - adds the specified element to the specified hlist,
600 * while permitting racing traversals.
601 * @n: the element to add to the hash list.
602 * @h: the list to add to.
603 *
604 * The caller must take whatever precautions are necessary
605 * (such as holding appropriate locks) to avoid racing
606 * with another list-mutation primitive, such as hlist_add_head_rcu()
607 * or hlist_del_rcu(), running on this same list.
608 * However, it is perfectly legal to run concurrently with
609 * the _rcu list-traversal primitives, such as
610 * hlist_for_each_entry(), but only if smp_read_barrier_depends()
611 * is used to prevent memory-consistency problems on Alpha CPUs.
612 * Regardless of the type of CPU, the list-traversal primitive
613 * must be guarded by rcu_read_lock().
614 *
615 * OK, so why don't we have an hlist_for_each_entry_rcu()???
616 */
617 static inline void hlist_add_head_rcucxx . . $ hlist_add_head_rcu(32b7a2e391003461).(struct hlist_nodecxx . . $ hlist_node# *n,
618 struct hlist_headcxx . . $ hlist_head# *h)
619 {
620 struct hlist_nodecxx . . $ hlist_node# *first = h->firstcxx . . $ hlist_head#first.;
621 n->nextcxx . . $ hlist_node#next. = first;
622 n->pprevcxx . . $ hlist_node#pprev. = &h->firstcxx . . $ hlist_head#first.;
623 smp_wmbcxx . . $ `include/linux_list.h:36:9`!();
624 if (first)
625 first->pprevcxx . . $ hlist_node#pprev. = &n->nextcxx . . $ hlist_node#next.;
626 h->firstcxx . . $ hlist_head#first. = n;
627 }
628
629 /* next must be != NULL */
630 static inline void hlist_add_beforecxx . . $ hlist_add_before(3888a21e43e1df1f).(struct hlist_nodecxx . . $ hlist_node# *n,
631 struct hlist_nodecxx . . $ hlist_node# *next)
632 {
633 n->pprevcxx . . $ hlist_node#pprev. = next->pprevcxx . . $ hlist_node#pprev.;
634 n->nextcxx . . $ hlist_node#next. = next;
635 next->pprevcxx . . $ hlist_node#pprev. = &n->nextcxx . . $ hlist_node#next.;
636 *(n->pprevcxx . . $ hlist_node#pprev.) = n;
637 }
638
639 static inline void hlist_add_aftercxx . . $ hlist_add_after(3888a21e43e1df1f).(struct hlist_nodecxx . . $ hlist_node# *n,
640 struct hlist_nodecxx . . $ hlist_node# *next)
641 {
642 next->nextcxx . . $ hlist_node#next. = n->nextcxx . . $ hlist_node#next.;
643 n->nextcxx . . $ hlist_node#next. = next;
644 next->pprevcxx . . $ hlist_node#pprev. = &n->nextcxx . . $ hlist_node#next.;
645
646 if(next->nextcxx . . $ hlist_node#next.)
647 next->nextcxx . . $ hlist_node#next.->pprevcxx . . $ hlist_node#pprev. = &next->nextcxx . . $ hlist_node#next.;
648 }
649
650 #define hlist_entrycxx . . $ `include/linux_list.h:650:9`!(ptr, type, member) container_of(ptr,type,member)
651
652 #define hlist_for_eachcxx . . $ `include/linux_list.h:652:9`!(pos, head) \
653 for (pos = (head)->first; pos && ({ prefetch(pos->next); 1; }); \
654 pos = pos->next)
655
656 #define hlist_for_each_safecxx . . $ `include/linux_list.h:656:9`!(pos, n, head) \
657 for (pos = (head)->first; pos && ({ n = pos->next; 1; }); \
658 pos = n)
659
660 /**
661 * hlist_for_each_entry - iterate over list of given type
662 * @tpos: the type * to use as a loop counter.
663 * @pos: the &struct hlist_node to use as a loop counter.
664 * @head: the head for your list.
665 * @member: the name of the hlist_node within the struct.
666 */
667 #define hlist_for_each_entrycxx . . $ `include/linux_list.h:667:9`!(tpos, pos, head, member) \
668 for (pos = (head)->first; \
669 pos && ({ prefetch(pos->next); 1;}) && \
670 ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \
671 pos = pos->next)
672
673 /**
674 * hlist_for_each_entry_continue - iterate over a hlist continuing after existing point
675 * @tpos: the type * to use as a loop counter.
676 * @pos: the &struct hlist_node to use as a loop counter.
677 * @member: the name of the hlist_node within the struct.
678 */
679 #define hlist_for_each_entry_continuecxx . . $ `include/linux_list.h:679:9`!(tpos, pos, member) \
680 for (pos = (pos)->next; \
681 pos && ({ prefetch(pos->next); 1;}) && \
682 ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \
683 pos = pos->next)
684
685 /**
686 * hlist_for_each_entry_from - iterate over a hlist continuing from existing point
687 * @tpos: the type * to use as a loop counter.
688 * @pos: the &struct hlist_node to use as a loop counter.
689 * @member: the name of the hlist_node within the struct.
690 */
691 #define hlist_for_each_entry_fromcxx . . $ `include/linux_list.h:691:9`!(tpos, pos, member) \
692 for (; pos && ({ prefetch(pos->next); 1;}) && \
693 ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \
694 pos = pos->next)
695
696 /**
697 * hlist_for_each_entry_safe - iterate over list of given type safe against removal of list entry
698 * @tpos: the type * to use as a loop counter.
699 * @pos: the &struct hlist_node to use as a loop counter.
700 * @n: another &struct hlist_node to use as temporary storage
701 * @head: the head for your list.
702 * @member: the name of the hlist_node within the struct.
703 */
704 #define hlist_for_each_entry_safecxx . . $ `include/linux_list.h:704:9`!(tpos, pos, n, head, member) \
705 for (pos = (head)->first; \
706 pos && ({ n = pos->next; 1; }) && \
707 ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \
708 pos = n)
709
710 /**
711 * hlist_for_each_entry_rcu - iterate over rcu list of given type
712 * @pos: the type * to use as a loop counter.
713 * @pos: the &struct hlist_node to use as a loop counter.
714 * @head: the head for your list.
715 * @member: the name of the hlist_node within the struct.
716 *
717 * This list-traversal primitive may safely run concurrently with
718 * the _rcu list-mutation primitives such as hlist_add_rcu()
719 * as long as the traversal is guarded by rcu_read_lock().
720 */
721 #define hlist_for_each_entry_rcucxx . . $ `include/linux_list.h:721:9`!(tpos, pos, head, member) \
722 for (pos = (head)->first; \
723 pos && ({ prefetch(pos->next); 1;}) && \
724 ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \
725 pos = pos->next, ({ smp_read_barrier_depends(); 0; }) )
726
727 #endif