[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231108102521.523413-1-aliceryhl@google.com>
Date: Wed, 8 Nov 2023 10:25:21 +0000
From: Alice Ryhl <aliceryhl@...gle.com>
To: benno.lossin@...ton.me
Cc: a.hindborg@...sung.com, alex.gaynor@...il.com,
aliceryhl@...gle.com, arve@...roid.com, bjorn3_gh@...tonmail.com,
boqun.feng@...il.com, brauner@...nel.org, cmllamas@...gle.com,
gary@...yguo.net, gregkh@...uxfoundation.org, jeffv@...gle.com,
joel@...lfernandes.org, linux-kernel@...r.kernel.org,
maco@...roid.com, mattgilbride@...gle.com, mmaurer@...gle.com,
ojeda@...nel.org, rust-for-linux@...r.kernel.org,
surenb@...gle.com, tkjos@...roid.com, wedsonaf@...il.com
Subject: Re: [PATCH RFC 02/20] rust_binder: add binderfs support to Rust binder
Benno Lossin <benno.lossin@...ton.me> writes:
> On 01.11.23 19:01, Alice Ryhl wrote:
>> +/// There is one context per binder file (/dev/binder, /dev/hwbinder, etc)
>> +#[pin_data]
>> +pub(crate) struct Context {
>> + #[pin]
>> + manager: Mutex<Manager>,
>> + pub(crate) name: CString,
>> + #[pin]
>> + links: ListLinks,
>> +}
>> +
>> +kernel::list::impl_has_list_links! {
>> + impl HasListLinks<0> for Context { self.links }
>> +}
>> +kernel::list::impl_list_arc_safe! {
>> + impl ListArcSafe<0> for Context { untracked; }
>> +}
>> +kernel::list::impl_list_item! {
>> + impl ListItem<0> for Context {
>> + using ListLinks;
>> + }
>> +}
>
> I think at some point it would be worth introducing a derive macro that
> does this for us. So for example:
>
> #[pin_data]
> #[derive(HasListLinks)]
> pub(crate) struct Context {
> #[pin]
> manager: Mutex<Manager>,
> pub(crate) name: CString,
> #[pin]
> #[links]
> links: ListLinks,
> }
Sure, it would be nice to improve the ergonomics of this. However, I
don't think it's that important either. The current solution is a bit
verbose, but good enough for me.
Alice
Powered by blists - more mailing lists