mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-27 18:43:12 -04:00
This is needed by rust/helpers/srcu.c which now adds rust_helper_srcu_readers_active() as a wrapper around the SRCU helper for Rust callers. To achive this: 1- Move the srcu_readers_active() implementation from "kernel/rcu/srcutree.c" to "include/linux/srcutree.h". 2- Implement a matching srcu_readers_active() in "include/linux/srcutiny.h" and use it on the existing open-coded WARN_ON() check in cleanup_srcu_struct(). 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>
36 lines
802 B
C
36 lines
802 B
C
// 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 bool rust_helper_srcu_readers_active(struct srcu_struct *ssp)
|
|
{
|
|
return srcu_readers_active(ssp);
|
|
}
|
|
|
|
__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);
|
|
}
|