Lines Matching +full:right +full:- +full:aligned

1 // SPDX-License-Identifier: GPL-2.0
11 //! generic, they are used only at compile-time, so they shouldn't exist in the final binary.
51 //! fn new(value: i32) -> Result<Arc<Self>> {
54 //! work <- new_work!("MyStruct::work"),
97 //! fn new(value_1: i32, value_2: i32) -> Result<Arc<Self>> {
101 //! work_1 <- new_work!("MyStruct::work_1"),
102 //! work_2 <- new_work!("MyStruct::work_2"),
152 //! fn new(value: i32) -> Result<Arc<Self>> {
156 //! work <- new_delayed_work!("MyStruct::work"),
199 /// Creates a [`Work`] initialiser with the given name and a newly-created lock class.
208 /// Creates a [`DelayedWork`] initialiser with the given name and a newly-created lock class.
244 // SAFETY: Accesses to workqueues used by [`Queue`] are thread-safe.
246 // SAFETY: Accesses to workqueues used by [`Queue`] are thread-safe.
256 pub unsafe fn from_raw<'a>(ptr: *const bindings::workqueue_struct) -> &'a Queue {
267 pub fn enqueue<W, const ID: u64>(&self, w: W) -> W::EnqueueOutput
300 pub fn enqueue_delayed<W, const ID: u64>(&self, w: W, delay: Jiffies) -> W::EnqueueOutput
338 ) -> Result<(), AllocError> {
340 work <- new_work!("Queue::try_spawn"),
371 /// This is the low-level trait that is designed for being as general as possible.
379 /// Note that the id is used only to select the right method to call during compilation. It won't be
411 unsafe fn __enqueue<F>(self, queue_work_on: F) -> Self::EnqueueOutput
413 F: FnOnce(*mut bindings::work_struct) -> bool;
497 pub fn new(name: &'static CStr, key: Pin<&'static LockClassKey>) -> impl PinInit<Self>
502 work <- Opaque::ffi_init(|slot| {
523 /// The provided pointer must not be dangling and must be properly aligned. (But the memory
526 pub unsafe fn raw_get(ptr: *const Self) -> *mut bindings::work_struct {
527 // SAFETY: The caller promises that the pointer is aligned and not dangling.
559 /// - `work_container_of(raw_get_work(ptr)) == ptr` for any `ptr: *mut Self`.
560 /// - `raw_get_work(work_container_of(ptr)) == ptr` for any `ptr: *mut Work<T, ID>`.
571 unsafe fn raw_get_work(ptr: *mut Self) -> *mut Work<T, ID>;
578 unsafe fn work_container_of(ptr: *mut Work<T, ID>) -> *mut Self;
606 // SAFETY: The implementation of `raw_get_work` only compiles if the field has the right
610 unsafe fn raw_get_work(ptr: *mut Self) -> *mut $crate::workqueue::Work<$work_type $(, $id)?> {
620 ) -> *mut Self {
621 // SAFETY: The caller promises that the pointer points at a field of the right type
622 // in the right kind of struct.
670 ) -> impl PinInit<Self>
675 dwork <- Opaque::ffi_init(|slot: *mut bindings::delayed_work| {
709 /// The provided pointer must not be dangling and must be properly aligned. (But the memory
712 pub unsafe fn raw_as_work(ptr: *const Self) -> *mut Work<T, ID> {
713 // SAFETY: The caller promises that the pointer is aligned and not dangling.
716 // SAFETY: The caller promises that the pointer is aligned and not dangling.
759 // SAFETY: The implementation of `raw_get_work` only compiles if the field has the right
764 // SAFETY: The implementation of `raw_get_work` only compiles if the field has the right
770 ) -> *mut $crate::workqueue::Work<$work_type $(, $id)?> {
783 ) -> *mut Self {
784 // SAFETY: The caller promises that the pointer points at a field of the right type
785 // in the right kind of struct.
788 // SAFETY: The caller promises that the pointer points at a field of the right type
789 // in the right kind of struct.
797 // SAFETY: The caller promises that the pointer points at a field of the right type
798 // in the right kind of struct.
808 // - `__enqueue` gets the `work_struct` from the `Work` field, using `T::raw_get_work`.
809 // - The only safe way to create a `Work` object is through `Work::new`.
810 // - `Work::new` makes sure that `T::Pointer::run` is passed to `init_work_with_key`.
811 // - Finally `Work` and `RawWorkItem` guarantee that the correct `Work` field
846 unsafe fn __enqueue<F>(self, queue_work_on: F) -> Self::EnqueueOutput
848 F: FnOnce(*mut bindings::work_struct) -> bool,
905 unsafe fn __enqueue<F>(self, queue_work_on: F) -> Self::EnqueueOutput
907 F: FnOnce(*mut bindings::work_struct) -> bool,
939 /// It is the one used by `schedule[_delayed]_work[_on]()`. Multi-CPU multi-threaded. There are
943 pub fn system() -> &'static Queue {
948 /// Returns the system high-priority work queue (`system_highpri_wq`).
952 pub fn system_highpri() -> &'static Queue {
957 /// Returns the system work queue for potentially long-running work items (`system_long_wq`).
961 pub fn system_long() -> &'static Queue {
971 pub fn system_unbound() -> &'static Queue {
982 pub fn system_freezable() -> &'static Queue {
987 /// Returns the system power-efficient work queue (`system_power_efficient_wq`).
992 pub fn system_power_efficient() -> &'static Queue {
997 /// Returns the system freezable power-efficient work queue (`system_freezable_power_efficient_wq`).
1003 pub fn system_freezable_power_efficient() -> &'static Queue {
1012 pub fn system_bh() -> &'static Queue {
1017 /// Returns the system bottom halves high-priority work queue (`system_bh_highpri_wq`).
1021 pub fn system_bh_highpri() -> &'static Queue {