[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <DCCIRTHGQFNX.1M8GXO4TYA7DF@kernel.org>
Date: Tue, 26 Aug 2025 19:02:10 +0200
From: "Benno Lossin" <lossin@...nel.org>
To: "Vitaly Wool" <vitaly.wool@...sulko.se>,
<rust-for-linux@...r.kernel.org>
Cc: <linux-kernel@...r.kernel.org>, "Uladzislau Rezki" <urezki@...il.com>,
"Danilo Krummrich" <dakr@...nel.org>, "Alice Ryhl" <aliceryhl@...gle.com>,
"Vlastimil Babka" <vbabka@...e.cz>, "Lorenzo Stoakes"
<lorenzo.stoakes@...cle.com>, "Liam R . Howlett" <Liam.Howlett@...cle.com>,
"Miguel Ojeda" <ojeda@...nel.org>, "Alex Gaynor" <alex.gaynor@...il.com>,
"Boqun Feng" <boqun.feng@...il.com>, "Gary Guo" <gary@...yguo.net>, "Bjorn
Roy Baron" <bjorn3_gh@...tonmail.com>, "Andreas Hindborg"
<a.hindborg@...nel.org>, "Trevor Gross" <tmgross@...ch.edu>, "Johannes
Weiner" <hannes@...xchg.org>, "Yosry Ahmed" <yosry.ahmed@...ux.dev>, "Nhat
Pham" <nphamcs@...il.com>, <linux-mm@...ck.org>
Subject: Re: [PATCH v4 2/2] rust: zpool: add abstraction for zpool drivers
On Sat Aug 23, 2025 at 3:05 PM CEST, Vitaly Wool wrote:
> +pub trait ZpoolDriver {
> + /// Opaque Rust representation of `struct zpool`.
> + type Pool: ForeignOwnable;
I think this is the same question that Danilo asked a few versions ago,
but why do we need this? Why can't we just use `Self` instead?
> +
> + /// Create a pool.
> + fn create(name: &'static CStr, gfp: Flags) -> Result<Self::Pool>;
> +
> + /// Destroy the pool.
> + fn destroy(pool: Self::Pool);
This should just be done via the normal `Drop` trait?
---
Cheers,
Benno
> +
> + /// Allocate an object of size `size` bytes from `pool`, with the allocation flags `gfp` and
> + /// preferred NUMA node `nid`. If the allocation is successful, an opaque handle is returned.
> + fn malloc(
> + pool: <Self::Pool as ForeignOwnable>::BorrowedMut<'_>,
> + size: usize,
> + gfp: Flags,
> + nid: NumaNode,
> + ) -> Result<usize>;
Powered by blists - more mailing lists