summaryrefslogtreecommitdiffstats
path: root/rust/helpers/rcu.c
diff options
context:
space:
mode:
authorWedson Almeida Filho <wedsonaf@gmail.com>2024-12-19 18:04:06 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-12-20 17:19:26 +0100
commit51158207294108898e5b72bb78fa51a7e848844f (patch)
tree6ff5e5addb551cf1a2b098baa72d7515708f4953 /rust/helpers/rcu.c
parent9b90864bb42befdc10fa5c60dd1d8033c8535726 (diff)
downloadlinux-stable-51158207294108898e5b72bb78fa51a7e848844f.tar.gz
linux-stable-51158207294108898e5b72bb78fa51a7e848844f.tar.bz2
linux-stable-51158207294108898e5b72bb78fa51a7e848844f.zip
rust: add rcu abstraction
Add a simple abstraction to guard critical code sections with an rcu read lock. Reviewed-by: Boqun Feng <boqun.feng@gmail.com> Signed-off-by: Wedson Almeida Filho <wedsonaf@gmail.com> Co-developed-by: Danilo Krummrich <dakr@kernel.org> Signed-off-by: Danilo Krummrich <dakr@kernel.org> Tested-by: Dirk Behme <dirk.behme@de.bosch.com> Tested-by: Fabien Parent <fabien.parent@linaro.org> Link: https://lore.kernel.org/r/20241219170425.12036-5-dakr@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'rust/helpers/rcu.c')
-rw-r--r--rust/helpers/rcu.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/rust/helpers/rcu.c b/rust/helpers/rcu.c
new file mode 100644
index 000000000000..f1cec6583513
--- /dev/null
+++ b/rust/helpers/rcu.c
@@ -0,0 +1,13 @@
+// SPDX-License-Identifier: GPL-2.0
+
+#include <linux/rcupdate.h>
+
+void rust_helper_rcu_read_lock(void)
+{
+ rcu_read_lock();
+}
+
+void rust_helper_rcu_read_unlock(void)
+{
+ rcu_read_unlock();
+}