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: <CANiq72m+RN9-VRzRW_O8P9vAi2qvkN1tgfdkDONJQQCXbVXkyA@mail.gmail.com>
Date: Tue, 1 Jul 2025 20:22:25 +0200
From: Miguel Ojeda <miguel.ojeda.sandonis@...il.com>
To: Daniel Almeida <daniel.almeida@...labora.com>
Cc: Mark Brown <broonie@...nel.org>, 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>, Boris Brezillon <boris.brezillon@...labora.com>, 
	Sebastian Reichel <sebastian.reichel@...labora.com>, Liam Girdwood <lgirdwood@...il.com>, 
	linux-kernel@...r.kernel.org, rust-for-linux@...r.kernel.org, 
	Greg KH <gregkh@...uxfoundation.org>
Subject: Re: [PATCH v6 0/2] Add a bare-minimum Regulator abstraction

On Tue, Jul 1, 2025 at 6:10 PM Daniel Almeida
<daniel.almeida@...labora.com> wrote:
>
> Well, if all functions in the regulator API have stubs, then perhaps a trivial
> solution would be removing this #[cfg] from here:
>
> +#[cfg(CONFIG_REGULATOR)] <---
> +pub mod regulator;
>
> This would build the abstractions unconditionally, and it would transparently
> use the C stubs when calling the C functions.
>
> Waiting for more comments from the other RFL folks.

If C typically provides an API with stubs because users should not
generally care whether it is enabled or not, then you should try to
mimic that if it makes sense.

There have been similar discussions for e.g. debugfs which you may
want to take a look at:

    https://lore.kernel.org/rust-for-linux/2025043021-plaza-grip-2916@gregkh/

where the callers didn't even want to get a `Result` if not enabled,
and as a result of that, ended up like e.g.:

    https://lore.kernel.org/rust-for-linux/20250627-debugfs-rust-v8-1-c6526e413d40@google.com/

In that case, they ended up with a few `cfg`s, e.g. to optionally have
a field in a struct, but in your case it may be simpler.

I hope that helps.

Cheers,
Miguel

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ