Lines Matching +full:a +full:- +full:h

1 /* SPDX-License-Identifier: GPL-2.0 */
5 #include <linux/poison.h>
6 #include <linux/const.h>
9 * Special version of lists, where end of list is not a NULL pointer,
10 * but a 'nulls' marker, which can have many different values.
13 * In the standard hlist, termination of a list is the NULL pointer.
15 * a list are aligned on a word (4 or 8 bytes alignment).
17 * Set to 1 : This is a 'nulls' end-of-list marker (ptr >> 1)
18 * Set to 0 : This is a pointer to some object (ptr)
30 ((ptr)->first = (struct hlist_nulls_node *) NULLS_MARKER(nulls))
39 * ptr_is_a_nulls - Test if a ptr is a nulls
49 * get_nulls_value - Get the 'nulls' value of the end of chain
60 * hlist_nulls_unhashed - Has node been removed and reinitialized?
61 * @h: Node to be checked
63 * Not that not all removal functions will leave a node in unhashed state.
67 static inline int hlist_nulls_unhashed(const struct hlist_nulls_node *h) in hlist_nulls_unhashed() argument
69 return !h->pprev; in hlist_nulls_unhashed()
73 * hlist_nulls_unhashed_lockless - Has node been removed and reinitialized?
74 * @h: Node to be checked
76 * Not that not all removal functions will leave a node in unhashed state.
81 static inline int hlist_nulls_unhashed_lockless(const struct hlist_nulls_node *h) in hlist_nulls_unhashed_lockless() argument
83 return !READ_ONCE(h->pprev); in hlist_nulls_unhashed_lockless()
86 static inline int hlist_nulls_empty(const struct hlist_nulls_head *h) in hlist_nulls_empty() argument
88 return is_a_nulls(READ_ONCE(h->first)); in hlist_nulls_empty()
92 struct hlist_nulls_head *h) in hlist_nulls_add_head() argument
94 struct hlist_nulls_node *first = h->first; in hlist_nulls_add_head()
96 n->next = first; in hlist_nulls_add_head()
97 WRITE_ONCE(n->pprev, &h->first); in hlist_nulls_add_head()
98 h->first = n; in hlist_nulls_add_head()
100 WRITE_ONCE(first->pprev, &n->next); in hlist_nulls_add_head()
105 struct hlist_nulls_node *next = n->next; in __hlist_nulls_del()
106 struct hlist_nulls_node **pprev = n->pprev; in __hlist_nulls_del()
110 WRITE_ONCE(next->pprev, pprev); in __hlist_nulls_del()
116 WRITE_ONCE(n->pprev, LIST_POISON2); in hlist_nulls_del()
120 * hlist_nulls_for_each_entry - iterate over list of given type
121 * @tpos: the type * to use as a loop cursor.
122 * @pos: the &struct hlist_node to use as a loop cursor.
128 for (pos = (head)->first; \
131 pos = pos->next)
134 * hlist_nulls_for_each_entry_from - iterate over a hlist continuing from current point
135 * @tpos: the type * to use as a loop cursor.
136 * @pos: the &struct hlist_node to use as a loop cursor.
143 pos = pos->next)