pub unsafe trait WorkItemPointer<const ID: u64>: RawWorkItem<ID> {
    // Required method
    unsafe extern "C" fn run(ptr: *mut work_struct);
}
Expand description

Defines the method that should be called directly when a work item is executed.

This trait is implemented by Pin<Box<T>> and Arc<T>, and is mainly intended to be implemented for smart pointer types. For your own structs, you would implement WorkItem instead. The run method on this trait will usually just perform the appropriate container_of translation and then call into the run method from the WorkItem trait.

This trait is used when the work_struct field is defined using the Work helper.

Safety

Implementers must ensure that __enqueue uses a work_struct initialized with the run method of this trait as the function pointer.

Required Methods§

source

unsafe extern "C" fn run(ptr: *mut work_struct)

Run this work item.

Safety

The provided work_struct pointer must originate from a previous call to __enqueue where the queue_work_on closure returned true, and the pointer must still be valid.

Implementations on Foreign Types§

source§

impl<T, const ID: u64> WorkItemPointer<ID> for Pin<Box<T>>where T: WorkItem<ID, Pointer = Self> + HasWork<T, ID>,

source§

unsafe extern "C" fn run(ptr: *mut work_struct)

Implementors§

source§

impl<T, const ID: u64> WorkItemPointer<ID> for Arc<T>where T: WorkItem<ID, Pointer = Self> + HasWork<T, ID>,

This documentation is an old archive. Please see https://rust.docs.kernel.org instead.