[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <DBIT6WL2C5MG.2J7OBX6LCVYP7@kernel.org>
Date: Tue, 22 Jul 2025 20:52:05 +0200
From: "Benno Lossin" <lossin@...nel.org>
To: "Sidong Yang" <sidong.yang@...iosa.ai>
Cc: "Caleb Sander Mateos" <csander@...estorage.com>, "Miguel Ojeda"
<ojeda@...nel.org>, "Arnd Bergmann" <arnd@...db.de>, "Jens Axboe"
<axboe@...nel.dk>, <rust-for-linux@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, <io-uring@...r.kernel.org>
Subject: Re: [PATCH 2/4] rust: io_uring: introduce rust abstraction for
io-uring cmd
On Tue Jul 22, 2025 at 4:30 PM CEST, Sidong Yang wrote:
> On Mon, Jul 21, 2025 at 06:28:09PM +0200, Benno Lossin wrote:
>> On Mon Jul 21, 2025 at 5:47 PM CEST, Sidong Yang wrote:
>> > It's safest to get NonNull from from_raw and it returns
>> > Pin<&mut IoUringCmd>.
>>
>> I don't think you need `NonNull<T>`.
>
> NonNull<T> gurantees that it's not null. It could be also dangling but it's
> safer than *mut T. Could you tell me why I don't need it?
Raw pointers have better ergonomics and if you're just passing it back
into ffi, I don't see the point of using `NonNull`...
>> > from_raw() name is weird. it should be from_nonnnull()? Also, done()
>> > would get Pin<&mut Self>.
>>
>> That sounds reasonable.
>>
>> Are you certain that it's an exclusive reference?
>
> As far as I know, yes.
So the `IoUringCmd` is not refcounted and it is also not owned by the
`done` callee?
---
Cheers,
Benno
Powered by blists - more mailing lists