Re: [PATCH 1/2] rust: add initial scatterlist bindings

From: Jason Gunthorpe
Date: Mon Jun 02 2025 - 07:41:34 EST


On Sat, May 31, 2025 at 09:54:20PM +0900, Alexandre Courbot wrote:

> So if I understood your idea correctly, this would mean creating the
> SGTable and mapping it in one call, eschewing the typestate entirely?

Probably no need for a type state

> And the `SGTable` would own the backing data, and only release it upon
> destruction and unmapping?

But I don't think you can do this, it is not allowed to pin kmalloc
memory for instance so you have to do something as you showed to tie
the lifetime to the kmalloc across the sgtable lifetime.

Jason