[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87mseie3ip.fsf@kernel.org>
Date: Wed, 19 Feb 2025 09:34:54 +0100
From: Andreas Hindborg <a.hindborg@...nel.org>
To: "Asahi Lina" <lina@...hilina.net>
Cc: "Alice Ryhl" <aliceryhl@...gle.com>, "Miguel Ojeda" <ojeda@...nel.org>,
"Alex Gaynor" <alex.gaynor@...il.com>, "Boqun Feng"
<boqun.feng@...il.com>, "Gary Guo" <gary@...yguo.net>, Björn Roy Baron
<bjorn3_gh@...tonmail.com>, "Benno Lossin" <benno.lossin@...ton.me>,
"Trevor Gross" <tmgross@...ch.edu>, "Jann Horn" <jannh@...gle.com>,
"Matthew Wilcox" <willy@...radead.org>, "Paolo Bonzini"
<pbonzini@...hat.com>, "Danilo Krummrich" <dakr@...nel.org>, "Wedson
Almeida Filho" <wedsonaf@...il.com>, "Valentin Obst"
<kernel@...entinobst.de>, "Andrew Morton" <akpm@...ux-foundation.org>,
<linux-mm@...ck.org>, <airlied@...hat.com>, "Abdiel Janulgue"
<abdiel.janulgue@...il.com>, <rust-for-linux@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, <asahi@...ts.linux.dev>
Subject: Re: [PATCH 1/6] rust: types: Add Ownable/Owned types
"Asahi Lina" <lina@...hilina.net> writes:
> On 2/4/25 3:17 AM, Alice Ryhl wrote:
>> On Mon, Feb 3, 2025 at 3:17 PM Asahi Lina <lina@...hilina.net> wrote:
>>>
>>>
>>>
>>> On 2/3/25 6:13 PM, Alice Ryhl wrote:
>>>> On Sun, Feb 2, 2025 at 2:06 PM Asahi Lina <lina@...hilina.net> wrote:
>>>>> + /// Consumes the `Owned`, returning a raw pointer.
>>>>> + ///
>>>>> + /// This function does not actually relinquish ownership of the object.
>>>>> + /// After calling this function, the caller is responsible for ownership previously managed
>>>>> + /// by the `Owned`.
>>>>> + #[allow(dead_code)]
>>>>> + pub(crate) fn into_raw(me: Self) -> NonNull<T> {
>>>>
>>>> I would just make these methods public, like the ARef ones. Then you
>>>> can drop the #[allow(dead_code)] annotation.
>>>
>>> Does it make sense to ever have drivers doing this? I feel like these
>>> methods should be limited to the kernel crate.
>>
>> Not having drivers use this is the ideal, but I don't think we should
>> always expect it to be possible. The Binder driver has a C component
>> for the binderfs component, and it also has some code that's
>> essentially an abstraction inside the driver that I was asked to move
>> into Binder because it's so specific to Binder that it's not useful
>> for anyone else.
>
> That's fair, I'll make it pub.
Also, the kernel crate will split at some point. We might as well have
them public now and avoid the churn.
Best regards,
Andreas Hindborg
Powered by blists - more mailing lists