Re: [PATCH 1/5] rust: iov: add iov_iter abstractions for ITER_SOURCE

Andreas Hindborg
2025-03-19T18:33:41Z

Hi Alice,

"Alice Ryhl" <aliceryhl@google.com> writes:

> This adds abstractions for the iov_iter type in the case where
> data_source is ITER_SOURCE. This will make Rust implementations of
> fops->write_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, and that you can make a copy of it to
> get two IO vectors into the same buffers.
>
> Signed-off-by: Alice Ryhl <aliceryhl@google.com>

This does not build for me:

error[E0405]: cannot find trait `Allocator` in this scope
--> /home/aeh/src/linux-rust/linux/rust/kernel/iov.rs:133:34
|
133 | pub fn copy_from_iter_vec<A: Allocator>(
| ^^^^^^^^^ not found in this scope
|
help: consider importing one of these items
|
10 + use core::alloc::Allocator;
|
10 + use crate::alloc::Allocator;
|

error[E0412]: cannot find type `Flags` in this scope
--> /home/aeh/src/linux-rust/linux/rust/kernel/iov.rs:136:16
|
136 | flags: Flags,
| ^^^^^ not found in this scope
|
help: consider importing this struct
|
10 + use crate::alloc::Flags;
|

RUSTC L rust/kernel.o
error: aborting due to 2 previous errors

Best regards,
Andreas Hindborg