From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4DED92C21F4; Mon, 26 Jan 2026 16:08:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769443694; cv=none; b=lRgzqXL3op2eqMnBgduoee1kHv7omUFEGM3g0l4sbR+I+66vmlMgCqrirv1UypnGvzT3ub7TvkTxqXZC2RAHYFUZv02EyZualIFFBpP+tjEbAhxHojk1AIqfT39YRY9h1/39SsAPiI6Zc1L9akcfQiBSffl7pleFXP19F59rfqw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769443694; c=relaxed/simple; bh=DJPEHkUN6UgUB1r4BLgEiTLjiWYowHcGQLkor332iqI=; h=Mime-Version:Content-Type:Date:Message-Id:Cc:Subject:From:To: References:In-Reply-To; b=fkj3HyBlGh2LJHJL5cwsd4eoPhqa8KtdcOg6jWuckQ0OBN1FZvqSD+XcW9VZQx3pIqxgoIacZYuybdsgo9OgWj2lNo6BSkYhdXcm9tSjqi7yGwZcnmc5HZeD4+cHXsWFIehFZqFwUvjvohCcs6R7iPdCLHbovUJQAJNUoQ3B8MI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=qShnXFrg; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="qShnXFrg" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 669E2C116C6; Mon, 26 Jan 2026 16:08:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1769443693; bh=DJPEHkUN6UgUB1r4BLgEiTLjiWYowHcGQLkor332iqI=; h=Date:Cc:Subject:From:To:References:In-Reply-To:From; b=qShnXFrg0TvPEZt7un8gQqCSQCItLO3XgcKUUHzXvKevSDUZL8+SwVAZ9HwVcin7w G126G/ynNtH/szewZkIap0sI9yD8qiq69GU9LG14ZWjJmRBPcE/BBK8N8Vt2WKtqMe AK2hJpfpt2OzqYN7cgidiGaPi02Bckj2s2EUKXjRbp8vxtKqlVvE9AQAiZ2cAtF2gk 3gOGEhW3iAvb/+YIHUwrs3XbOw3Kb+znLwrEuI2y8jdcMAXkLkgad3x1wHUBLe1Imc st7yegbE0LBcyo5yPODkHBfMn0TXgRdBb5bsj3bC7GwGM6ebmaj8tdXCi80iRazZjJ j3YguAf6jHlXg== Precedence: bulk X-Mailing-List: rust-for-linux@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Mon, 26 Jan 2026 17:08:08 +0100 Message-Id: Cc: "Miguel Ojeda" , "Boqun Feng" , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= , "Andreas Hindborg" , "Trevor Gross" , "Danilo Krummrich" , "Rafael J. Wysocki" , "Viresh Kumar" , "Igor Korotin" , "Daniel Almeida" , "Len Brown" , , , , Subject: Re: [PATCH 0/4] Re-export Zeroable and zeroed() from ffi module From: "Benno Lossin" To: "Alice Ryhl" , "Gary Guo" X-Mailer: aerc 0.21.0 References: <20260126-zeroable-ffi-v1-0-0ef101d1ed85@google.com> In-Reply-To: On Mon Jan 26, 2026 at 2:25 PM CET, Alice Ryhl wrote: > On Mon, Jan 26, 2026 at 01:15:53PM +0000, Gary Guo wrote: >> On Mon Jan 26, 2026 at 1:05 PM GMT, Alice Ryhl wrote: >> > Currently, the Zeroable trait is defined by pin-init because pin-init >> > happens to use the trait. However, zeroed types are useful for many >> > purposes other than pin-init. Also, we wish to implement Zeroable for >> > types generated by bindgen. For both of these reasons, re-export >> > Zeroable from the ffi crate, which is a already dependency of the crat= es >> > with bindgen output. >>=20 >> I don't see a benefit of re-exporting these from the `ffi` crate? Especi= ally >> that we re-export `ffi` crate from kernel crate anyway, and `Zeroable` i= s >> already in the kernel prelude. >>=20 >> We already derive `Zeroable` for bindgen via `MaybeZeroable` derive in >> rust/bindgen_parameters. > > I can't find the convo now, but this change is on my list from when we > discussed also implementing FromBytes / IntoBytes for the bindings > types. To do that, we need to move our FromBytes / IntoBytes traits > somewhere that bindings/uapi can access, and we agreed that the ffi > crate was a good place for it. > > And then for consistency, also reexport Zeroable from the same location. I think you also mentioned at some point that using `pin_init` from `bindings` seemed strange and also using the `pin_init::zeroed()` function also doesn't fit, since it doesn't have to do with pinned initialization. Cheers, Benno