summaryrefslogtreecommitdiff
path: root/rust/helpers
diff options
context:
space:
mode:
authorOnur Özkan <work@onurozkan.dev>2026-06-13 09:40:08 +0300
committerPaul E. McKenney <paulmck@kernel.org>2026-07-15 15:34:25 -0700
commit8f63d947bedfddefeb1c10f1dfc36f16407ce22c (patch)
tree70192e38877d0eea22f4a7b750a83fc3b9fa52ff /rust/helpers
parenta47dea1baa3b445365ad0757e6dee4ef8fde49e6 (diff)
rust: helpers: add SRCU helpers
Add helper wrappers for SRCU functions that are exposed to Rust through generated bindings. Signed-off-by: Onur Özkan <work@onurozkan.dev> Reviewed-by: Gary Guo <gary@garyguo.net> Reviewed-by: Alice Ryhl <aliceryhl@google.com> Reviewed-by: Boqun Feng <boqun@kernel.org> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Diffstat (limited to 'rust/helpers')
-rw-r--r--rust/helpers/helpers.c1
-rw-r--r--rust/helpers/srcu.c30
2 files changed, 31 insertions, 0 deletions
diff --git a/rust/helpers/helpers.c b/rust/helpers/helpers.c
index 998e31052e66..35954f38ff6a 100644
--- a/rust/helpers/helpers.c
+++ b/rust/helpers/helpers.c
@@ -91,6 +91,7 @@
#include "slab.c"
#include "spinlock.c"
#include "string.c"
+#include "srcu.c"
#include "sync.c"
#include "task.c"
#include "time.c"
diff --git a/rust/helpers/srcu.c b/rust/helpers/srcu.c
new file mode 100644
index 000000000000..225b3bf9334a
--- /dev/null
+++ b/rust/helpers/srcu.c
@@ -0,0 +1,30 @@
+// SPDX-License-Identifier: GPL-2.0
+
+#include <linux/srcu.h>
+
+__rust_helper int rust_helper_init_srcu_struct_with_key(struct srcu_struct *ssp,
+ const char *name,
+ struct lock_class_key *key)
+{
+ return __init_srcu_struct(ssp, name, key);
+}
+
+__rust_helper int rust_helper_srcu_read_lock(struct srcu_struct *ssp)
+{
+ return srcu_read_lock(ssp);
+}
+
+__rust_helper void rust_helper_srcu_read_unlock(struct srcu_struct *ssp, int idx)
+{
+ srcu_read_unlock(ssp, idx);
+}
+
+__rust_helper void rust_helper_srcu_barrier(struct srcu_struct *ssp)
+{
+ srcu_barrier(ssp);
+}
+
+__rust_helper void rust_helper_synchronize_srcu_expedited(struct srcu_struct *ssp)
+{
+ synchronize_srcu_expedited(ssp);
+}