Messages in this thread |  | | Date | Wed, 21 May 2025 00:36:13 +0200 | | Subject | Re: [PATCH 2/2] rust: derive `Zeroable` for all structs & unions generated by bindgen where possible | | From | "Benno Lossin" <> |
| |
On Tue May 20, 2025 at 11:38 PM CEST, Alice Ryhl wrote: > On Tue, May 20, 2025 at 12:23 PM Benno Lossin <lossin@kernel.org> 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 constants 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 .*=pin_init::MaybeZeroable >> +--with-derive-custom-union .*=pin_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
|  |