Re: [PATCH v13 1/1] rust: interop: Add list module for C linked list interface

From: Joel Fernandes

Date: Wed Mar 18 2026 - 14:04:57 EST




On 3/18/2026 9:31 AM, Gary Guo wrote:
> On Wed Mar 18, 2026 at 8:59 AM GMT, Alice Ryhl wrote:
>> On Tue, Mar 17, 2026 at 04:18:46PM -0400, Joel Fernandes wrote:
>>>
>>>
>>> On 3/17/2026 4:17 PM, Joel Fernandes wrote:
>>>> Add a new module `kernel::interop::list` for working with C's doubly
>>>> circular linked lists. Provide low-level iteration over list nodes.
>>>>
>>>> Typed iteration over actual items is provided with a `clist_create`
>>>> macro to assist in creation of the `CList` type.
>>>>
>>>> Cc: Nikola Djukic <ndjukic@xxxxxxxxxx>
>>>> Reviewed-by: Daniel Almeida <daniel.almeida@xxxxxxxxxxxxx>
>>>> Reviewed-by: Alexandre Courbot <acourbot@xxxxxxxxxx>
>>>> Acked-by: Alexandre Courbot <acourbot@xxxxxxxxxx>
>>>> Acked-by: Gary Guo <gary@xxxxxxxxxxx>
>>>> Acked-by: Miguel Ojeda <ojeda@xxxxxxxxxx>
>>>> Signed-off-by: Joel Fernandes <joelagnelf@xxxxxxxxxx>
>>>> ---
>>>> MAINTAINERS | 8 +
>>>> rust/helpers/helpers.c | 1 +
>>>> rust/helpers/list.c | 17 ++
>>>> rust/kernel/interop.rs | 9 +
>>>> rust/kernel/interop/list.rs | 342 ++++++++++++++++++++++++++++++++++++
>>>> rust/kernel/lib.rs | 2 +
>>>> 6 files changed, 379 insertions(+)
>>>> create mode 100644 rust/helpers/list.c
>>>> create mode 100644 rust/kernel/interop.rs
>>>> create mode 100644 rust/kernel/interop/list.rs
>>>>
>>>> diff --git a/MAINTAINERS b/MAINTAINERS
>>>> index 4bd6b538a51f..e847099efcc2 100644
>>>> --- a/MAINTAINERS
>>>> +++ b/MAINTAINERS
>>>> @@ -23251,6 +23251,14 @@ T: git https://github.com/Rust-for-Linux/linux.git alloc-next
>>>> F: rust/kernel/alloc.rs
>>>> F: rust/kernel/alloc/
>>>>
>>>> +RUST [INTEROP]
>>>> +M: Joel Fernandes <joelagnelf@xxxxxxxxxx>
>>>> +M: Alexandre Courbot <acourbot@xxxxxxxxxx>
>>>> +L: rust-for-linux@xxxxxxxxxxxxxxx
>>>> +S: Maintained
>>>> +T: git https://github.com/Rust-for-Linux/linux.git interop-next
>>>> +F: rust/kernel/interop/
>>>
>>> Sorry, I forgot to add an additional F: for the rust/kernel/interop.rs file.
>>> Danilo/Miguel, do you mind adding this when applying?
>>
>> I think you should consider a mod.rs file to avoid this. It's tiny, and
>> just re-exports submodules, so I don't think the "mod.rs name in file
>> view" concern is that big, and IMO having files related to interop/
>> inside the directory is much better than having them outside.
>>
>> Alice
>
> I wanted this for all modules in general. For modules that grow into multiple
> files we should really use mod.rs and avoid both module_name.rs and the
> module_name directory.
>

This is how it was, and I changed it based on Alex's feedback:

https://lore.kernel.org/all/DH3XD8NUDJNG.2IMPYC40D8DXI@xxxxxxxxxx/

I am Ok with both approaches. I would request Danilo if he's applying it,
that if he could do so without my additional re-send.

thanks,

--
Joel Fernandes