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: sync: replace `kernel::c_str!` with C-Strings

C-String literals were added in Rust 1.77. Replace instances of
`kernel::c_str!` with C-String literals where possible.

Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Reviewed-by: Benno Lossin <lossin@kernel.org>
Signed-off-by: Tamir Duberstein <tamird@gmail.com>
Link: https://patch.msgid.link/20251117-core-cstr-cstrings-v4-1-924886ad9f75@gmail.com
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>

authored by

Tamir Duberstein and committed by
Miguel Ojeda
494de8f6 26866b6b

+1 -2
+1 -2
rust/kernel/sync.rs
··· 48 48 /// 49 49 /// # Examples 50 50 /// ``` 51 - /// # use kernel::c_str; 52 51 /// # use kernel::alloc::KBox; 53 52 /// # use kernel::types::ForeignOwnable; 54 53 /// # use kernel::sync::{LockClassKey, SpinLock}; ··· 59 60 /// { 60 61 /// stack_pin_init!(let num: SpinLock<u32> = SpinLock::new( 61 62 /// 0, 62 - /// c_str!("my_spinlock"), 63 + /// c"my_spinlock", 63 64 /// // SAFETY: `key_ptr` is returned by the above `into_foreign()`, whose 64 65 /// // `from_foreign()` has not yet been called. 65 66 /// unsafe { <Pin<KBox<LockClassKey>> as ForeignOwnable>::borrow(key_ptr) }