[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aKRxEEy5ln8qcGGI@google.com>
Date: Tue, 19 Aug 2025 12:41:52 +0000
From: Alice Ryhl <aliceryhl@...gle.com>
To: Andrew Morton <akpm@...ux-foundation.org>, "Liam R. Howlett" <Liam.Howlett@...cle.com>,
Lorenzo Stoakes <lorenzo.stoakes@...cle.com>, Miguel Ojeda <ojeda@...nel.org>,
Andrew Ballance <andrewjballance@...il.com>
Cc: Boqun Feng <boqun.feng@...il.com>, Gary Guo <gary@...yguo.net>,
"Björn Roy Baron" <bjorn3_gh@...tonmail.com>, Benno Lossin <lossin@...nel.org>,
Andreas Hindborg <a.hindborg@...nel.org>, Trevor Gross <tmgross@...ch.edu>,
Danilo Krummrich <dakr@...nel.org>, linux-kernel@...r.kernel.org,
maple-tree@...ts.infradead.org, rust-for-linux@...r.kernel.org,
linux-mm@...ck.org
Subject: Re: [PATCH v2 1/5] maple_tree: remove lockdep_map_p typedef
On Tue, Aug 19, 2025 at 10:34:42AM +0000, Alice Ryhl wrote:
> Having the ma_external_lock field exist when CONFIG_LOCKDEP=n isn't used
> anywhere, so just get rid of it. This also avoids generating a typedef
> called lockdep_map_p that could overlap with typedefs in other header
> files.
>
> With this change, bindgen will generate better definitions for this
> union, which makes it nicer to use from Rust. This avoids a cast in the
> Rust abstractions for the maple tree, ensuring that Rust's type checker
> will notice at build-time if ma_lock is changed from spinlock_t to
> something else.
>
> Signed-off-by: Alice Ryhl <aliceryhl@...gle.com>
Ah ... this didn't work. There's still a configuration where I get the
error:
ERROR:root:error[E0308]: mismatched types
--> ../rust/kernel/maple_tree.rs:256:18
|
254 | fn ma_lock(&self) -> *mut bindings::spinlock_t {
| ------------------------- expected `*mut bindings::spinlock` because of return type
255 | // SAFETY: This pointer offset operation stays in-bounds.
256 | unsafe { &raw mut (*self.tree.get()).__bindgen_anon_1.ma_lock }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `*mut spinlock`, found `*mut __BindgenUnionField<spinlock>`
|
= note: expected raw pointer `*mut bindings::spinlock`
found raw pointer `*mut bindings::__BindgenUnionField<bindings::spinlock>`
Alice
Powered by blists - more mailing lists