[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAH5fLgjNu9YaqzEoaHfoxCA3Rh5_4t_AvTEMHNqb0vYKaRcpag@mail.gmail.com>
Date: Wed, 13 Aug 2025 10:25:31 +0200
From: Alice Ryhl <aliceryhl@...gle.com>
To: Andreas Hindborg <a.hindborg@...nel.org>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>, Alexander Viro <viro@...iv.linux.org.uk>,
Arnd Bergmann <arnd@...db.de>, Miguel Ojeda <ojeda@...nel.org>, Boqun Feng <boqun.feng@...il.com>,
Gary Guo <gary@...yguo.net>, Björn Roy Baron <bjorn3_gh@...tonmail.com>,
Trevor Gross <tmgross@...ch.edu>, Danilo Krummrich <dakr@...nel.org>, Matthew Maurer <mmaurer@...gle.com>,
Lee Jones <lee@...nel.org>, linux-kernel@...r.kernel.org,
rust-for-linux@...r.kernel.org, Benno Lossin <lossin@...nel.org>
Subject: Re: [PATCH v3 2/4] rust: iov: add iov_iter abstractions for ITER_DEST
On Tue, Aug 5, 2025 at 1:31 PM Andreas Hindborg <a.hindborg@...nel.org> wrote:
>
> "Alice Ryhl" <aliceryhl@...gle.com> 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.
Well, maybe. But I think having those be duplicated leads to a simpler
API for the end-user.
> Reviewed-by: Andreas Hindborg <a.hindborg@...nel.org>
Thanks!
Powered by blists - more mailing lists