On Thu Oct 15, 2026 at 1:39 PM BST, Daniel Almeida wrote:
> `IoCapable<T>` provides both `io_read` and `io_write`, so a backend that
> supports accesses of type `T` supports them in both directions, and every
> (non-copy) `Io` method that reads or writes a value requires both. There
> is no way to express a backend, or a view, that can only be read or only
> be written.
>
> Thus, replace `IoCapable<T>` with an `IoReadable<T>` trait holding
> `io_read` and an `IoWritable<T>` trait holding `io_write`, and implement
> both for all existing backends. The non-copy `Io` methods that read a
> value now require `IoReadable` and those that write one require
> `IoWritable`. `update` and `try_update` read and then write, so they
> require both.
>
> The copy methods use `IoCopyable` and are not changed here.
>
> No functional change intended. This prepares for read-only and write-only
> views, added in a following patch.

I think by Rust convention these should be named `IoRead`/`IoWrite`, but we've
aleady named this `IoCapable` and I further made the mistake of adding
`IoCopyable`...

So I guess I'm not in a good position to ask for name change, but we should
consider it. Apart from the name:

Reviewed-by: Gary Guo <[email protected]>

Best,
Gary

>
> Signed-off-by: Daniel Almeida <[email protected]>
> ---
>  rust/kernel/dma.rs    |  12 ++++--
>  rust/kernel/io.rs     | 101 
> +++++++++++++++++++++++++++++---------------------
>  rust/kernel/pci/io.rs |  10 +++--
>  3 files changed, 75 insertions(+), 48 deletions(-)

Reply via email to