Re: [PATCH v13 2/6] rust: introduce module_param module

From: Benno Lossin
Date: Mon Jun 23 2025 - 09:59:52 EST


On Mon Jun 23, 2025 at 2:37 PM CEST, Miguel Ojeda wrote:
> On Mon, Jun 23, 2025 at 1:48 PM Benno Lossin <lossin@xxxxxxxxxx> wrote:
>>
>> Another way would be to use a `Once`-like type (does that exist on the C
>> side?) so a type that can be initialized once and then never changes.
>
> There are `DO_ONCE{,_SLEEPABLE,_LITE}`.

Thanks for the pointer, it is pretty much exactly what the `Once` type
in Rust is.

It's not exactly what I'm thinking of in this case, but since it is
implemented with static key, maybe we can do something similar with a
static key? So switch the return value of the `ModuleParamAccess::read`
function depending on weather the module parameters have been written
and while they haven't just return a dummy value and WARN.

Thoughts @Andreas?

---
Cheers,
Benno