rust: sync: add `ArcBorrow::from_raw`
authorAlice Ryhl <aliceryhl@google.com>
Tue, 2 Apr 2024 13:07:42 +0000 (13:07 +0000)
committerMiguel Ojeda <ojeda@kernel.org>
Sun, 5 May 2024 16:04:28 +0000 (18:04 +0200)
commit51f6af86de35bfd12a005caf457f2ec834193de8
tree87da95d57ca618b435a28780469ecbf0a80641d0
parentbe2ca1e03965ffb214b6cbda0ffd84daeeb5f214
rust: sync: add `ArcBorrow::from_raw`

Allows access to a value in an `Arc` that is currently held as a raw
pointer due to use of `Arc::into_raw`, without destroying or otherwise
consuming that raw pointer.

This is a dependency of the linked list that Rust Binder uses. The
linked list uses this method when iterating over the linked list [1].

Reviewed-by: Benno Lossin <benno.lossin@proton.me>
Reviewed-by: Boqun Feng <boqun.feng@gmail.com>
Link: https://lore.kernel.org/r/20240402-linked-list-v1-6-b1c59ba7ae3b@google.com
Signed-off-by: Alice Ryhl <aliceryhl@google.com>
Link: https://lore.kernel.org/r/20240402-arc-for-list-v4-1-54db6440a9a9@google.com
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
rust/kernel/sync/arc.rs