Skip to content

Commit 96df76d

Browse files
committed
ANDROID: rust: add preempt_[disable|enable]_notrace
Make it possible to disable preemption in a region of Rust code. For now, this is implemented using helpers. Signed-off-by: Alice Ryhl <aliceryhl@google.com>
1 parent c72ed3b commit 96df76d

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

rust/helpers.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,18 @@ rust_helper_krealloc(const void *objp, size_t new_size, gfp_t flags)
165165
}
166166
EXPORT_SYMBOL_GPL(rust_helper_krealloc);
167167

168+
void rust_helper_preempt_enable_notrace(void)
169+
{
170+
preempt_enable_notrace();
171+
}
172+
EXPORT_SYMBOL_GPL(rust_helper_preempt_enable_notrace);
173+
174+
void rust_helper_preempt_disable_notrace(void)
175+
{
176+
preempt_disable_notrace();
177+
}
178+
EXPORT_SYMBOL_GPL(rust_helper_preempt_disable_notrace);
179+
168180
/*
169181
* `bindgen` binds the C `size_t` type as the Rust `usize` type, so we can
170182
* use it in contexts where Rust expects a `usize` like slice (array) indices.

0 commit comments

Comments
 (0)