Re: [PATCH] rust: seq_file: replace `kernel::c_str!` with C-Strings
From: Tamir Duberstein
Date: Mon Jan 19 2026 - 07:53:36 EST
On Sat, Jan 3, 2026 at 9:29 PM Tamir Duberstein <tamird@xxxxxxxxx> wrote:
>
> On Mon, Dec 22, 2025 at 7:19 AM Tamir Duberstein <tamird@xxxxxxxxxx> wrote:
> >
> > From: Tamir Duberstein <tamird@xxxxxxxxx>
> >
> > 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@xxxxxxxxxxxxxxxxxxx>
> > Reviewed-by: Alice Ryhl <aliceryhl@xxxxxxxxxx>
> > Reviewed-by: Benno Lossin <lossin@xxxxxxxxxx>
> > Signed-off-by: Tamir Duberstein <tamird@xxxxxxxxx>
> > ---
> > rust/kernel/seq_file.rs | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/rust/kernel/seq_file.rs b/rust/kernel/seq_file.rs
> > index 855e533813a6..518265558d66 100644
> > --- a/rust/kernel/seq_file.rs
> > +++ b/rust/kernel/seq_file.rs
> > @@ -4,7 +4,7 @@
> > //!
> > //! C header: [`include/linux/seq_file.h`](srctree/include/linux/seq_file.h)
> >
> > -use crate::{bindings, c_str, fmt, str::CStrExt as _, types::NotThreadSafe, types::Opaque};
> > +use crate::{bindings, fmt, str::CStrExt as _, types::NotThreadSafe, types::Opaque};
> >
> > /// A utility for generating the contents of a seq file.
> > #[repr(transparent)]
> > @@ -36,7 +36,7 @@ pub fn call_printf(&self, args: fmt::Arguments<'_>) {
> > unsafe {
> > bindings::seq_printf(
> > self.inner.get(),
> > - c_str!("%pA").as_char_ptr(),
> > + c"%pA".as_char_ptr(),
> > core::ptr::from_ref(&args).cast::<crate::ffi::c_void>(),
> > );
> > }
> >
> > ---
> > base-commit: 8f0b4cce4481fb22653697cced8d0d04027cb1e8
> > change-id: 20251222-cstr-vfs-55ca2ceca0a4
> >
> > Best regards,
> > --
> > Tamir Duberstein <tamird@xxxxxxxxx>
> >
>
> @Christian could you please have a look?
>
> Cheers.
> Tamir
Alexander or Christian: could you please take this through vfs or
would you be ok with it going through rust-next?