This patch shows one possible mechanism for accessing Rust fields from the TP_fast_assign() body of a trace event. The idea is to have the driver expose the offsets of the relevant fields, and to have the C code use those offsets to access the data.
I'm currently using this mechanism in the Rust Binder driver on Android's fork of 6.12. Signed-off-by: Alice Ryhl <[email protected]> --- Alice Ryhl (2): rust: sync: add Arc::DATA_OFFSET rust_binder: add binder_transaction tracepoint drivers/android/binder/node.rs | 8 +++ drivers/android/binder/process.rs | 7 +++ drivers/android/binder/rust_binder.h | 79 +++++++++++++++++++++++++++++ drivers/android/binder/rust_binder_events.h | 30 +++++++++++ drivers/android/binder/rust_binder_main.rs | 8 +++ drivers/android/binder/thread.rs | 1 + drivers/android/binder/trace.rs | 21 ++++++++ drivers/android/binder/transaction.rs | 14 +++++ rust/kernel/sync/arc.rs | 3 ++ 9 files changed, 171 insertions(+) --- base-commit: 211ddde0823f1442e4ad052a2f30f050145ccada change-id: 20251113-binder-trace1-b2d369f63e30 Best regards, -- Alice Ryhl <[email protected]>
