[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAH5fLghjBv3zypCSEgsttFFzdgjcztPWC_7wb6V_7C6EMBhHmA@mail.gmail.com>
Date: Mon, 23 Sep 2024 11:20:09 +0200
From: Alice Ryhl <aliceryhl@...gle.com>
To: Gary Guo <gary@...yguo.net>
Cc: Miguel Ojeda <ojeda@...nel.org>, Alex Gaynor <alex.gaynor@...il.com>,
Wedson Almeida Filho <wedsonaf@...il.com>, Boqun Feng <boqun.feng@...il.com>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>,
Benno Lossin <benno.lossin@...ton.me>, Andreas Hindborg <a.hindborg@...sung.com>,
Trevor Gross <tmgross@...ch.edu>, Luis Chamberlain <mcgrof@...nel.org>,
Russ Weight <russ.weight@...ux.dev>, Danilo Krummrich <dakr@...hat.com>,
Martin Rodriguez Reboredo <yakoyoku@...il.com>, Finn Behrens <me@...enk.dev>,
Valentin Obst <kernel@...entinobst.de>, Wedson Almeida Filho <walmeida@...rosoft.com>,
rust-for-linux@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 4/5] rust: map `long` to `isize` and `char` to `u8`
On Fri, Sep 13, 2024 at 11:33 PM Gary Guo <gary@...yguo.net> wrote:
>
> The following FFI types are replaced compared to `core::ffi`:
>
> 1. `char` type is now always mapped to `u8`, since kernel uses
> `-funsigned-char` on the C code. `core::ffi` maps it to platform
> default ABI, which can be either signed or unsigned.
>
> 2. `long` is now always mapped to `isize`. It's very common in the
> kernel to use `long` to represent a pointer-sized integer, and in
> fact `intptr_t` is a typedef of `long` in the kernel. Enforce this
> mapping rather than mapping to `i32/i64` depending on platform can
> save us a lot of unnecessary casts.
>
> Signed-off-by: Gary Guo <gary@...yguo.net>
Reviewed-by: Alice Ryhl <aliceryhl@...gle.com>
Powered by blists - more mailing lists