commit | 6d20d629c6d8575be98eeebe49a16fb2d7b32350 | [log] [tgz] |
---|---|---|
author | Wedson Almeida Filho <[email protected]> | Tue Apr 11 02:45:33 2023 -0300 |
committer | Miguel Ojeda <[email protected]> | Sat Apr 22 00:20:00 2023 +0200 |
tree | 7c0df7bfbfbcdc511ebec0272bee28e60746cccc | |
parent | 76d4bd591e1101df69c44c819041e374c63f1194 [diff] [blame] |
rust: lock: introduce `Mutex` This is the `struct mutex` lock backend and allows Rust code to use the kernel mutex idiomatically. Cc: Peter Zijlstra <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Will Deacon <[email protected]> Cc: Waiman Long <[email protected]> Reviewed-by: Martin Rodriguez Reboredo <[email protected]> Signed-off-by: Wedson Almeida Filho <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Miguel Ojeda <[email protected]>
diff --git a/rust/helpers.c b/rust/helpers.c index 04b9be46..86af099 100644 --- a/rust/helpers.c +++ b/rust/helpers.c
@@ -22,6 +22,7 @@ #include <linux/build_bug.h> #include <linux/err.h> #include <linux/refcount.h> +#include <linux/mutex.h> __noreturn void rust_helper_BUG(void) { @@ -29,6 +30,12 @@ __noreturn void rust_helper_BUG(void) } EXPORT_SYMBOL_GPL(rust_helper_BUG); +void rust_helper_mutex_lock(struct mutex *lock) +{ + mutex_lock(lock); +} +EXPORT_SYMBOL_GPL(rust_helper_mutex_lock); + refcount_t rust_helper_REFCOUNT_INIT(int n) { return (refcount_t)REFCOUNT_INIT(n);