Re: [PATCH] rust: mm: add abstractions for mm_struct and vm_area_struct

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 26.07.24 10:32, Alice Ryhl wrote:
> On Fri, Jul 26, 2024 at 10:11 AM Benno Lossin <benno.lossin@xxxxxxxxx> wrote:
>>
>> On 23.07.24 16:32, Alice Ryhl wrote:
>>> This is a follow-up to the page abstractions [1] that were recently
>>> merged in 6.11. Rust Binder will need these abstractions to manipulate
>>> the vma in its implementation of the mmap fop on the Binder file.
>>>
>>> The ARef wrapper is not used for mm_struct because there are several
>>> different types of refcounts.
>>
>> I am confused, why can't you use the `ARef` wrapper for the different
>> types that you create below?
> 
> Well, maybe I can, but it means we have several wrapper structs of
> Opaque<mm_struct>. Would it not be confusing? Could you suggest a
> naming scheme for the structs I should have?

I don't know of a good way to avoid that, IMO your current
implementation has the same issue (multiple wrappers). So I don't think
it's that bad to have multiple wrappers for one C struct.
We could also use generics to solve this, right? I am not sure about the
ergonomics/looks, so for example:
- ARef<Mm<Grab>>
- ARef<Mm<Get>>
- ARef<Mm<Async>>

I think it looks fine, then you also only have one struct wrapper.

BTW what does "mm" stand for? Memory management?

---
Cheers,
Benno






[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux