[PATCH v3 0/2] rust: add initial scatterlist abstraction

From: Abdiel Janulgue
Date: Fri Jul 18 2025 - 06:34:30 EST


Hi all,

This is v3 of the rust scatterlist abstraction incorporating feedback
and code from Alexandre Courbot.

Changes since v3:
- After further discussion it seems we need a variant of typestate after
all. A major change for this version is to introduce unsafe methods only
when using one of the constructors for a SG table. Otherwise nothing in
the interface should need to be unsafe.

Changes since v2:
- Drop typestate pattern. Introduce SGTablePages trait to enforce ownership
of the pages to SGTable.

Link to v2: https://lore.kernel.org/lkml/20250626203247.816273-1-abdiel.janulgue@xxxxxxxxx/

Abdiel Janulgue (2):
rust: add initial scatterlist abstraction
samples: rust: add sample code for scatterlist abstraction

rust/bindings/bindings_helper.h | 1 +
rust/helpers/helpers.c | 1 +
rust/helpers/scatterlist.c | 30 +++
rust/kernel/dma.rs | 18 ++
rust/kernel/lib.rs | 1 +
rust/kernel/scatterlist.rs | 405 ++++++++++++++++++++++++++++++++
samples/rust/rust_dma.rs | 49 +++-
7 files changed, 504 insertions(+), 1 deletion(-)
create mode 100644 rust/helpers/scatterlist.c
create mode 100644 rust/kernel/scatterlist.rs


base-commit: 23b128bba76776541dc09efaf3acf6242917e1f0
--
2.43.0