[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c04d3ec9-46f8-4ccd-b0ed-52a1adea11b7@gmail.com>
Date: Sun, 13 Apr 2025 10:55:35 +0200
From: Christian Schrefl <chrisi.schrefl@...il.com>
To: Danilo Krummrich <dakr@...nel.org>
Cc: Luis Chamberlain <mcgrof@...nel.org>, Russ Weight
<russ.weight@...ux.dev>, Miguel Ojeda <ojeda@...nel.org>,
Alex Gaynor <alex.gaynor@...il.com>, Boqun Feng <boqun.feng@...il.com>,
Gary Guo <gary@...yguo.net>, Björn Roy Baron
<bjorn3_gh@...tonmail.com>, Benno Lossin <benno.lossin@...ton.me>,
Andreas Hindborg <a.hindborg@...nel.org>, Alice Ryhl <aliceryhl@...gle.com>,
Trevor Gross <tmgross@...ch.edu>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
linux-kernel@...r.kernel.org, rust-for-linux@...r.kernel.org
Subject: Re: [PATCH v2] rust: Use `ffi::c_char` type in firmware abstraction
`FwFunc`
On 12.04.25 4:53 PM, Danilo Krummrich wrote:
> On Sat, Apr 12, 2025 at 12:29:48PM +0200, Christian Schrefl wrote:
>> The `FwFunc` struct contains an function with a char pointer argument,
>> for which a `*const u8` pointer was used. This is not really the
>> "propper" type for this, so use a `*const kernel::ffi::c_char` pointer
>> instad.
>>
>> This has no real functionality changes, since `kernel::ffi::c_char` is
>> a type alias to `u8` anyways.
>>
>> This used to cause problems on 6.13 when building for 32 bit arm (with
>> my patches), since rust mapped c_char to i8 instead.
>
> Now that I read this again:
>
> Isn't it the other way around? For arm32 c_char was mapped to u8, but FwFunc
> expected i8 (since that's what c_char was mapped to for all other architectures
> that are supported in v6.13).
>
> Can you please clarify this in the commit message?
Ah sorry I got confused because by the change in 1bae8729e50a ("rust:
map `long` to `isize` and `char` to `u8`").
How about changing that section to:
....
This has no real functionality changes, since now `kernel::ffi::c_char`
is now a type alias to `u8` anyways, but before commit 1bae8729e50a ("rust:
map `long` to `isize` and `char` to `u8`") the concrete type of
`core::ffi::c_char` depended on the architecture (However all
supported architectures at the time mapped to `i8`).
This causes problems on v6.13 when building for 32 bit arm (with my
patches), since back then `*const u8` was used in the function argument
and the function that bindgen generated used `*const core::ffi::c_char`
which Rust mapped to `u8` on 32 bit arm.
This caused the following build error:
...
Cheers
Christian
Powered by blists - more mailing lists