summaryrefslogtreecommitdiffstats
path: root/include/linux/list_nulls.h
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2009-06-13 12:28:57 +0200
committerPatrick McHardy <kaber@trash.net>2009-06-13 12:28:57 +0200
commitd219dce76c64f2c883dad0537fa09a56d5ff0a10 (patch)
tree712ae332fbe5ae56524bb5afe2ee09960bbb74ee /include/linux/list_nulls.h
parent9858a3ae1d4b390fbaa9c30b83cb66d861b76294 (diff)
downloadop-kernel-dev-d219dce76c64f2c883dad0537fa09a56d5ff0a10.zip
op-kernel-dev-d219dce76c64f2c883dad0537fa09a56d5ff0a10.tar.gz
list_nulls: add hlist_nulls_add_head and hlist_nulls_del
This patch adds the hlist_nulls_add_head() function which is based on hlist_nulls_add_head_rcu() but without the use of rcu_assign_pointer(). It also adds hlist_nulls_del which is exactly the same like hlist_nulls_del_rcu(). Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> Acked-by: Eric Dumazet <eric.dumazet@gmail.com> Signed-off-by: Patrick McHardy <kaber@trash.net>
Diffstat (limited to 'include/linux/list_nulls.h')
-rw-r--r--include/linux/list_nulls.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/include/linux/list_nulls.h b/include/linux/list_nulls.h
index 93150ec..5d10ae36 100644
--- a/include/linux/list_nulls.h
+++ b/include/linux/list_nulls.h
@@ -56,6 +56,18 @@ static inline int hlist_nulls_empty(const struct hlist_nulls_head *h)
return is_a_nulls(h->first);
}
+static inline void hlist_nulls_add_head(struct hlist_nulls_node *n,
+ struct hlist_nulls_head *h)
+{
+ struct hlist_nulls_node *first = h->first;
+
+ n->next = first;
+ n->pprev = &h->first;
+ h->first = n;
+ if (!is_a_nulls(first))
+ first->pprev = &n->next;
+}
+
static inline void __hlist_nulls_del(struct hlist_nulls_node *n)
{
struct hlist_nulls_node *next = n->next;
@@ -65,6 +77,12 @@ static inline void __hlist_nulls_del(struct hlist_nulls_node *n)
next->pprev = pprev;
}
+static inline void hlist_nulls_del(struct hlist_nulls_node *n)
+{
+ __hlist_nulls_del(n);
+ n->pprev = LIST_POISON2;
+}
+
/**
* hlist_nulls_for_each_entry - iterate over list of given type
* @tpos: the type * to use as a loop cursor.
OpenPOWER on IntegriCloud