Commit c8ae5646 authored by Alice Ryhl's avatar Alice Ryhl Committed by Treehugger Robot
Browse files

FROMLIST: rust: task: add `Task::current_raw`

Introduces a safe function for getting a raw pointer to the current
task.

When writing bindings that need to access the current task, it is often
more convenient to call a method that directly returns a raw pointer
than to use the existing `Task::current` method. However, the only way
to do that is `bindings::get_current()` which is unsafe since it calls
into C. By introducing `Task::current_raw()`, it becomes possible to
obtain a pointer to the current task without using unsafe.

Link: https://lore.kernel.org/all/CAH5fLgjT48X-zYtidv31mox3C4_Ogoo_2cBOCmX0Ang3tAgGHA@mail.gmail.com/


Reviewed-by: default avatarBenno Lossin <benno.lossin@proton.me>
Reviewed-by: default avatarMartin Rodriguez Reboredo <yakoyoku@gmail.com>
Reviewed-by: default avatarTrevor Gross <tmgross@umich.edu>
Signed-off-by: default avatarAlice Ryhl <aliceryhl@google.com>

Bug: 324206405
Link: https://lore.kernel.org/all/20240209-alice-file-v5-2-a37886783025@google.com/


Change-Id: I7553f23ca973eeb13ee0b5ea92d55412393c8224
Signed-off-by: default avatarAlice Ryhl <aliceryhl@google.com>
parent 6b4006d2
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment