aboutsummaryrefslogtreecommitdiff
path: root/sys/compat/linuxkpi
diff options
context:
space:
mode:
authorHans Petter Selasky <hselasky@FreeBSD.org>2020-10-13 16:19:21 +0000
committerHans Petter Selasky <hselasky@FreeBSD.org>2020-10-13 16:19:21 +0000
commitd524c46fb85b7fc28ad15814f01600573e7a6990 (patch)
treed8698fa06c90aa1f3756ef7225b2754643d97313 /sys/compat/linuxkpi
parent4bc604dcda3e3dad9f4fe6971d3a57fbf6d68f3f (diff)
Notes
Diffstat (limited to 'sys/compat/linuxkpi')
-rw-r--r--sys/compat/linuxkpi/common/include/linux/rculist.h41
1 files changed, 37 insertions, 4 deletions
diff --git a/sys/compat/linuxkpi/common/include/linux/rculist.h b/sys/compat/linuxkpi/common/include/linux/rculist.h
index 0a4ad499c3807..bff2f7e131844 100644
--- a/sys/compat/linuxkpi/common/include/linux/rculist.h
+++ b/sys/compat/linuxkpi/common/include/linux/rculist.h
@@ -1,6 +1,6 @@
/*-
* Copyright (c) 2015 François Tigeot
- * Copyright (c) 2016-2017 Mellanox Technologies, Ltd.
+ * Copyright (c) 2016-2020 Mellanox Technologies, Ltd.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -37,6 +37,7 @@
container_of(READ_ONCE(ptr), type, member)
#define list_next_rcu(head) (*((struct list_head **)(&(head)->next)))
+#define list_prev_rcu(head) (*((struct list_head **)(&(head)->prev)))
#define list_for_each_entry_rcu(pos, head, member) \
for (pos = list_entry_rcu((head)->next, typeof(*(pos)), member); \
@@ -44,12 +45,44 @@
pos = list_entry_rcu((pos)->member.next, typeof(*(pos)), member))
static inline void
-list_add_rcu(struct list_head *new, struct list_head *prev)
+linux_list_add_rcu(struct list_head *new, struct list_head *prev,
+ struct list_head *next)
{
- new->next = prev->next;
+ new->next = next;
new->prev = prev;
rcu_assign_pointer(list_next_rcu(prev), new);
- prev->prev = new;
+ next->prev = new;
+}
+
+static inline void
+list_add_rcu(struct list_head *new, struct list_head *head)
+{
+ linux_list_add_rcu(new, head, head->next);
+}
+
+static inline void
+list_add_tail_rcu(struct list_head *new, struct list_head *head)
+{
+ linux_list_add_rcu(new, head->prev, head);
+}
+
+static inline void
+__list_del_rcu(struct list_head *prev, struct list_head *next)
+{
+ next->prev = prev;
+ rcu_assign_pointer(list_next_rcu(prev), next);
+}
+
+static inline void
+__list_del_entry_rcu(struct list_head *entry)
+{
+ __list_del_rcu(entry->prev, entry->next);
+}
+
+static inline void
+list_del_rcu(struct list_head *entry)
+{
+ __list_del_rcu(entry->prev, entry->next);
}
#define hlist_first_rcu(head) (*((struct hlist_node **)(&(head)->first)))