rust: xarray: Add an abstraction for XArray
authorTamir Duberstein <tamird@gmail.com>
Wed, 23 Apr 2025 13:54:38 +0000 (09:54 -0400)
committerAndreas Hindborg <a.hindborg@kernel.org>
Thu, 1 May 2025 09:37:59 +0000 (11:37 +0200)
commit210b81578efbe5c5e7748e50d313e1a90b03df55
tree54f30a53c6484fad38bda0d6d98ba2bd3f987eea
parent1a4736c3d8394f5e64557a41b4b2b8d6dcd04622
rust: xarray: Add an abstraction for XArray

`XArray` is an efficient sparse array of pointers. Add a Rust
abstraction for this type.

This implementation bounds the element type on `ForeignOwnable` and
requires explicit locking for all operations. Future work may leverage
RCU to enable lockless operation.

Inspired-by: MaĆ­ra Canal <mcanal@igalia.com>
Inspired-by: Asahi Lina <lina@asahilina.net>
Reviewed-by: Andreas Hindborg <a.hindborg@kernel.org>
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Signed-off-by: Tamir Duberstein <tamird@gmail.com>
Link: https://lore.kernel.org/r/20250423-rust-xarray-bindings-v19-2-83cdcf11c114@gmail.com
Signed-off-by: Andreas Hindborg <a.hindborg@kernel.org>
rust/bindings/bindings_helper.h
rust/helpers/helpers.c
rust/helpers/xarray.c [new file with mode: 0644]
rust/kernel/lib.rs
rust/kernel/xarray.rs [new file with mode: 0644]