mirror-linux/rust/kernel/sync
Tamir Duberstein 3b83f5d5e7 rust: replace `CStr` with `core::ffi::CStr`
`kernel::ffi::CStr` was introduced in commit d126d23801 ("rust: str:
add `CStr` type") in November 2022 as an upstreaming of earlier work
that was done in May 2021[0]. That earlier work, having predated the
inclusion of `CStr` in `core`, largely duplicated the implementation of
`std::ffi::CStr`.

`std::ffi::CStr` was moved to `core::ffi::CStr` in Rust 1.64 in
September 2022. Hence replace `kernel::str::CStr` with `core::ffi::CStr`
to reduce our custom code footprint, and retain needed custom
functionality through an extension trait.

Add `CStr` to `ffi` and the kernel prelude.

Link: faa3cbcca0 [0]
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Acked-by: Danilo Krummrich <dakr@kernel.org>
Reviewed-by: Benno Lossin <lossin@kernel.org>
Signed-off-by: Tamir Duberstein <tamird@gmail.com>
Link: https://patch.msgid.link/20251018-cstr-core-v18-16-9378a54385f8@gmail.com
[ Removed assert that would now depend on the Rust version. - Miguel ]
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2025-10-22 07:47:27 +02:00
..
arc rust: provide proper code documentation titles 2024-10-07 21:39:57 +02:00
atomic rust: sync: atomic: Add Atomic<{usize,isize}> 2025-09-15 09:38:34 +02:00
lock rust: replace `CStr` with `core::ffi::CStr` 2025-10-22 07:47:27 +02:00
arc.rs Rust changes for v6.18 2025-09-30 19:12:49 -07:00
aref.rs rust: sync: extend module documentation of aref 2025-09-15 00:02:22 +02:00
atomic.rs rust: sync: atomic: Add the framework of arithmetic operations 2025-09-15 09:38:34 +02:00
barrier.rs rust: sync: Add memory barriers 2025-09-15 09:38:34 +02:00
completion.rs rust: completion: implement initial abstraction 2025-06-13 23:46:56 +02:00
condvar.rs rust: replace `CStr` with `core::ffi::CStr` 2025-10-22 07:47:27 +02:00
lock.rs rust: replace `CStr` with `core::ffi::CStr` 2025-10-22 07:47:27 +02:00
locked_by.rs rust: sync: add missing newline in locked_by log example 2025-03-06 20:44:06 +01:00
poll.rs Scheduler updates for v6.17: 2025-07-29 17:42:52 -07:00
rcu.rs rust: sync: rcu: Mark Guard methods as inline 2025-05-16 09:00:54 -04:00
refcount.rs rust: block: convert `block::mq` to use `Refcount` 2025-09-15 09:38:36 +02:00