From 446cafc295bfc0e89da94a482fe8290bd8b429fb Mon Sep 17 00:00:00 2001 From: Andreas Hindborg Date: Thu, 8 May 2025 10:52:09 +0200 Subject: rust: configfs: introduce rust support for configfs Add a Rust API for configfs, thus allowing Rust modules to use configfs for configuration. Make the implementation a shim on top of the C configfs implementation, allowing safe use of the C infrastructure from Rust. Link: https://lore.kernel.org/r/20250508-configfs-v8-1-8ebde6180edc@kernel.org Signed-off-by: Andreas Hindborg --- rust/helpers/mutex.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'rust/helpers/mutex.c') diff --git a/rust/helpers/mutex.c b/rust/helpers/mutex.c index 06575553eda5..3e9b910a88e9 100644 --- a/rust/helpers/mutex.c +++ b/rust/helpers/mutex.c @@ -17,3 +17,8 @@ void rust_helper_mutex_assert_is_held(struct mutex *mutex) { lockdep_assert_held(mutex); } + +void rust_helper_mutex_destroy(struct mutex *lock) +{ + mutex_destroy(lock); +} -- cgit From 4dbe28c0fabd69842890ba38f185b96664cba26a Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Wed, 28 May 2025 10:34:30 +0200 Subject: rust: add helper for mutex_trylock After commit c5b6ababd21a ("locking/mutex: implement mutex_trylock_nested", currently in the KVM tree) mutex_trylock() will be a macro when lockdep is enabled. Rust therefore needs the corresponding helper. Just add it and the rust/bindings/bindings_helpers_generated.rs Makefile rules will do their thing. Reported-by: Stephen Rothwell Signed-off-by: Paolo Bonzini Message-ID: <20250528083431.1875345-1-pbonzini@redhat.com> Acked-by: Miguel Ojeda Reviewed-by: Alice Ryhl Signed-off-by: Paolo Bonzini --- rust/helpers/mutex.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'rust/helpers/mutex.c') diff --git a/rust/helpers/mutex.c b/rust/helpers/mutex.c index 06575553eda5..9ab29104bee1 100644 --- a/rust/helpers/mutex.c +++ b/rust/helpers/mutex.c @@ -7,6 +7,11 @@ void rust_helper_mutex_lock(struct mutex *lock) mutex_lock(lock); } +int rust_helper_mutex_trylock(struct mutex *lock) +{ + return mutex_trylock(lock); +} + void rust_helper___mutex_init(struct mutex *mutex, const char *name, struct lock_class_key *key) { -- cgit