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: debugfs: 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.

Signed-off-by: Tamir Duberstein <tamird@gmail.com>
Reviewed-by: Daniel Almeida <daniel.almeida@collabora.com>
Link: https://patch.msgid.link/20251222-cstr-driver-core-v1-6-1142a177d0fd@gmail.com
Signed-off-by: Danilo Krummrich <dakr@kernel.org>

authored by

Tamir Duberstein and committed by
Danilo Krummrich
f47a8f59 644672e9

+9 -14
+9 -14
rust/kernel/debugfs.rs
··· 126 126 /// # Examples 127 127 /// 128 128 /// ``` 129 - /// # use kernel::c_str; 130 129 /// # use kernel::debugfs::Dir; 131 - /// let debugfs = Dir::new(c_str!("parent")); 130 + /// let debugfs = Dir::new(c"parent"); 132 131 /// ``` 133 132 pub fn new(name: &CStr) -> Self { 134 133 Dir::create(name, None) ··· 138 139 /// # Examples 139 140 /// 140 141 /// ``` 141 - /// # use kernel::c_str; 142 142 /// # use kernel::debugfs::Dir; 143 - /// let parent = Dir::new(c_str!("parent")); 144 - /// let child = parent.subdir(c_str!("child")); 143 + /// let parent = Dir::new(c"parent"); 144 + /// let child = parent.subdir(c"child"); 145 145 /// ``` 146 146 pub fn subdir(&self, name: &CStr) -> Self { 147 147 Dir::create(name, Some(self)) ··· 154 156 /// # Examples 155 157 /// 156 158 /// ``` 157 - /// # use kernel::c_str; 158 159 /// # use kernel::debugfs::Dir; 159 160 /// # use kernel::prelude::*; 160 - /// # let dir = Dir::new(c_str!("my_debugfs_dir")); 161 - /// let file = KBox::pin_init(dir.read_only_file(c_str!("foo"), 200), GFP_KERNEL)?; 161 + /// # let dir = Dir::new(c"my_debugfs_dir"); 162 + /// let file = KBox::pin_init(dir.read_only_file(c"foo", 200), GFP_KERNEL)?; 162 163 /// // "my_debugfs_dir/foo" now contains the number 200. 163 164 /// // The file is removed when `file` is dropped. 164 165 /// # Ok::<(), Error>(()) ··· 182 185 /// # Examples 183 186 /// 184 187 /// ``` 185 - /// # use kernel::c_str; 186 188 /// # use kernel::debugfs::Dir; 187 189 /// # use kernel::prelude::*; 188 - /// # let dir = Dir::new(c_str!("my_debugfs_dir")); 189 - /// let file = KBox::pin_init(dir.read_binary_file(c_str!("foo"), [0x1, 0x2]), GFP_KERNEL)?; 190 + /// # let dir = Dir::new(c"my_debugfs_dir"); 191 + /// let file = KBox::pin_init(dir.read_binary_file(c"foo", [0x1, 0x2]), GFP_KERNEL)?; 190 192 /// # Ok::<(), Error>(()) 191 193 /// ``` 192 194 pub fn read_binary_file<'a, T, E: 'a>( ··· 208 212 /// 209 213 /// ``` 210 214 /// # use core::sync::atomic::{AtomicU32, Ordering}; 211 - /// # use kernel::c_str; 212 215 /// # use kernel::debugfs::Dir; 213 216 /// # use kernel::prelude::*; 214 - /// # let dir = Dir::new(c_str!("foo")); 217 + /// # let dir = Dir::new(c"foo"); 215 218 /// let file = KBox::pin_init( 216 - /// dir.read_callback_file(c_str!("bar"), 219 + /// dir.read_callback_file(c"bar", 217 220 /// AtomicU32::new(3), 218 221 /// &|val, f| { 219 222 /// let out = val.load(Ordering::Relaxed);