Messages in this thread |  | | Date | Tue, 26 Aug 2025 19:02:10 +0200 | | Subject | Re: [PATCH v4 2/2] rust: zpool: add abstraction for zpool drivers | | From | "Benno Lossin" <> |
| |
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>;
|  |