Lines Matching defs:work_struct

8 //! type to define multiple `work_struct` fields. This is done by choosing an id for each field,
24 //! * The [`Work`] struct is the Rust wrapper for the C `work_struct` type.
32 //! the struct is executed, it will print the integer. Since there is only one `work_struct` field,
75 //! The following example shows how multiple `work_struct` fields can be used:
273 // SAFETY: We only return `false` if the `work_struct` is already in a workqueue. The other
283 // stay valid until we call the function pointer in the `work_struct`, so the access is ok.
306 // SAFETY: We only return `false` if the `work_struct` is already in a workqueue. The other
318 // `work_struct`, so the access is ok.
374 /// implementations of this trait. For example, if a struct has multiple `work_struct` fields, then
398 /// valid `work_struct` for the duration of the call to the closure. If the closure returns
400 /// function pointer stored in the `work_struct`.
404 /// The provided closure may only return `false` if the `work_struct` is already in a workqueue.
413 F: FnOnce(*mut bindings::work_struct) -> bool;
422 /// that `__enqueue` provides about accessing the `work_struct` must also apply to the rest of the
434 /// This trait is used when the `work_struct` field is defined using the [`Work`] helper.
438 /// Implementers must ensure that [`__enqueue`] uses a `work_struct` initialized with the [`run`]
448 /// The provided `work_struct` pointer must originate from a previous call to [`__enqueue`]
452 unsafe extern "C" fn run(ptr: *mut bindings::work_struct);
457 /// This trait is used when the `work_struct` field is defined using the [`Work`] helper.
472 /// Wraps the kernel's C `struct work_struct`.
474 /// This is a helper type used to associate a `work_struct` with the [`WorkItem`] that uses it.
481 work: Opaque<bindings::work_struct>,
519 /// Get a pointer to the inner `work_struct`.
526 pub unsafe fn raw_get(ptr: *const Self) -> *mut bindings::work_struct {
552 /// Note that since the [`Work`] type is annotated with an id, you can have several `work_struct`
717 let wrk: *mut bindings::work_struct = unsafe { core::ptr::addr_of_mut!((*dw).work) };
718 // CAST: Work and work_struct have compatible layouts.
727 /// The `HasWork<T, ID>` implementation must return a `work_struct` that is stored in the `work`
728 /// field of a `delayed_work` with the same access rules as the `work_struct`.
806 // SAFETY: The `__enqueue` implementation in RawWorkItem uses a `work_struct` initialized with the
808 // - `__enqueue` gets the `work_struct` from the `Work` field, using `T::raw_get_work`.
820 unsafe extern "C" fn run(ptr: *mut bindings::work_struct) {
821 // The `__enqueue` method always uses a `work_struct` stored in a `Work<T, ID>`.
832 // SAFETY: The `work_struct` raw pointer is guaranteed to be valid for the duration of the call to
835 // to be valid until a call to the function pointer in `work_struct` because we leak the memory it
837 // is what the function pointer in the `work_struct` must be pointing to, according to the safety
848 F: FnOnce(*mut bindings::work_struct) -> bool,
867 // SAFETY: By the safety requirements of `HasDelayedWork`, the `work_struct` returned by methods in
868 // `HasWork` provides a `work_struct` that is the `work` field of a `delayed_work`, and the rest of
883 unsafe extern "C" fn run(ptr: *mut bindings::work_struct) {
884 // The `__enqueue` method always uses a `work_struct` stored in a `Work<T, ID>`.
907 F: FnOnce(*mut bindings::work_struct) -> bool,
927 // SAFETY: By the safety requirements of `HasDelayedWork`, the `work_struct` returned by methods in
928 // `HasWork` provides a `work_struct` that is the `work` field of a `delayed_work`, and the rest of