[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <tencent_2E2CD1359817A58BB51F59E790325CFA6A0A@qq.com>
Date: Wed, 5 Feb 2025 22:56:17 +0800
From: Guangbo Cui <2407018371@...com>
To: daniel.almeida@...labora.com
Cc: a.hindborg@...nel.org,
alex.gaynor@...il.com,
aliceryhl@...gle.com,
benno.lossin@...ton.me,
bjorn3_gh@...tonmail.mco,
boqun.feng@...il.com,
boris.brezillon@...labora.com,
dakr@...nel.org,
gary@...yguo.net,
gregkh@...uxfoundation.org,
linux-kernel@...r.kernel.org,
ojeda@...nel.org,
rafael@...nel.org,
robh@...nel.org,
rust-for-linux@...r.kernel.org,
tmgross@...ch.edu
Subject: [PATCH v6 2/3] rust: io: mem: add a generic iomem abstraction
> +/// A generic memory-mapped IO region.
> +///
> +/// Accesses to the underlying region is checked either at compile time, if the
> +/// region's size is known at that point, or at runtime otherwise.
> +///
> +/// # Invariants
> +///
> +/// `IoMem` always holds an `IoRaw` inststance that holds a valid pointer to the
> +/// start of the I/O memory mapped region.
> +pub struct IoMem<const SIZE: usize = 0> {
> + io: IoRaw<SIZE>,
> +}
Compile-time checks are only possible when CONFIG_RUST_BUILD_ASSERT_ALLOW=y.
Otherwise, using compile-time check APIs of Io will cause a modpost error
because the rust_build_error symbol is not exported. Details at the issue[1].
Maybe Io should expose compile-time check APIs only when CONFIG_RUST_BUILD_ASSERT_ALLOW=y?
The expectation is that a build error should occur when calling `Io::readX` and
`Io::writeX` due to a boundary check failure, rather than because the
`rust_build_error` symbol is not exported.
Link: https://github.com/Rust-for-Linux/linux/issues/1141 [1]
Best regards,
Guangbo Cui
Powered by blists - more mailing lists