\doxysection{linuxlist.\+h}
\label{linuxlist_8h_source}\index{include/osmocom/core/linuxlist.h@{include/osmocom/core/linuxlist.h}}
\textbf{ Go to the documentation of this file.}
\begin{DoxyCode}{0}
\DoxyCodeLine{1 }
\DoxyCodeLine{12 \textcolor{preprocessor}{\#pragma once}}
\DoxyCodeLine{13 }
\DoxyCodeLine{18 \textcolor{preprocessor}{\#include <stddef.h>}}
\DoxyCodeLine{19 \textcolor{preprocessor}{\#include <stdbool.h>}}
\DoxyCodeLine{20 }
\DoxyCodeLine{21 \textcolor{preprocessor}{\#ifndef inline}}
\DoxyCodeLine{22 \textcolor{preprocessor}{\#define inline \_\_inline\_\_}}
\DoxyCodeLine{23 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{24 }
\DoxyCodeLine{25 \textcolor{keyword}{static} \textcolor{keyword}{inline} \textcolor{keywordtype}{void} prefetch(\textcolor{keyword}{const} \textcolor{keywordtype}{void} *x) \{;\}}
\DoxyCodeLine{26 }
\DoxyCodeLine{32 \textcolor{preprocessor}{\#define container\_of(ptr, type, member) (\{                      \(\backslash\)}}
\DoxyCodeLine{33 \textcolor{preprocessor}{        const typeof( ((type *)0)-\/>member ) *\_\_mptr = (ptr);    \(\backslash\)}}
\DoxyCodeLine{34 \textcolor{preprocessor}{        (type *)( (char *)\_\_mptr -\/ offsetof(type, member) );\})}}
\DoxyCodeLine{35 }
\DoxyCodeLine{36 }
\DoxyCodeLine{42 \textcolor{preprocessor}{\#define LLIST\_POISON1  ((void *) 0x00100100)}}
\DoxyCodeLine{43 \textcolor{preprocessor}{\#define LLIST\_POISON2  ((void *) 0x00200200)}}
\DoxyCodeLine{44 }
\DoxyCodeLine{46 \textcolor{keyword}{struct }llist\_head \{}
\DoxyCodeLine{48         \textcolor{keyword}{struct }llist\_head *next, *prev;}
\DoxyCodeLine{49 \};}
\DoxyCodeLine{50 }
\DoxyCodeLine{54 \textcolor{preprocessor}{\#define LLIST\_HEAD\_INIT(name) \{ \&(name), \&(name) \}}}
\DoxyCodeLine{55 }
\DoxyCodeLine{59 \textcolor{preprocessor}{\#define LLIST\_HEAD(name) \(\backslash\)}}
\DoxyCodeLine{60 \textcolor{preprocessor}{        struct llist\_head name = LLIST\_HEAD\_INIT(name)}}
\DoxyCodeLine{61 }
\DoxyCodeLine{65 \textcolor{preprocessor}{\#define INIT\_LLIST\_HEAD(ptr) do \{ \(\backslash\)}}
\DoxyCodeLine{66 \textcolor{preprocessor}{        (ptr)-\/>next = (ptr); (ptr)-\/>prev = (ptr); \(\backslash\)}}
\DoxyCodeLine{67 \textcolor{preprocessor}{\} while (0)}}
\DoxyCodeLine{68 }
\DoxyCodeLine{69 \textcolor{comment}{/*}}
\DoxyCodeLine{70 \textcolor{comment}{ * Insert a new entry between two known consecutive entries.}}
\DoxyCodeLine{71 \textcolor{comment}{ *}}
\DoxyCodeLine{72 \textcolor{comment}{ * This is only for internal llist manipulation where we know}}
\DoxyCodeLine{73 \textcolor{comment}{ * the prev/next entries already!}}
\DoxyCodeLine{74 \textcolor{comment}{ */}}
\DoxyCodeLine{75 \textcolor{keyword}{static} \textcolor{keyword}{inline} \textcolor{keywordtype}{void} \_\_llist\_add(\textcolor{keyword}{struct} llist\_head *\_new,}
\DoxyCodeLine{76                                \textcolor{keyword}{struct} llist\_head *prev,}
\DoxyCodeLine{77                                \textcolor{keyword}{struct} llist\_head *next)}
\DoxyCodeLine{78 \{}
\DoxyCodeLine{79         next-\/>prev = \_new;}
\DoxyCodeLine{80         \_new-\/>next = next;}
\DoxyCodeLine{81         \_new-\/>prev = prev;}
\DoxyCodeLine{82         prev-\/>next = \_new;}
\DoxyCodeLine{83 \}}
\DoxyCodeLine{84 }
\DoxyCodeLine{92 \textcolor{keyword}{static} \textcolor{keyword}{inline} \textcolor{keywordtype}{void} llist\_add(\textcolor{keyword}{struct} llist\_head *\_new, \textcolor{keyword}{struct} llist\_head *head)}
\DoxyCodeLine{93 \{}
\DoxyCodeLine{94         \_\_llist\_add(\_new, head, head-\/>next);}
\DoxyCodeLine{95 \}}
\DoxyCodeLine{96 }
\DoxyCodeLine{104 \textcolor{keyword}{static} \textcolor{keyword}{inline} \textcolor{keywordtype}{void} llist\_add\_tail(\textcolor{keyword}{struct} llist\_head *\_new, \textcolor{keyword}{struct} llist\_head *head)}
\DoxyCodeLine{105 \{}
\DoxyCodeLine{106         \_\_llist\_add(\_new, head-\/>prev, head);}
\DoxyCodeLine{107 \}}
\DoxyCodeLine{108 }
\DoxyCodeLine{109 \textcolor{comment}{/*}}
\DoxyCodeLine{110 \textcolor{comment}{ * Delete a llist entry by making the prev/next entries}}
\DoxyCodeLine{111 \textcolor{comment}{ * point to each other.}}
\DoxyCodeLine{112 \textcolor{comment}{ *}}
\DoxyCodeLine{113 \textcolor{comment}{ * This is only for internal llist manipulation where we know}}
\DoxyCodeLine{114 \textcolor{comment}{ * the prev/next entries already!}}
\DoxyCodeLine{115 \textcolor{comment}{ */}}
\DoxyCodeLine{116 \textcolor{keyword}{static} \textcolor{keyword}{inline} \textcolor{keywordtype}{void} \_\_llist\_del(\textcolor{keyword}{struct} llist\_head * prev, \textcolor{keyword}{struct} llist\_head * next)}
\DoxyCodeLine{117 \{}
\DoxyCodeLine{118         next-\/>prev = prev;}
\DoxyCodeLine{119         prev-\/>next = next;}
\DoxyCodeLine{120 \}}
\DoxyCodeLine{121 }
\DoxyCodeLine{128 \textcolor{keyword}{static} \textcolor{keyword}{inline} \textcolor{keywordtype}{void} llist\_del(\textcolor{keyword}{struct} llist\_head *entry)}
\DoxyCodeLine{129 \{}
\DoxyCodeLine{130         \_\_llist\_del(entry-\/>prev, entry-\/>next);}
\DoxyCodeLine{131         entry-\/>next = (\textcolor{keyword}{struct }llist\_head *)LLIST\_POISON1;}
\DoxyCodeLine{132         entry-\/>prev = (\textcolor{keyword}{struct }llist\_head *)LLIST\_POISON2;}
\DoxyCodeLine{133 \}}
\DoxyCodeLine{134 }
\DoxyCodeLine{138 \textcolor{keyword}{static} \textcolor{keyword}{inline} \textcolor{keywordtype}{void} llist\_del\_init(\textcolor{keyword}{struct} llist\_head *entry)}
\DoxyCodeLine{139 \{}
\DoxyCodeLine{140         \_\_llist\_del(entry-\/>prev, entry-\/>next);}
\DoxyCodeLine{141         INIT\_LLIST\_HEAD(entry);}
\DoxyCodeLine{142 \}}
\DoxyCodeLine{143 }
\DoxyCodeLine{148 \textcolor{keyword}{static} \textcolor{keyword}{inline} \textcolor{keywordtype}{void} llist\_move(\textcolor{keyword}{struct} llist\_head *llist, \textcolor{keyword}{struct} llist\_head *head)}
\DoxyCodeLine{149 \{}
\DoxyCodeLine{150         \_\_llist\_del(llist-\/>prev, llist-\/>next);}
\DoxyCodeLine{151         llist\_add(llist, head);}
\DoxyCodeLine{152 \}}
\DoxyCodeLine{153 }
\DoxyCodeLine{158 \textcolor{keyword}{static} \textcolor{keyword}{inline} \textcolor{keywordtype}{void} llist\_move\_tail(\textcolor{keyword}{struct} llist\_head *llist,}
\DoxyCodeLine{159                                    \textcolor{keyword}{struct} llist\_head *head)}
\DoxyCodeLine{160 \{}
\DoxyCodeLine{161         \_\_llist\_del(llist-\/>prev, llist-\/>next);}
\DoxyCodeLine{162         llist\_add\_tail(llist, head);}
\DoxyCodeLine{163 \}}
\DoxyCodeLine{164 }
\DoxyCodeLine{169 \textcolor{keyword}{static} \textcolor{keyword}{inline} \textcolor{keywordtype}{int} llist\_empty(\textcolor{keyword}{const} \textcolor{keyword}{struct} llist\_head *head)}
\DoxyCodeLine{170 \{}
\DoxyCodeLine{171         \textcolor{keywordflow}{return} head-\/>next == head;}
\DoxyCodeLine{172 \}}
\DoxyCodeLine{173 }
\DoxyCodeLine{174 \textcolor{keyword}{static} \textcolor{keyword}{inline} \textcolor{keywordtype}{void} \_\_llist\_splice(\textcolor{keyword}{struct} llist\_head *llist,}
\DoxyCodeLine{175                                   \textcolor{keyword}{struct} llist\_head *head)}
\DoxyCodeLine{176 \{}
\DoxyCodeLine{177         \textcolor{keyword}{struct }llist\_head *first = llist-\/>next;}
\DoxyCodeLine{178         \textcolor{keyword}{struct }llist\_head *last = llist-\/>prev;}
\DoxyCodeLine{179         \textcolor{keyword}{struct }llist\_head *at = head-\/>next;}
\DoxyCodeLine{180 }
\DoxyCodeLine{181         first-\/>prev = head;}
\DoxyCodeLine{182         head-\/>next = first;}
\DoxyCodeLine{183 }
\DoxyCodeLine{184         last-\/>next = at;}
\DoxyCodeLine{185         at-\/>prev = last;}
\DoxyCodeLine{186 \}}
\DoxyCodeLine{187 }
\DoxyCodeLine{192 \textcolor{keyword}{static} \textcolor{keyword}{inline} \textcolor{keywordtype}{void} llist\_splice(\textcolor{keyword}{struct} llist\_head *llist, \textcolor{keyword}{struct} llist\_head *head)}
\DoxyCodeLine{193 \{}
\DoxyCodeLine{194         \textcolor{keywordflow}{if} (!llist\_empty(llist))}
\DoxyCodeLine{195                 \_\_llist\_splice(llist, head);}
\DoxyCodeLine{196 \}}
\DoxyCodeLine{197 }
\DoxyCodeLine{204 \textcolor{keyword}{static} \textcolor{keyword}{inline} \textcolor{keywordtype}{void} llist\_splice\_init(\textcolor{keyword}{struct} llist\_head *llist,}
\DoxyCodeLine{205                                      \textcolor{keyword}{struct} llist\_head *head)}
\DoxyCodeLine{206 \{}
\DoxyCodeLine{207         \textcolor{keywordflow}{if} (!llist\_empty(llist)) \{}
\DoxyCodeLine{208                 \_\_llist\_splice(llist, head);}
\DoxyCodeLine{209                 INIT\_LLIST\_HEAD(llist);}
\DoxyCodeLine{210         \}}
\DoxyCodeLine{211 \}}
\DoxyCodeLine{212 }
\DoxyCodeLine{218 \textcolor{preprocessor}{\#define llist\_entry(ptr, type, member) \(\backslash\)}}
\DoxyCodeLine{219 \textcolor{preprocessor}{        container\_of(ptr, type, member)}}
\DoxyCodeLine{220 }
\DoxyCodeLine{228 \textcolor{preprocessor}{\#define llist\_first\_entry(ptr, type, member) \(\backslash\)}}
\DoxyCodeLine{229 \textcolor{preprocessor}{        llist\_entry((ptr)-\/>next, type, member)}}
\DoxyCodeLine{230 }
\DoxyCodeLine{238 \textcolor{preprocessor}{\#define llist\_last\_entry(ptr, type, member) \(\backslash\)}}
\DoxyCodeLine{239 \textcolor{preprocessor}{        llist\_entry((ptr)-\/>prev, type, member)}}
\DoxyCodeLine{240 }
\DoxyCodeLine{245 \textcolor{preprocessor}{\#define llist\_last(head) (head)-\/>prev}}
\DoxyCodeLine{246 }
\DoxyCodeLine{254 \textcolor{preprocessor}{\#define llist\_first\_entry\_or\_null(ptr, type, member) \(\backslash\)}}
\DoxyCodeLine{255 \textcolor{preprocessor}{        (!llist\_empty(ptr) ? llist\_first\_entry(ptr, type, member) : NULL)}}
\DoxyCodeLine{256 }
\DoxyCodeLine{261 \textcolor{preprocessor}{\#define llist\_for\_each(pos, head) \(\backslash\)}}
\DoxyCodeLine{262 \textcolor{preprocessor}{        for (pos = (head)-\/>next, prefetch(pos-\/>next); pos != (head); \(\backslash\)}}
\DoxyCodeLine{263 \textcolor{preprocessor}{                pos = pos-\/>next, prefetch(pos-\/>next))}}
\DoxyCodeLine{264 }
\DoxyCodeLine{274 \textcolor{preprocessor}{\#define \_\_llist\_for\_each(pos, head) \(\backslash\)}}
\DoxyCodeLine{275 \textcolor{preprocessor}{        for (pos = (head)-\/>next; pos != (head); pos = pos-\/>next)}}
\DoxyCodeLine{276 }
\DoxyCodeLine{281 \textcolor{preprocessor}{\#define llist\_for\_each\_prev(pos, head) \(\backslash\)}}
\DoxyCodeLine{282 \textcolor{preprocessor}{        for (pos = (head)-\/>prev, prefetch(pos-\/>prev); pos != (head); \(\backslash\)}}
\DoxyCodeLine{283 \textcolor{preprocessor}{                pos = pos-\/>prev, prefetch(pos-\/>prev))}}
\DoxyCodeLine{284 }
\DoxyCodeLine{290 \textcolor{preprocessor}{\#define llist\_for\_each\_safe(pos, n, head) \(\backslash\)}}
\DoxyCodeLine{291 \textcolor{preprocessor}{        for (pos = (head)-\/>next, n = pos-\/>next; pos != (head); \(\backslash\)}}
\DoxyCodeLine{292 \textcolor{preprocessor}{                pos = n, n = pos-\/>next)}}
\DoxyCodeLine{293 }
\DoxyCodeLine{299 \textcolor{preprocessor}{\#define llist\_for\_each\_entry(pos, head, member)                         \(\backslash\)}}
\DoxyCodeLine{300 \textcolor{preprocessor}{        for (pos = llist\_entry((head)-\/>next, typeof(*pos), member),     \(\backslash\)}}
\DoxyCodeLine{301 \textcolor{preprocessor}{                     prefetch(pos-\/>member.next);                        \(\backslash\)}}
\DoxyCodeLine{302 \textcolor{preprocessor}{             \&pos-\/>member != (head);                                    \(\backslash\)}}
\DoxyCodeLine{303 \textcolor{preprocessor}{             pos = llist\_entry(pos-\/>member.next, typeof(*pos), member), \(\backslash\)}}
\DoxyCodeLine{304 \textcolor{preprocessor}{                     prefetch(pos-\/>member.next))}}
\DoxyCodeLine{305 }
\DoxyCodeLine{311 \textcolor{preprocessor}{\#define llist\_for\_each\_entry\_reverse(pos, head, member)                 \(\backslash\)}}
\DoxyCodeLine{312 \textcolor{preprocessor}{        for (pos = llist\_entry((head)-\/>prev, typeof(*pos), member),     \(\backslash\)}}
\DoxyCodeLine{313 \textcolor{preprocessor}{                     prefetch(pos-\/>member.prev);                        \(\backslash\)}}
\DoxyCodeLine{314 \textcolor{preprocessor}{             \&pos-\/>member != (head);                                    \(\backslash\)}}
\DoxyCodeLine{315 \textcolor{preprocessor}{             pos = llist\_entry(pos-\/>member.prev, typeof(*pos), member), \(\backslash\)}}
\DoxyCodeLine{316 \textcolor{preprocessor}{                     prefetch(pos-\/>member.prev))}}
\DoxyCodeLine{317 }
\DoxyCodeLine{324 \textcolor{preprocessor}{\#define llist\_for\_each\_entry\_continue(pos, head, member)                \(\backslash\)}}
\DoxyCodeLine{325 \textcolor{preprocessor}{        for (pos = llist\_entry(pos-\/>member.next, typeof(*pos), member), \(\backslash\)}}
\DoxyCodeLine{326 \textcolor{preprocessor}{                     prefetch(pos-\/>member.next);                        \(\backslash\)}}
\DoxyCodeLine{327 \textcolor{preprocessor}{             \&pos-\/>member != (head);                                    \(\backslash\)}}
\DoxyCodeLine{328 \textcolor{preprocessor}{             pos = llist\_entry(pos-\/>member.next, typeof(*pos), member), \(\backslash\)}}
\DoxyCodeLine{329 \textcolor{preprocessor}{                     prefetch(pos-\/>member.next))}}
\DoxyCodeLine{330 }
\DoxyCodeLine{337 \textcolor{preprocessor}{\#define llist\_for\_each\_entry\_safe(pos, n, head, member)                 \(\backslash\)}}
\DoxyCodeLine{338 \textcolor{preprocessor}{        for (pos = llist\_entry((head)-\/>next, typeof(*pos), member),     \(\backslash\)}}
\DoxyCodeLine{339 \textcolor{preprocessor}{                n = llist\_entry(pos-\/>member.next, typeof(*pos), member);        \(\backslash\)}}
\DoxyCodeLine{340 \textcolor{preprocessor}{             \&pos-\/>member != (head);                                    \(\backslash\)}}
\DoxyCodeLine{341 \textcolor{preprocessor}{             pos = n, n = llist\_entry(n-\/>member.next, typeof(*n), member))}}
\DoxyCodeLine{342 }
\DoxyCodeLine{347 \textcolor{preprocessor}{\#define llist\_for\_each\_rcu(pos, head) \(\backslash\)}}
\DoxyCodeLine{348 \textcolor{preprocessor}{        for (pos = (head)-\/>next, prefetch(pos-\/>next); pos != (head); \(\backslash\)}}
\DoxyCodeLine{349 \textcolor{preprocessor}{                pos = pos-\/>next, (\{ smp\_read\_barrier\_depends(); 0;\}), prefetch(pos-\/>next))}}
\DoxyCodeLine{350 }
\DoxyCodeLine{351 \textcolor{preprocessor}{\#define \_\_llist\_for\_each\_rcu(pos, head) \(\backslash\)}}
\DoxyCodeLine{352 \textcolor{preprocessor}{        for (pos = (head)-\/>next; pos != (head); \(\backslash\)}}
\DoxyCodeLine{353 \textcolor{preprocessor}{                pos = pos-\/>next, (\{ smp\_read\_barrier\_depends(); 0;\}))}}
\DoxyCodeLine{354 }
\DoxyCodeLine{360 \textcolor{preprocessor}{\#define llist\_for\_each\_safe\_rcu(pos, n, head) \(\backslash\)}}
\DoxyCodeLine{361 \textcolor{preprocessor}{        for (pos = (head)-\/>next, n = pos-\/>next; pos != (head); \(\backslash\)}}
\DoxyCodeLine{362 \textcolor{preprocessor}{                pos = n, (\{ smp\_read\_barrier\_depends(); 0;\}), n = pos-\/>next)}}
\DoxyCodeLine{363 }
\DoxyCodeLine{369 \textcolor{preprocessor}{\#define llist\_for\_each\_entry\_rcu(pos, head, member)                     \(\backslash\)}}
\DoxyCodeLine{370 \textcolor{preprocessor}{        for (pos = llist\_entry((head)-\/>next, typeof(*pos), member),     \(\backslash\)}}
\DoxyCodeLine{371 \textcolor{preprocessor}{                     prefetch(pos-\/>member.next);                        \(\backslash\)}}
\DoxyCodeLine{372 \textcolor{preprocessor}{             \&pos-\/>member != (head);                                    \(\backslash\)}}
\DoxyCodeLine{373 \textcolor{preprocessor}{             pos = llist\_entry(pos-\/>member.next, typeof(*pos), member), \(\backslash\)}}
\DoxyCodeLine{374 \textcolor{preprocessor}{                     (\{ smp\_read\_barrier\_depends(); 0;\}),               \(\backslash\)}}
\DoxyCodeLine{375 \textcolor{preprocessor}{                     prefetch(pos-\/>member.next))}}
\DoxyCodeLine{376 }
\DoxyCodeLine{377 }
\DoxyCodeLine{382 \textcolor{preprocessor}{\#define llist\_for\_each\_continue\_rcu(pos, head) \(\backslash\)}}
\DoxyCodeLine{383 \textcolor{preprocessor}{        for ((pos) = (pos)-\/>next, prefetch((pos)-\/>next); (pos) != (head); \(\backslash\)}}
\DoxyCodeLine{384 \textcolor{preprocessor}{                (pos) = (pos)-\/>next, (\{ smp\_read\_barrier\_depends(); 0;\}), prefetch((pos)-\/>next))}}
\DoxyCodeLine{385 }
\DoxyCodeLine{393 \textcolor{keyword}{static} \textcolor{keyword}{inline} \textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{int} llist\_count(\textcolor{keyword}{const} \textcolor{keyword}{struct} llist\_head *head)}
\DoxyCodeLine{394 \{}
\DoxyCodeLine{395         \textcolor{keyword}{struct }llist\_head *entry;}
\DoxyCodeLine{396         \textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{int} i = 0;}
\DoxyCodeLine{397         llist\_for\_each(entry, head)}
\DoxyCodeLine{398                 i++;}
\DoxyCodeLine{399         \textcolor{keywordflow}{return} i;}
\DoxyCodeLine{400 \}}
\DoxyCodeLine{401 }
\DoxyCodeLine{402 }
\DoxyCodeLine{403 }
\DoxyCodeLine{410 \textcolor{keyword}{struct }hlist\_head \{}
\DoxyCodeLine{411         \textcolor{keyword}{struct }hlist\_node *first;}
\DoxyCodeLine{412 \};}
\DoxyCodeLine{413 }
\DoxyCodeLine{414 \textcolor{keyword}{struct }hlist\_node \{}
\DoxyCodeLine{415         \textcolor{keyword}{struct }hlist\_node *next, **pprev;}
\DoxyCodeLine{416 \};}
\DoxyCodeLine{417 }
\DoxyCodeLine{418 \textcolor{preprocessor}{\#define HLIST\_HEAD\_INIT \{ .first = NULL \}}}
\DoxyCodeLine{419 \textcolor{preprocessor}{\#define HLIST\_HEAD(name) struct hlist\_head name = \{  .first = NULL \}}}
\DoxyCodeLine{420 \textcolor{preprocessor}{\#define INIT\_HLIST\_HEAD(ptr) ((ptr)-\/>first = NULL)}}
\DoxyCodeLine{421 \textcolor{keyword}{static} \textcolor{keyword}{inline} \textcolor{keywordtype}{void} INIT\_HLIST\_NODE(\textcolor{keyword}{struct} hlist\_node *h)}
\DoxyCodeLine{422 \{}
\DoxyCodeLine{423         h-\/>next = NULL;}
\DoxyCodeLine{424         h-\/>pprev = NULL;}
\DoxyCodeLine{425 \}}
\DoxyCodeLine{426 }
\DoxyCodeLine{427 \textcolor{preprocessor}{\#define READ\_ONCE(x)    x}}
\DoxyCodeLine{428 \textcolor{preprocessor}{\#define WRITE\_ONCE(a, b) a = b}}
\DoxyCodeLine{429 }
\DoxyCodeLine{438 \textcolor{keyword}{static} \textcolor{keyword}{inline} \textcolor{keywordtype}{int} hlist\_unhashed(\textcolor{keyword}{const} \textcolor{keyword}{struct} hlist\_node *h)}
\DoxyCodeLine{439 \{}
\DoxyCodeLine{440         \textcolor{keywordflow}{return} !h-\/>pprev;}
\DoxyCodeLine{441 \}}
\DoxyCodeLine{442 }
\DoxyCodeLine{451 \textcolor{keyword}{static} \textcolor{keyword}{inline} \textcolor{keywordtype}{int} hlist\_unhashed\_lockless(\textcolor{keyword}{const} \textcolor{keyword}{struct} hlist\_node *h)}
\DoxyCodeLine{452 \{}
\DoxyCodeLine{453         \textcolor{keywordflow}{return} !READ\_ONCE(h-\/>pprev);}
\DoxyCodeLine{454 \}}
\DoxyCodeLine{455 }
\DoxyCodeLine{460 \textcolor{keyword}{static} \textcolor{keyword}{inline} \textcolor{keywordtype}{int} hlist\_empty(\textcolor{keyword}{const} \textcolor{keyword}{struct} hlist\_head *h)}
\DoxyCodeLine{461 \{}
\DoxyCodeLine{462         \textcolor{keywordflow}{return} !READ\_ONCE(h-\/>first);}
\DoxyCodeLine{463 \}}
\DoxyCodeLine{464 }
\DoxyCodeLine{465 \textcolor{keyword}{static} \textcolor{keyword}{inline} \textcolor{keywordtype}{void} \_\_hlist\_del(\textcolor{keyword}{struct} hlist\_node *n)}
\DoxyCodeLine{466 \{}
\DoxyCodeLine{467         \textcolor{keyword}{struct }hlist\_node *next = n-\/>next;}
\DoxyCodeLine{468         \textcolor{keyword}{struct }hlist\_node **pprev = n-\/>pprev;}
\DoxyCodeLine{469 }
\DoxyCodeLine{470         WRITE\_ONCE(*pprev, next);}
\DoxyCodeLine{471         \textcolor{keywordflow}{if} (next)}
\DoxyCodeLine{472                 WRITE\_ONCE(next-\/>pprev, pprev);}
\DoxyCodeLine{473 \}}
\DoxyCodeLine{474 }
\DoxyCodeLine{481 \textcolor{keyword}{static} \textcolor{keyword}{inline} \textcolor{keywordtype}{void} hlist\_del(\textcolor{keyword}{struct} hlist\_node *n)}
\DoxyCodeLine{482 \{}
\DoxyCodeLine{483         \_\_hlist\_del(n);}
\DoxyCodeLine{484         n-\/>next = (\textcolor{keyword}{struct }hlist\_node *)LLIST\_POISON1;}
\DoxyCodeLine{485         n-\/>pprev = (\textcolor{keyword}{struct }hlist\_node **)LLIST\_POISON2;}
\DoxyCodeLine{486 \}}
\DoxyCodeLine{487 }
\DoxyCodeLine{493 \textcolor{keyword}{static} \textcolor{keyword}{inline} \textcolor{keywordtype}{void} hlist\_del\_init(\textcolor{keyword}{struct} hlist\_node *n)}
\DoxyCodeLine{494 \{}
\DoxyCodeLine{495         \textcolor{keywordflow}{if} (!hlist\_unhashed(n)) \{}
\DoxyCodeLine{496                 \_\_hlist\_del(n);}
\DoxyCodeLine{497                 INIT\_HLIST\_NODE(n);}
\DoxyCodeLine{498         \}}
\DoxyCodeLine{499 \}}
\DoxyCodeLine{500 }
\DoxyCodeLine{508 \textcolor{keyword}{static} \textcolor{keyword}{inline} \textcolor{keywordtype}{void} hlist\_add\_head(\textcolor{keyword}{struct} hlist\_node *n, \textcolor{keyword}{struct} hlist\_head *h)}
\DoxyCodeLine{509 \{}
\DoxyCodeLine{510         \textcolor{keyword}{struct }hlist\_node *first = h-\/>first;}
\DoxyCodeLine{511         WRITE\_ONCE(n-\/>next, first);}
\DoxyCodeLine{512         \textcolor{keywordflow}{if} (first)}
\DoxyCodeLine{513                 WRITE\_ONCE(first-\/>pprev, \&n-\/>next);}
\DoxyCodeLine{514         WRITE\_ONCE(h-\/>first, n);}
\DoxyCodeLine{515         WRITE\_ONCE(n-\/>pprev, \&h-\/>first);}
\DoxyCodeLine{516 \}}
\DoxyCodeLine{517 }
\DoxyCodeLine{522 \textcolor{keyword}{static} \textcolor{keyword}{inline} \textcolor{keywordtype}{void} hlist\_add\_before(\textcolor{keyword}{struct} hlist\_node *n,}
\DoxyCodeLine{523                                     \textcolor{keyword}{struct} hlist\_node *next)}
\DoxyCodeLine{524 \{}
\DoxyCodeLine{525         WRITE\_ONCE(n-\/>pprev, next-\/>pprev);}
\DoxyCodeLine{526         WRITE\_ONCE(n-\/>next, next);}
\DoxyCodeLine{527         WRITE\_ONCE(next-\/>pprev, \&n-\/>next);}
\DoxyCodeLine{528         WRITE\_ONCE(*(n-\/>pprev), n);}
\DoxyCodeLine{529 \}}
\DoxyCodeLine{530 }
\DoxyCodeLine{535 \textcolor{keyword}{static} \textcolor{keyword}{inline} \textcolor{keywordtype}{void} hlist\_add\_behind(\textcolor{keyword}{struct} hlist\_node *n,}
\DoxyCodeLine{536                                     \textcolor{keyword}{struct} hlist\_node *prev)}
\DoxyCodeLine{537 \{}
\DoxyCodeLine{538         WRITE\_ONCE(n-\/>next, prev-\/>next);}
\DoxyCodeLine{539         WRITE\_ONCE(prev-\/>next, n);}
\DoxyCodeLine{540         WRITE\_ONCE(n-\/>pprev, \&prev-\/>next);}
\DoxyCodeLine{541 }
\DoxyCodeLine{542         \textcolor{keywordflow}{if} (n-\/>next)}
\DoxyCodeLine{543                 WRITE\_ONCE(n-\/>next-\/>pprev, \&n-\/>next);}
\DoxyCodeLine{544 \}}
\DoxyCodeLine{545 }
\DoxyCodeLine{553 \textcolor{keyword}{static} \textcolor{keyword}{inline} \textcolor{keywordtype}{void} hlist\_add\_fake(\textcolor{keyword}{struct} hlist\_node *n)}
\DoxyCodeLine{554 \{}
\DoxyCodeLine{555         n-\/>pprev = \&n-\/>next;}
\DoxyCodeLine{556 \}}
\DoxyCodeLine{557 }
\DoxyCodeLine{561 \textcolor{keyword}{static} \textcolor{keyword}{inline} \textcolor{keywordtype}{bool} hlist\_fake(\textcolor{keyword}{struct} hlist\_node *h)}
\DoxyCodeLine{562 \{}
\DoxyCodeLine{563         \textcolor{keywordflow}{return} h-\/>pprev == \&h-\/>next;}
\DoxyCodeLine{564 \}}
\DoxyCodeLine{565 }
\DoxyCodeLine{573 \textcolor{keyword}{static} \textcolor{keyword}{inline} \textcolor{keywordtype}{bool}}
\DoxyCodeLine{574 hlist\_is\_singular\_node(\textcolor{keyword}{struct} hlist\_node *n, \textcolor{keyword}{struct} hlist\_head *h)}
\DoxyCodeLine{575 \{}
\DoxyCodeLine{576         \textcolor{keywordflow}{return} !n-\/>next \&\& n-\/>pprev == \&h-\/>first;}
\DoxyCodeLine{577 \}}
\DoxyCodeLine{578 }
\DoxyCodeLine{586 \textcolor{keyword}{static} \textcolor{keyword}{inline} \textcolor{keywordtype}{void} hlist\_move\_list(\textcolor{keyword}{struct} hlist\_head *old,}
\DoxyCodeLine{587                                    \textcolor{keyword}{struct} hlist\_head *\_new)}
\DoxyCodeLine{588 \{}
\DoxyCodeLine{589         \_new-\/>first = old-\/>first;}
\DoxyCodeLine{590         \textcolor{keywordflow}{if} (\_new-\/>first)}
\DoxyCodeLine{591                 \_new-\/>first-\/>pprev = \&\_new-\/>first;}
\DoxyCodeLine{592         old-\/>first = NULL;}
\DoxyCodeLine{593 \}}
\DoxyCodeLine{594 }
\DoxyCodeLine{595 \textcolor{preprocessor}{\#define hlist\_entry(ptr, type, member) container\_of(ptr,type,member)}}
\DoxyCodeLine{596 }
\DoxyCodeLine{597 \textcolor{preprocessor}{\#define hlist\_for\_each(pos, head) \(\backslash\)}}
\DoxyCodeLine{598 \textcolor{preprocessor}{        for (pos = (head)-\/>first; pos ; pos = pos-\/>next)}}
\DoxyCodeLine{599 }
\DoxyCodeLine{600 \textcolor{preprocessor}{\#define hlist\_for\_each\_safe(pos, n, head) \(\backslash\)}}
\DoxyCodeLine{601 \textcolor{preprocessor}{        for (pos = (head)-\/>first; pos \&\& (\{ n = pos-\/>next; 1; \}); \(\backslash\)}}
\DoxyCodeLine{602 \textcolor{preprocessor}{             pos = n)}}
\DoxyCodeLine{603 }
\DoxyCodeLine{604 \textcolor{preprocessor}{\#define hlist\_entry\_safe(ptr, type, member) \(\backslash\)}}
\DoxyCodeLine{605 \textcolor{preprocessor}{        (\{ typeof(ptr) \_\_\_\_ptr = (ptr); \(\backslash\)}}
\DoxyCodeLine{606 \textcolor{preprocessor}{           \_\_\_\_ptr ? hlist\_entry(\_\_\_\_ptr, type, member) : NULL; \(\backslash\)}}
\DoxyCodeLine{607 \textcolor{preprocessor}{        \})}}
\DoxyCodeLine{608 }
\DoxyCodeLine{614 \textcolor{preprocessor}{\#define hlist\_for\_each\_entry(pos, head, member)                         \(\backslash\)}}
\DoxyCodeLine{615 \textcolor{preprocessor}{        for (pos = hlist\_entry\_safe((head)-\/>first, typeof(*(pos)), member);\(\backslash\)}}
\DoxyCodeLine{616 \textcolor{preprocessor}{             pos;                                                       \(\backslash\)}}
\DoxyCodeLine{617 \textcolor{preprocessor}{             pos = hlist\_entry\_safe((pos)-\/>member.next, typeof(*(pos)), member))}}
\DoxyCodeLine{618 }
\DoxyCodeLine{623 \textcolor{preprocessor}{\#define hlist\_for\_each\_entry\_continue(pos, member)                      \(\backslash\)}}
\DoxyCodeLine{624 \textcolor{preprocessor}{        for (pos = hlist\_entry\_safe((pos)-\/>member.next, typeof(*(pos)), member);\(\backslash\)}}
\DoxyCodeLine{625 \textcolor{preprocessor}{             pos;                                                       \(\backslash\)}}
\DoxyCodeLine{626 \textcolor{preprocessor}{             pos = hlist\_entry\_safe((pos)-\/>member.next, typeof(*(pos)), member))}}
\DoxyCodeLine{627 }
\DoxyCodeLine{632 \textcolor{preprocessor}{\#define hlist\_for\_each\_entry\_from(pos, member)                          \(\backslash\)}}
\DoxyCodeLine{633 \textcolor{preprocessor}{        for (; pos;                                                     \(\backslash\)}}
\DoxyCodeLine{634 \textcolor{preprocessor}{             pos = hlist\_entry\_safe((pos)-\/>member.next, typeof(*(pos)), member))}}
\DoxyCodeLine{635 }
\DoxyCodeLine{642 \textcolor{preprocessor}{\#define hlist\_for\_each\_entry\_safe(pos, n, head, member)                 \(\backslash\)}}
\DoxyCodeLine{643 \textcolor{preprocessor}{        for (pos = hlist\_entry\_safe((head)-\/>first, typeof(*pos), member);\(\backslash\)}}
\DoxyCodeLine{644 \textcolor{preprocessor}{             pos \&\& (\{ n = pos-\/>member.next; 1; \});                     \(\backslash\)}}
\DoxyCodeLine{645 \textcolor{preprocessor}{             pos = hlist\_entry\_safe(n, typeof(*pos), member))}}
\DoxyCodeLine{646 }
\DoxyCodeLine{647 }

\end{DoxyCode}
