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 6DBB31F03D4; Tue, 20 May 2025 22:36:17 +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=1747780579; cv=none; b=S8MSf5Up0xIHN7MWZI6exQ2+u3UoBL2TuhrqhFtzVYakM/ovhR9ex/joKl/dHjkEDi21oE/oO7U82lxghcM85sE/1o78yDPP9hnYyrg+rxSZhr2S0p8YB+IwegGYvoepZ9uqQdHkQ7KKT5I/pCpCMlXZWJRuG+AReE2vaT87/Hw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747780579; c=relaxed/simple; bh=JQcdg3Ffhn/IlmOxhFq0uLZ1SNFrMiz6Ijob5xLObTg=; h=Mime-Version:Content-Type:Date:Message-Id:Cc:Subject:From:To: References:In-Reply-To; b=TOfwnGQGirQvFaICcWOLEy3m07YwFmLOQbdAYAk3jdGqC5QlcF1ahIRDpV4sAeYm22ySzRR3bnG4YWWeVA+g559qiUx8gB0EsZJ7f3iPCd98kluoB4RPe69mJnZTtr16oQYzEwQVJ/A5iVealEOua3WbqmpeDw1yXuKHxMTsorc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=bjcWD2y1; 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="bjcWD2y1" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1C26AC4CEE9; Tue, 20 May 2025 22:36:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1747780577; bh=JQcdg3Ffhn/IlmOxhFq0uLZ1SNFrMiz6Ijob5xLObTg=; h=Date:Cc:Subject:From:To:References:In-Reply-To:From; b=bjcWD2y1kTexEIKC6Rk/54wDa5at/BJsGZBNunypWlDq1xUYIktzpuQah05zR/6dc f+qAWoxwouvFnlv0z6nfHvSWLaU4tBokeBkF445LdbiKbIdCYG6LhKxv+CZP/aYhlv iuMvA79VI+uJYxub5C4z8YFYBZXcDpxQsTQSWz6tBaE0MD8ie7cjUAyA/7MrsLEAdP 9XJsxC9qhm4E8ujYs87vawhhntpp21otF62+6EVuE+n2M3HXTlhMDsbiOtTD2JJHU7 yqAEHvIQJQ0hy0HnxVNZZDtmfhiPfaMtEn57aMgpGfTRh1vmCc8G12/uEVzZK0wLYi EXo8yjkO8qE7w== 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: Wed, 21 May 2025 00:36:13 +0200 Message-Id: Cc: "Miguel Ojeda" , "Alex Gaynor" , "Boqun Feng" , "Gary Guo" , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= , "Benno Lossin" , "Andreas Hindborg" , "Trevor Gross" , "Danilo Krummrich" , "Fiona Behrens" , "Lyude Paul" , , Subject: Re: [PATCH 2/2] rust: derive `Zeroable` for all structs & unions generated by bindgen where possible From: "Benno Lossin" To: "Alice Ryhl" X-Mailer: aerc 0.20.1 References: <20250520192307.259142-1-lossin@kernel.org> <20250520192307.259142-2-lossin@kernel.org> In-Reply-To: On Tue May 20, 2025 at 11:38 PM CEST, Alice Ryhl wrote: > On Tue, May 20, 2025 at 12:23=E2=80=AFPM Benno Lossin = wrote: >> diff --git a/rust/bindgen_parameters b/rust/bindgen_parameters >> index 0f96af8b9a7f..fa4c61ba028f 100644 >> --- a/rust/bindgen_parameters >> +++ b/rust/bindgen_parameters >> @@ -34,3 +34,7 @@ >> # We use const helpers to aid bindgen, to avoid conflicts when constant= s are >> # recognized, block generation of the non-helper constants. >> --blocklist-item ARCH_SLAB_MINALIGN >> + >> +# Structs should implement Zeroable when all of their fields do. >> +--with-derive-custom-struct .*=3Dpin_init::MaybeZeroable >> +--with-derive-custom-union .*=3Dpin_init::MaybeZeroable > > Maybe add an import in bindings/lib.rs and use it directly? Seems a > bit nicer to read without the prefix. I don't mind doing this, but I don't really see the value in it. I view the generated bindings from time to time, but having the extra path wouldn't bother me. I'll add it to the changes on the next version, but if you have some better justification, I'd love to hear it. --- Cheers, Benno