[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aJw-XWhDahVeejl3@google.com>
Date: Wed, 13 Aug 2025 07:27:25 +0000
From: Alice Ryhl <aliceryhl@...gle.com>
To: Andreas Hindborg <a.hindborg@...nel.org>
Cc: Boqun Feng <boqun.feng@...il.com>, Miguel Ojeda <ojeda@...nel.org>,
Alex Gaynor <alex.gaynor@...il.com>, Gary Guo <gary@...yguo.net>,
"Björn Roy Baron" <bjorn3_gh@...tonmail.com>, Benno Lossin <lossin@...nel.org>,
Trevor Gross <tmgross@...ch.edu>, Danilo Krummrich <dakr@...nel.org>, Jens Axboe <axboe@...nel.dk>,
linux-block@...r.kernel.org, rust-for-linux@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v4 11/15] rnull: enable configuration via `configfs`
On Tue, Aug 12, 2025 at 10:44:29AM +0200, Andreas Hindborg wrote:
> Allow rust null block devices to be configured and instantiated via
> `configfs`.
>
> Signed-off-by: Andreas Hindborg <a.hindborg@...nel.org>
Overall LGTM, but a few comments below:
> diff --git a/drivers/block/rnull/configfs.rs b/drivers/block/rnull/configfs.rs
> new file mode 100644
> index 000000000000..8d469c046a39
> --- /dev/null
> +++ b/drivers/block/rnull/configfs.rs
> @@ -0,0 +1,218 @@
> +// SPDX-License-Identifier: GPL-2.0
> +
> +use super::{NullBlkDevice, THIS_MODULE};
> +use core::fmt::Write;
> +use kernel::{
> + block::mq::gen_disk::{GenDisk, GenDiskBuilder},
> + c_str,
> + configfs::{self, AttributeOperations},
> + configfs_attrs, new_mutex,
It would be nice to add
pub use configfs_attrs;
to the configfs module so that you can import the macro from the
configfs module instead of the root.
> + try_pin_init!( DeviceConfig {
> + data <- new_mutex!( DeviceConfigInner {
Extra spaces in these macros.
> + let power_op_str = core::str::from_utf8(page)?.trim();
> +
> + let power_op = match power_op_str {
> + "0" => Ok(false),
> + "1" => Ok(true),
> + _ => Err(EINVAL),
> + }?;
We probably want kstrtobool here instead of manually parsing the
boolean.
Alice
Powered by blists - more mailing lists