lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2025043046-dismiss-unclothed-01bc@gregkh>
Date: Wed, 30 Apr 2025 10:01:08 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: Matthew Maurer <mmaurer@...gle.com>
Cc: Miguel Ojeda <ojeda@...nel.org>, Alex Gaynor <alex.gaynor@...il.com>,
	Boqun Feng <boqun.feng@...il.com>, Gary Guo <gary@...yguo.net>,
	Björn Roy Baron <bjorn3_gh@...tonmail.com>,
	Benno Lossin <benno.lossin@...ton.me>,
	Andreas Hindborg <a.hindborg@...nel.org>,
	Alice Ryhl <aliceryhl@...gle.com>, Trevor Gross <tmgross@...ch.edu>,
	Danilo Krummrich <dakr@...nel.org>,
	"Rafael J. Wysocki" <rafael@...nel.org>,
	Sami Tolvanen <samitolvanen@...gle.com>,
	linux-kernel@...r.kernel.org, rust-for-linux@...r.kernel.org
Subject: Re: [PATCH 8/8] rust: samples: Add debugfs sample

On Tue, Apr 29, 2025 at 11:16:02PM +0000, Matthew Maurer wrote:
> +    fn build<'a>(&'a self, builder: Builder<'a>) -> Result<()> {
> +        builder.display_file(c_str!("simple"), &self.simple)?;
> +        builder.display_file(c_str!("composite"), &self.composite)?;
> +        debugfs_fmt_file!(
> +            builder,
> +            c_str!("custom"),
> +            &self.custom,
> +            "Foo! {:#010x} Bar!\n"
> +        )?;
> +        for record in self.many.iter() {
> +            let dir = builder.dir(record.name)?;
> +            dir.display_file(c_str!("size"), &record.size)?;
> +            dir.display_file(c_str!("stride"), &record.stride)?;
> +        }
> +        builder.fmt_file(c_str!("atomic"), &self.atomic, &|atomic, f| {
> +            write!(f, "{}\n", atomic.load(Ordering::Relaxed))
> +        })?;
> +        builder.fmt_file(c_str!("locked"), &self.locked, &|locked, f| {
> +            write!(f, "{}\n", *locked.lock())
> +        })?;
> +        Ok(())

Good luck removing all of those ? checks, this should work just fine
without any of that.

I'm not set on the "builder" pattern here, it's not a normal one for C
to be following, why do you feel debugfs should be using it?

thanks,

greg k-h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ