[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANiq72=Lz1jH9C3XT5YLdHxjSUyBE7FethmBBRbXRbJdC29FJQ@mail.gmail.com>
Date: Mon, 18 Aug 2025 14:24:01 +0200
From: Miguel Ojeda <miguel.ojeda.sandonis@...il.com>
To: Danilo Krummrich <dakr@...nel.org>
Cc: Alice Ryhl <aliceryhl@...gle.com>, akpm@...ux-foundation.org, ojeda@...nel.org,
alex.gaynor@...il.com, boqun.feng@...il.com, gary@...yguo.net,
bjorn3_gh@...tonmail.com, lossin@...nel.org, a.hindborg@...nel.org,
tmgross@...ch.edu, abdiel.janulgue@...il.com, acourbot@...dia.com,
jgg@...pe.ca, lyude@...hat.com, robin.murphy@....com,
daniel.almeida@...labora.com, rust-for-linux@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/4] rust: dma: implement DataDirection
On Mon, Aug 18, 2025 at 1:56 PM Miguel Ojeda
<miguel.ojeda.sandonis@...il.com> wrote:
>
> Yes, it can easily pick `u32` -- the variants are always `int` in C,
And, for completeness, if the kernel eventually uses C23 enums (I
don't see any, from a quick grep), i.e. with an underlying type, then
in C the variants will actually have that type, not `int`:
enum c23_enum : short { c23_enum_a, c23_enum_b };
_Static_assert(_Generic(c23_enum_a, short: 1, default: 0), "");
_Static_assert(_Generic(c23_enum_b, short: 1, default: 0), "");
_Static_assert(_Generic((enum c23_enum)0, short: 1, default: 0), "");
And `bindgen` will have the underlying type too, so everything matches
in that case:
pub const c23_enum_c23_enum_a: c23_enum = 0;
pub const c23_enum_c23_enum_b: c23_enum = 1;
pub type c23_enum = ffi::c_short;
So, in a way, what `bindgen` tries to do (for the normal ones) is
behave a bit like these new ones.
But I always wondered if it is good or not differing there.
Cheers,
Miguel
Powered by blists - more mailing lists