hc
2024-01-05 071106ecf68c401173c58808b1cf5f68cc50d390
kernel/include/linux/rculist_nulls.h
....@@ -38,9 +38,17 @@
3838 }
3939 }
4040
41
+/**
42
+ * hlist_nulls_first_rcu - returns the first element of the hash list.
43
+ * @head: the head of the list.
44
+ */
4145 #define hlist_nulls_first_rcu(head) \
4246 (*((struct hlist_nulls_node __rcu __force **)&(head)->first))
4347
48
+/**
49
+ * hlist_nulls_next_rcu - returns the element of the list after @node.
50
+ * @node: element of the list.
51
+ */
4452 #define hlist_nulls_next_rcu(node) \
4553 (*((struct hlist_nulls_node __rcu __force **)&(node)->next))
4654
....@@ -137,17 +145,24 @@
137145 }
138146 }
139147
148
+/* after that hlist_nulls_del will work */
149
+static inline void hlist_nulls_add_fake(struct hlist_nulls_node *n)
150
+{
151
+ n->pprev = &n->next;
152
+ n->next = (struct hlist_nulls_node *)NULLS_MARKER(NULL);
153
+}
154
+
140155 /**
141156 * hlist_nulls_for_each_entry_rcu - iterate over rcu list of given type
142157 * @tpos: the type * to use as a loop cursor.
143158 * @pos: the &struct hlist_nulls_node to use as a loop cursor.
144
- * @head: the head for your list.
159
+ * @head: the head of the list.
145160 * @member: the name of the hlist_nulls_node within the struct.
146161 *
147162 * The barrier() is needed to make sure compiler doesn't cache first element [1],
148163 * as this loop can be restarted [2]
149164 * [1] Documentation/core-api/atomic_ops.rst around line 114
150
- * [2] Documentation/RCU/rculist_nulls.txt around line 146
165
+ * [2] Documentation/RCU/rculist_nulls.rst around line 146
151166 */
152167 #define hlist_nulls_for_each_entry_rcu(tpos, pos, head, member) \
153168 for (({barrier();}), \
....@@ -161,7 +176,7 @@
161176 * iterate over list of given type safe against removal of list entry
162177 * @tpos: the type * to use as a loop cursor.
163178 * @pos: the &struct hlist_nulls_node to use as a loop cursor.
164
- * @head: the head for your list.
179
+ * @head: the head of the list.
165180 * @member: the name of the hlist_nulls_node within the struct.
166181 */
167182 #define hlist_nulls_for_each_entry_safe(tpos, pos, head, member) \