Re: [PATCH v2 2/3] rust: configfs: introduce rust support for configfs

From: Benno Lossin
Date: Tue Feb 18 2025 - 07:42:08 EST


On 18.02.25 13:17, Andreas Hindborg wrote:
> Andreas Hindborg <a.hindborg@xxxxxxxxxx> writes:
>
>> "Benno Lossin" <benno.lossin@xxxxxxxxx> writes:
>>
>>> On 17.02.25 12:08, Andreas Hindborg wrote:
>>
>> [...]
>>
>>>>>
>>>>>> +//!
>>>>>> +//! See the [rust_configfs.rs] sample for a full example use of this module.
>>>>>
>>>>> It could also be useful to just put the example directly here into the
>>>>> docs instead of/additionally to having it as a sample.
>>>>
>>>> I don't think we should duplicate the code. As long as the link works, I
>>>> think having it separately is fine.
>>>
>>> When I'm coding in my editor and read some docs directly in it, it often
>>> is annoying to find a link, because then I have to open the docs in my
>>> web-browser.
>>> I understand that you don't want to duplicate the code (and it also is a
>>> bit too much for a short example), so how about having a simpler
>>> example? Maybe with only a single operation that has no associated data
>>> (use `()`)?
>>
>> Sure, we can do that.
>
> Actually, I am having some problems making the inline example compile.
> `configfs_attrs!` references `THIS_MODULE`, which is not present for
> doctests.

I see. Does KUNIT have a THIS_MODULE that we could use? If so, we might
want to make that accessible in the test harness. Does anyone know more
about this?

> I'll add the example but mark it `ignore` ?

Sounds good. If we end up adding a THIS_MODULE to the test harness, we
can remove the ignore later.

---
Cheers,
Benno