summaryrefslogtreecommitdiff
path: root/rust/helpers/refcount.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2025-09-30 11:33:21 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2025-09-30 11:33:21 -0700
commit88b489385bfe3713497a63c0dcf4dd7852cf4568 (patch)
treed4a586ede51c78cf2c7354251bea86b0941c7e19 /rust/helpers/refcount.c
parente4dcbdff114e2c0a8059c396e233aa5d9637afce (diff)
parent17d9f8eaa87d40a2ff66598875a43363e37a909b (diff)
Merge tag 'locking-core-2025-09-26' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull locking updates from Ingo Molnar: "Mostly Rust runtime enhancements: - Add initial support for generic LKMM atomic variables in Rust (Boqun Feng) - Add the wrapper for `refcount_t` in Rust (Gary Guo) - Add a new reviewer, Gary Guo" * tag 'locking-core-2025-09-26' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: MAINTAINERS: update atomic infrastructure entry to include Rust rust: block: convert `block::mq` to use `Refcount` rust: convert `Arc` to use `Refcount` rust: make `Arc::into_unique_or_drop` associated function rust: implement `kernel::sync::Refcount` rust: sync: Add memory barriers rust: sync: atomic: Add Atomic<{usize,isize}> rust: sync: atomic: Add Atomic<u{32,64}> rust: sync: atomic: Add the framework of arithmetic operations rust: sync: atomic: Add atomic {cmp,}xchg operations rust: sync: atomic: Add generic atomics rust: sync: atomic: Add ordering annotation types rust: sync: Add basic atomic operation mapping framework rust: Introduce atomic API helpers
Diffstat (limited to 'rust/helpers/refcount.c')
-rw-r--r--rust/helpers/refcount.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/rust/helpers/refcount.c b/rust/helpers/refcount.c
index d6adbd2e45a1..d175898ad7b8 100644
--- a/rust/helpers/refcount.c
+++ b/rust/helpers/refcount.c
@@ -7,11 +7,21 @@ refcount_t rust_helper_REFCOUNT_INIT(int n)
return (refcount_t)REFCOUNT_INIT(n);
}
+void rust_helper_refcount_set(refcount_t *r, int n)
+{
+ refcount_set(r, n);
+}
+
void rust_helper_refcount_inc(refcount_t *r)
{
refcount_inc(r);
}
+void rust_helper_refcount_dec(refcount_t *r)
+{
+ refcount_dec(r);
+}
+
bool rust_helper_refcount_dec_and_test(refcount_t *r)
{
return refcount_dec_and_test(r);