rust: sync: add `Arc::{from_raw, into_raw}`
authorWedson Almeida Filho <walmeida@microsoft.com>
Mon, 28 Aug 2023 10:48:01 +0000 (10:48 +0000)
committerTejun Heo <tj@kernel.org>
Mon, 25 Sep 2023 19:46:41 +0000 (09:46 -1000)
commita8321776ca0b13ec4d4fc817144fe1b3f6ba4625
treeae3da57a8aa504d6cea518e6306b8b42333f86cd
parent6465e260f48790807eef06b583b38ca9789b6072
rust: sync: add `Arc::{from_raw, into_raw}`

These methods can be used to turn an `Arc` into a raw pointer and back,
in a way that preserves the metadata for fat pointers.

This is done using the unstable ptr_metadata feature [1]. However, it
could also be done using the unstable pointer_byte_offsets feature [2],
which is likely to have a shorter path to stabilization than
ptr_metadata.

Link: https://github.com/rust-lang/rust/issues/81513
Link: https://github.com/rust-lang/rust/issues/96283
Signed-off-by: Wedson Almeida Filho <walmeida@microsoft.com>
Co-developed-by: Alice Ryhl <aliceryhl@google.com>
Signed-off-by: Alice Ryhl <aliceryhl@google.com>
Reviewed-by: Gary Guo <gary@garyguo.net>
Reviewed-by: Martin Rodriguez Reboredo <yakoyoku@gmail.com>
Reviewed-by: Benno Lossin <benno.lossin@proton.me>
Reviewed-by: Andreas Hindborg <a.hindborg@samsung.com>
Reviewed-by: Boqun Feng <boqun.feng@gmail.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
rust/kernel/lib.rs
rust/kernel/sync/arc.rs