Re: [RFC PATCH v3 0/2] rust: crates in other kernel directories

From: Johannes Berg
Date: Fri Mar 15 2024 - 10:12:30 EST


Hi,

So I realize this is an old patch, but I didn't find another version,
and discussions seemed ongoing at least a month ago. I also came across
it pretty randomly.

Anyway, question:

> If you want to use a crate with your Rust module just add a `rust-libs`
> variable in your Makefile with a value of the relative directory of
> said crate plus its name, e.g.
>
> # Link with the foo crate
> rust-libs += ../path/to/foo

Should this perhaps be relative to the kernel's root dir instead? 

If I'm reading this correctly, then a hypothetical rust wireless driver
that lives in

drivers/net/wireless/<vendor>/<name>/

using some wireless rust infrastructure would probably end up with
something like

rust-libs += ../../../../../net/mac80211/rust/

or whatever, which seems rather odd vs.

rust-libs += net/mac80211/rust/

Seems to me that chances are that subsystems/drivers that have rust
infrastructure will not necessarily have them close to each other, like
in this example?

You have this in the sample too:

+rust-libs := ../../drivers/usb/core/usb

but it's less pronounced since it's just samples/rust/ :)

johannes