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: opp: use `CStr::as_char_ptr`

Replace the use of `as_ptr` which works through `<CStr as
Deref<Target=&[u8]>::deref()` in preparation for replacing
`kernel::str::CStr` with `core::ffi::CStr` as the latter does not
implement `Deref<Target=&[u8]>`.

Signed-off-by: Tamir Duberstein <tamird@gmail.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Link: https://patch.msgid.link/20251018-cstr-core-v18-10-9378a54385f8@gmail.com
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>

authored by

Tamir Duberstein and committed by
Miguel Ojeda
965a39a9 5b60cde7

+3 -3
+3 -3
rust/kernel/opp.rs
··· 13 13 cpumask::{Cpumask, CpumaskVar}, 14 14 device::Device, 15 15 error::{code::*, from_err_ptr, from_result, to_result, Result, VTABLE_DEFAULT_ERROR}, 16 - ffi::c_ulong, 16 + ffi::{c_char, c_ulong}, 17 17 prelude::*, 18 18 str::CString, 19 19 sync::aref::{ARef, AlwaysRefCounted}, ··· 88 88 use macros::vtable; 89 89 90 90 /// Creates a null-terminated slice of pointers to [`Cstring`]s. 91 - fn to_c_str_array(names: &[CString]) -> Result<KVec<*const u8>> { 91 + fn to_c_str_array(names: &[CString]) -> Result<KVec<*const c_char>> { 92 92 // Allocated a null-terminated vector of pointers. 93 93 let mut list = KVec::with_capacity(names.len() + 1, GFP_KERNEL)?; 94 94 95 95 for name in names.iter() { 96 - list.push(name.as_ptr().cast(), GFP_KERNEL)?; 96 + list.push(name.as_char_ptr(), GFP_KERNEL)?; 97 97 } 98 98 99 99 list.push(ptr::null(), GFP_KERNEL)?;