Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

rust: types: add `Opaque::zeroed`

Analogous to `Opaque::uninit` add `Opaque::zeroed`, which sets the
corresponding memory to zero. In contrast to `Opaque::uninit`, the
corresponding value, depending on its type, may be initialized.

Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Acked-by: Miguel Ojeda <ojeda@kernel.org>
Link: https://lore.kernel.org/r/20250414131934.28418-2-dakr@kernel.org
Signed-off-by: Danilo Krummrich <dakr@kernel.org>

+8
+8
rust/kernel/types.rs
··· 329 329 } 330 330 } 331 331 332 + /// Creates a new zeroed opaque value. 333 + pub const fn zeroed() -> Self { 334 + Self { 335 + value: UnsafeCell::new(MaybeUninit::zeroed()), 336 + _pin: PhantomPinned, 337 + } 338 + } 339 + 332 340 /// Create an opaque pin-initializer from the given pin-initializer. 333 341 pub fn pin_init(slot: impl PinInit<T>) -> impl PinInit<Self> { 334 342 Self::ffi_init(|ptr: *mut T| {