Debian Codegraph @

list-batman.h

raw symbols SCIP
1 /*
2 * Copyright (C) 2006-2012 B.A.T.M.A.N. contributors:
3 *
4 * Marek Lindner
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of version 2 of the GNU General Public
8 * License as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 * 02110-1301, USA
19 *
20 */
21
22
23 #ifndef _LINUX_LIST_H
24 #define _LINUX_LIST_Hcxx . . $ `list-batman.h:24:9`!
25
26 /*
27 * Simple linked list implementation.
28 *
29 * Some of the internal functions ("__xxx") are useful when
30 * manipulating whole lists rather than single entries, as
31 * sometimes we already know the next entries and we can
32 * generate better code by using them directly rather than
33 * using the generic single-entry routines.
34 */
35
36 struct list_headcxx . . $ list_head# {
37 struct list_headcxx . . $ list_head# *nextcxx . . $ list_head#next.;
38 };
39
40 struct list_head_firstcxx . . $ list_head_first# {
41 struct list_headcxx . . $ list_head# *nextcxx . . $ list_head_first#next., *prevcxx . . $ list_head_first#prev.;
42 };
43
44
45 void list_addcxx . . $ list_add(c9932e5dfcae05fa).( struct list_headcxx . . $ list_head# *new, struct list_head_firstcxx . . $ list_head_first# *head );
46 void list_add_tailcxx . . $ list_add_tail(c9932e5dfcae05fa).( struct list_headcxx . . $ list_head# *new, struct list_head_firstcxx . . $ list_head_first# *head );
47 void list_add_beforecxx . . $ list_add_before(a574ce21b3779bd1).( struct list_headcxx . . $ list_head# *prev_node, struct list_headcxx . . $ list_head# *next_node, struct list_headcxx . . $ list_head# *new_node );
48 void list_delcxx . . $ list_del(68233758eccab105).( struct list_headcxx . . $ list_head# *prev_entry, struct list_headcxx . . $ list_head# *entry, struct list_head_firstcxx . . $ list_head_first# *head );
49 int list_emptycxx . . $ list_empty(563a4e9834c4c63d).( struct list_head_firstcxx . . $ list_head_first# *head );
50
51
52
53 #define INIT_LIST_HEADcxx . . $ `list-batman.h:53:9`!(ptr) do { \
54 (ptr)->next = (ptr); \
55 } while (0)
56
57 #define INIT_LIST_HEAD_FIRSTcxx . . $ `list-batman.h:57:9`!(ptr) \
58 ptr.next = (struct list_head *)&ptr; ptr.prev = (struct list_head *)&ptr; \
59
60
61 /**
62 * list_entry - get the struct for this entry
63 * @ptr: the &struct list_head pointer.
64 * @type: the type of the struct this is embedded in.
65 * @member: the name of the list_struct within the struct.
66 */
67 #define list_entrycxx . . $ `list-batman.h:67:9`!(ptr, type, member) \
68 ((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member)))
69
70 /**
71 * list_for_each - iterate over a list
72 * @pos: the &struct list_head to use as a loop counter.
73 * @head: the head for your list.
74 */
75 #define list_for_eachcxx . . $ `list-batman.h:75:9`!(pos, head) \
76 for (pos = (head)->next; pos != (struct list_head *)(head); \
77 pos = pos->next)
78
79 /**
80 * list_for_each_safe - iterate over a list safe against removal of list entry
81 * @pos: the &struct list_head to use as a loop counter.
82 * @n: another &struct list_head to use as temporary storage
83 * @head: the head for your list.
84 */
85 #define list_for_each_safecxx . . $ `list-batman.h:85:9`!(pos, n, head) \
86 for (pos = (head)->next, n = pos->next; pos != (struct list_head *)(head); \
87 pos = n, n = pos->next)
88
89 /**
90 * list_for_each_entry - iterate over list of given type
91 * @pos: the type * to use as a loop counter.
92 * @head: the head for your list.
93 * @member: the name of the list_struct within the struct.
94 */
95 #define list_for_each_entrycxx . . $ `list-batman.h:95:9`!(pos, head, member) \
96 for (pos = list_entry((head)->next, typeof(*pos), member); \
97 &pos->member != (struct list_head *)(head); \
98 pos = list_entry(pos->member.next, typeof(*pos), member))
99
100 /**
101 * list_for_each_entry_safe - iterate over list of given type safe against removal of list entry
102 * @pos: the type * to use as a loop counter.
103 * @n: another type * to use as temporary storage
104 * @head: the head for your list.
105 * @member: the name of the list_struct within the struct.
106 */
107 #define list_for_each_entry_safecxx . . $ `list-batman.h:107:9`!(pos, n, head, member) \
108 for (pos = list_entry((head)->next, typeof(*pos), member), \
109 n = list_entry(pos->member.next, typeof(*pos), member); \
110 &pos->member != (struct list_head *)(head); \
111 pos = n, n = list_entry(n->member.next, typeof(*n), member))
112
113
114 #endif