[PATCH v10 3/5] rust: replace `CStr` with `core::ffi::CStr`

Benno Lossin
Mon, 26 May 2025 14:56:31 -0000

On Sat May 24, 2025 at 10:33 PM CEST, Tamir Duberstein
wrote:
> `std::ffi::CStr` was moved to `core::ffi::CStr` in Rust 1.64. Replace
> `kernel::str::CStr` with `core::ffi::CStr` now that we can.

What's this supposed to mean?

> C-String literals were added in Rust 1.77. Opportunistically replace
> instances of `kernel::c_str!` with C-String literals where other code
> changes were already necessary; the rest will be done in a later commit.

Similarly this, the message should explain the motivation for the
change, the change itself and can include additional information.

>
> Signed-off-by: Tamir Duberstein <tamird at gmail.com>
> ---
>  drivers/gpu/drm/drm_panic_qr.rs |   2 +-
>  rust/kernel/device.rs           |   4 +-
>  rust/kernel/error.rs            |   4 +-
>  rust/kernel/firmware.rs         |  11 +-
>  rust/kernel/kunit.rs            |   6 +-
>  rust/kernel/miscdevice.rs       |   2 +-
>  rust/kernel/net/phy.rs          |   2 +-
>  rust/kernel/of.rs               |   2 +-
>  rust/kernel/prelude.rs          |   5 +-
>  rust/kernel/seq_file.rs         |   4 +-
>  rust/kernel/str.rs              | 358
+++++++++-------------------------------
>  rust/kernel/sync/condvar.rs     |   2 +-
>  rust/kernel/sync/lock.rs        |   2 +-
>  rust/kernel/sync/lock/global.rs |   2 +-
>  14 files changed, 112 insertions(+), 294 deletions(-)

I'm a bit confused by some of the diffs here, they seem pretty messy,
any chance that they can be improved?

---
Cheers,
Benno