| /rust/pin-init/src/ |
| A D | alloc.rs | 41 pin_init_from_closure(|slot| match init.__pinned_init(slot) { in pin_init() 58 init_from_closure(|slot| match init.__init(slot) { in init() 105 let Some(slot) = Arc::get_mut(&mut this) else { in try_pin_init() 109 let slot = slot.as_mut_ptr(); in try_pin_init() 112 unsafe { init.__pinned_init(slot)? }; in try_pin_init() 127 let slot = slot.as_mut_ptr(); in try_init() 130 unsafe { init.__init(slot)? }; in try_init() 140 let slot = self.as_mut_ptr(); in write_init() 143 unsafe { init.__init(slot)? }; in write_init() 149 let slot = self.as_mut_ptr(); in write_pin_init() [all …]
|
| A D | macros.rs | 1197 @slot($slot:ident), 1207 @slot($slot:ident), 1231 @slot($slot), 1239 @slot($slot:ident), 1270 @slot($slot:ident), 1301 @slot($slot:ident), 1332 @slot($slot:ident), 1355 @slot($slot:ident), 1361 @slot($slot), 1368 @slot($slot:ident), [all …]
|
| A D | lib.rs | 1108 let val = unsafe { &mut *slot }; in __pinned_init() 1229 unsafe { self.__init(slot) } in __pinned_init() 1328 let init = move |slot: *mut [T; N]| { 1329 let slot = slot.cast::<T>(); 1371 let init = move |slot: *mut [T; N]| { 1372 let slot = slot.cast::<T>(); 1397 unsafe { slot.write(self) }; in __init() 1407 unsafe { slot.write(self) }; in __pinned_init() 1418 unsafe { slot.write(self?) }; in __init() 1429 unsafe { slot.write(self?) }; in __pinned_init() [all …]
|
| A D | __internal.rs | 32 unsafe fn __init(self, slot: *mut T) -> Result<(), E> { in __init() 33 (self.0)(slot) in __init() 44 unsafe fn __pinned_init(self, slot: *mut T) -> Result<(), E> { in __pinned_init() 45 (self.0)(slot) in __pinned_init() 201 let mut slot: Pin<&mut StackInit<Foo>> = pin!(StackInit::uninit()); in stack_init_reuse() variables 203 slot.as_mut().init(crate::init!(Foo { in stack_init_reuse() 210 slot.as_mut().init(crate::init!(Foo { in stack_init_reuse()
|
| /rust/kernel/sync/ |
| A D | completion.rs | 82 inner <- Opaque::ffi_init(|slot: *mut bindings::completion| { in new() 84 unsafe { bindings::init_completion(slot) }; in new()
|
| A D | condvar.rs | 108 wait_queue_head <- Opaque::ffi_init(|slot| unsafe { in new() 109 bindings::__init_waitqueue_head(slot, name.as_char_ptr(), key.as_ptr()) in new()
|
| A D | lock.rs | 136 state <- Opaque::ffi_init(|slot| unsafe { in new() 137 B::init(slot, name.as_char_ptr(), key.as_ptr()) in new()
|
| A D | arc.rs | 746 let slot = self.as_mut_ptr(); in write_init() 749 unsafe { init.__init(slot)? }; in write_init() 755 let slot = self.as_mut_ptr(); in write_pin_init() 758 unsafe { init.__pinned_init(slot)? }; in write_pin_init()
|
| /rust/kernel/ |
| A D | types.rs | 369 pin_init::pin_init_from_closure::<_, ::core::convert::Infallible>(move |slot| { in ffi_init() 370 init_func(Self::cast_into(slot)); in ffi_init() 390 pin_init::pin_init_from_closure::<_, E>(move |slot| init_func(Self::cast_into(slot))) in try_ffi_init() 415 fn pin_init<E>(slot: impl PinInit<T, E>) -> impl PinInit<Self, E> { in pin_init() 421 unsafe { PinInit::<T, E>::__pinned_init(slot, ptr) } in pin_init()
|
| A D | init.rs | 161 pin_init_from_closure(|slot| init.__pinned_init(slot).map_err(|e| Error::from(e))) in pin_init() 178 init_from_closure(|slot| init.__pinned_init(slot).map_err(|e| Error::from(e))) in init()
|
| A D | sync.rs | 75 inner <- Opaque::ffi_init(|slot| unsafe { bindings::lockdep_register_key(slot) }) in new_dynamic()
|
| A D | workqueue.rs | 509 work <- Opaque::ffi_init(|slot| { in new() 514 slot, in new() 682 dwork <- Opaque::ffi_init(|slot: *mut bindings::delayed_work| { in new() 687 core::ptr::addr_of_mut!((*slot).work), in new() 700 core::ptr::addr_of_mut!((*slot).timer), in new()
|
| A D | miscdevice.rs | 73 inner <- Opaque::try_ffi_init(move |slot: *mut bindings::miscdevice| { in register() 75 unsafe { slot.write(opts.into_raw::<T>()) }; in register() 82 to_result(unsafe { bindings::misc_register(slot) }) in register()
|
| A D | lib.rs | 164 let initer = move |slot: *mut Self| { in init() 168 unsafe { slot.write(m) }; in init()
|
| /rust/pin-init/examples/ |
| A D | pthread_mutex.rs | 68 let init = |slot: *mut UnsafeCell<libc::pthread_mutex_t>| { in new() 70 let slot: *mut libc::pthread_mutex_t = slot.cast(); in new() 88 unsafe { slot.write(libc::PTHREAD_MUTEX_INITIALIZER) }; in new() 90 let ret = unsafe { libc::pthread_mutex_init(slot, attr) }; in new()
|
| A D | static_init.rs | 77 slot: *mut CMutex<usize>, in __pinned_init() 81 unsafe { init.__pinned_init(slot) } in __pinned_init()
|
| A D | mutex.rs | 84 pin_init_from_closure(|slot: *mut UnsafeCell<T>| { in new() 85 val.__pinned_init(slot.cast::<T>()) in new()
|
| /rust/pin-init/ |
| A D | README.md | 140 (we are calling the parameter to the closure `slot`): 142 `slot` now contains a valid bit pattern for the type `T`, 143 - when the closure returns `Err(e)`, then the caller may deallocate the memory at `slot`, so 145 - you may assume that `slot` will stay pinned even after the closure returns until `drop` of 146 `slot` gets called. 188 pin_init_from_closure(move |slot: *mut Self| { 189 // `slot` contains uninit memory, avoid creating a reference. 190 let foo = addr_of_mut!((*slot).foo);
|
| /rust/kernel/alloc/ |
| A D | kbox.rs | 362 let slot = self.as_mut_ptr(); in write_init() 365 unsafe { init.__init(slot)? }; in write_init() 371 let slot = self.as_mut_ptr(); in write_pin_init() 374 unsafe { init.__pinned_init(slot)? }; in write_pin_init()
|
| A D | kvec.rs | 767 for (slot, item) in core::iter::zip(self.spare_capacity_mut(), other) { in extend_from_slice() 768 slot.write(item.clone()); in extend_from_slice()
|