linux/drivers/android/binder
Alice Ryhl 68aabb29a5 rust: redefine bindings::compat_ptr_ioctl in Rust
There is currently an inconsistency between C and Rust, which is that
when Rust requires cfg(CONFIG_COMPAT) on compat_ioctl when using the
compat_ptr_ioctl symbol because '#define compat_ptr_ioctl NULL' does not
get translated to anything by bindgen.

But it's not *just* a matter of translating the '#define' into Rust when
CONFIG_COMPAT=n. This is because when CONFIG_COMPAT=y, the type of
compat_ptr_ioctl is a non-nullable function pointer, and to seamlessly
use it regardless of the config, we need a nullable function pointer.

I think it's important to do something about this; I've seen the mistake
of accidentally forgetting '#[cfg(CONFIG_COMPAT)]' when compat_ptr_ioctl
is used multiple times now.

This explicitly declares 'bindings::compat_ptr_ioctl' as an Option that
is always defined but might be None. This matches C, but isn't ideal:
it modifies the bindings crate. But I'm not sure if there's a better way
to do it. If we just redefine in kernel/, then people may still use the
one in bindings::, since that is where you would normally find it. I am
open to suggestions.

Signed-off-by: Alice Ryhl <aliceryhl@google.com>
Reviewed-by: Gary Guo <gary@garyguo.net>
Link: https://patch.msgid.link/20260105-redefine-compat_ptr_ioctl-v1-1-25edb3d91acc@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2026-01-16 14:54:11 +01:00
..
node
range_alloc rust: rbtree: add immutable cursor 2025-11-16 21:56:57 +01:00
allocation.rs
context.rs
deferred_close.rs
defs.rs
error.rs rust_binder: use kernel::fmt 2025-10-20 04:04:23 +02:00
freeze.rs Rust changes for v6.19 2025-12-03 14:16:49 -08:00
Makefile
node.rs rust_binder: add binder_transaction tracepoint 2025-12-29 12:14:52 +01:00
page_range.rs rust_binder: remove spin_lock() in rust_shrink_free_page() 2025-12-29 11:34:16 +01:00
page_range_helper.c
page_range_helper.h
process.rs rust_binder: add binder_transaction tracepoint 2025-12-29 12:14:52 +01:00
rust_binder.h rust_binder: add binder_transaction tracepoint 2025-12-29 12:14:52 +01:00
rust_binder_events.c
rust_binder_events.h rust_binder: add binder_transaction tracepoint 2025-12-29 12:14:52 +01:00
rust_binder_internal.h
rust_binder_main.rs rust: redefine bindings::compat_ptr_ioctl in Rust 2026-01-16 14:54:11 +01:00
rust_binderfs.c convert rust_binderfs 2025-11-17 23:59:27 -05:00
stats.rs rust: replace CStr with core::ffi::CStr 2025-10-22 07:47:27 +02:00
thread.rs rust_binder: add binder_transaction tracepoint 2025-12-29 12:14:52 +01:00
trace.rs rust_binder: add binder_transaction tracepoint 2025-12-29 12:14:52 +01:00
transaction.rs rust_binder: add binder_transaction tracepoint 2025-12-29 12:14:52 +01:00