Add rust wrappers for rcu_read_lock & rcu_read_unlock, then bindgen could generate the bindings.
Suggested-by: Paolo Bonzini <[email protected]> Signed-off-by: Zhao Liu <[email protected]> --- Changes since v1: * Add rust wrappers instead of dropping inline. --- include/qemu/rcu.h | 18 ++++++++++++++++++ util/rcu.c | 10 ++++++++++ 2 files changed, 28 insertions(+) diff --git a/include/qemu/rcu.h b/include/qemu/rcu.h index 020dbe4d8b77..126ec52ba38f 100644 --- a/include/qemu/rcu.h +++ b/include/qemu/rcu.h @@ -118,6 +118,24 @@ static inline void rcu_read_unlock(void) } } +/** + * rust_rcu_read_lock: + * + * A wrapper over rcu_read_lock(). + * Called from Rust to acquire an RCU read lock. + * Do not touch. + */ +void rust_rcu_read_lock(void); + +/** + * rust_rcu_read_unlock: + * + * A wrapper over rcu_read_unlock(). + * Called from Rust to release an RCU read lock. + * Do not touch. + */ +void rust_rcu_read_unlock(void); + void synchronize_rcu(void); /* diff --git a/util/rcu.c b/util/rcu.c index acac9446ea98..e9ba2c57bce6 100644 --- a/util/rcu.c +++ b/util/rcu.c @@ -171,6 +171,16 @@ static void wait_for_readers(void) QLIST_SWAP(®istry, &qsreaders, node); } +void rust_rcu_read_lock(void) +{ + rcu_read_lock(); +} + +void rust_rcu_read_unlock(void) +{ + rcu_read_unlock(); +} + void synchronize_rcu(void) { QEMU_LOCK_GUARD(&rcu_sync_lock); -- 2.34.1
