rust: sync: add `Arc` for ref-counted allocations
authorWedson Almeida Filho <wedsonaf@gmail.com>
Wed, 28 Dec 2022 06:03:40 +0000 (06:03 +0000)
committerMiguel Ojeda <ojeda@kernel.org>
Mon, 16 Jan 2023 21:20:03 +0000 (22:20 +0100)
commit9dc04365500340e6d60a996333d562af747337b1
tree01ac23b5d7c496652e5252e24edafee4fc0550f8
parentcb7d9defdafba4c1d463a09c9b09876066f81ee4
rust: sync: add `Arc` for ref-counted allocations

This is a basic implementation of `Arc` backed by C's `refcount_t`. It
allows Rust code to idiomatically allocate memory that is ref-counted.

Cc: Will Deacon <will@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Boqun Feng <boqun.feng@gmail.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Wedson Almeida Filho <wedsonaf@gmail.com>
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Reviewed-by: Gary Guo <gary@garyguo.net>
Reviewed-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
Acked-by: Boqun Feng <boqun.feng@gmail.com>
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
rust/bindings/bindings_helper.h
rust/bindings/lib.rs
rust/helpers.c
rust/kernel/lib.rs
rust/kernel/sync.rs [new file with mode: 0644]
rust/kernel/sync/arc.rs [new file with mode: 0644]