Re: [PATCH v3 4/4] rust: add parameter support to the `module!` macro

Andreas Hindborg
2024-12-13T12:42:47Z

"Greg KH" <gregkh@linuxfoundation.org> writes:

> On Fri, Dec 13, 2024 at 12:30:49PM +0100, Andreas Hindborg wrote:
>> This patch includes changes required for Rust kernel modules to utilize
>> module parameters. This code implements read only support for integer
>> types without `sysfs` support.
>
> read-only is VERY limited, and as such, only good for boot options,
> which as I mentioned before, is not how any "modern" kernel driver
> should be doing things.

I only added what is required to get rust null block compatibility
going. I did not want to add dead code - I heard that is frowned upon.

> And no sysfs interaction? That's going to confuse the heck out of
> people wondering why the option they added doesn't show up in the same
> place it normally would if they did it in C, right? Not that I'm saying
> this should be done at all, just that this is going to be confusing
> right off the bat which is probably not a good idea.

No, these work the same way as their counter parts in C. They reuse the
same C machinery. They just only allow the user to specify a subset of
the permission flags.

The C null_blk parameters are actually configured to appear read-only in
sysfs. I guess I should add that in a follow-up.

> Friends don't let friends add new module parameters to the kernel :)

OK, that makes sense. But I'm trying to build something that plugs
in where we currently have a piece of C code that relies on module
parameters.

Jens, would you be OK with Rust null block only providing configuration
through configfs?

Best regards,
Andreas Hindborg