hc
2023-12-09 b22da3d8526a935aa31e086e63f60ff3246cb61c
kernel/include/linux/list_nulls.h
....@@ -56,11 +56,33 @@
5656 return ((unsigned long)ptr) >> 1;
5757 }
5858
59
+/**
60
+ * hlist_nulls_unhashed - Has node been removed and reinitialized?
61
+ * @h: Node to be checked
62
+ *
63
+ * Not that not all removal functions will leave a node in unhashed state.
64
+ * For example, hlist_del_init_rcu() leaves the node in unhashed state,
65
+ * but hlist_nulls_del() does not.
66
+ */
5967 static inline int hlist_nulls_unhashed(const struct hlist_nulls_node *h)
6068 {
6169 return !h->pprev;
6270 }
6371
72
+/**
73
+ * hlist_nulls_unhashed_lockless - Has node been removed and reinitialized?
74
+ * @h: Node to be checked
75
+ *
76
+ * Not that not all removal functions will leave a node in unhashed state.
77
+ * For example, hlist_del_init_rcu() leaves the node in unhashed state,
78
+ * but hlist_nulls_del() does not. Unlike hlist_nulls_unhashed(), this
79
+ * function may be used locklessly.
80
+ */
81
+static inline int hlist_nulls_unhashed_lockless(const struct hlist_nulls_node *h)
82
+{
83
+ return !READ_ONCE(h->pprev);
84
+}
85
+
6486 static inline int hlist_nulls_empty(const struct hlist_nulls_head *h)
6587 {
6688 return is_a_nulls(READ_ONCE(h->first));