Re: [PATCH v3 2/4] rust: iov: add iov_iter abstractions for ITER_DEST

From: Andreas Hindborg
Date: Tue Aug 05 2025 - 07:31:39 EST


"Alice Ryhl" <aliceryhl@xxxxxxxxxx> writes:

> This adds abstractions for the iov_iter type in the case where
> data_source is ITER_DEST. This will make Rust implementations of
> fops->read_iter possible.
>
> This series only has support for using existing IO vectors created by C
> code. Additional abstractions will be needed to support the creation of
> IO vectors in Rust code.
>
> These abstractions make the assumption that `struct iov_iter` does not
> have internal self-references, which implies that it is valid to move it
> between different local variables.
>
> This patch adds an IovIterDest struct that is very similar to the
> IovIterSource from the previous patch. However, as the methods on the
> two structs have very little overlap (just getting the length and
> advance/revert), I do not think it is worth it to try and deduplicate
> this logic.

Is it not like 50% duplication? `as_raw`, `len`, `is_empty`, `advance`,
`revert`. It looks like it makes sense to me, but 🤷 We can always do it
later.

Reviewed-by: Andreas Hindborg <a.hindborg@xxxxxxxxxx>


Best regards,
Andreas Hindborg