rust: seq_file: replace `kernel::c_str!` with C-Strings
Tamir Duberstein
reviewerPATCH 1/1 rust: seq_file: replace `kernel::c_str!` with C-Strings
From: Tamir Duberstein <[email protected]>
C-String literals were added in Rust 1.77. Replace instances of kernel::c_str! with C-String literals where possible.
--- rust/kernel/seq_file.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
rust/kernel/seq_file.rs +2 -2
@@ -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,
Signature · 1 line
Tamir Duberstein <[email protected]>
Quoted 44 lines · Tamir Duberstein
From: Tamir Duberstein <[email protected]>
C-String literals were added in Rust 1.77. Replace instances of
kernel::c_str!with C-String literals where possible.Reviewed-by Alice Ryhl <[email protected]>Reviewed-by Benno Lossin <[email protected]>Signed-off-by Tamir Duberstein <[email protected]>---
rust/kernel/seq_file.rs| 4 ++--1 file changed, 2 insertions(+), 2 deletions(-)rust/kernel/seq_file.rs +2
-3@@ -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
Quoted 5 lines
Best regards,
Signature · 1 line
Tamir Duberstein <[email protected]>
Quoted 41 lines · Tamir Duberstein
From: Tamir Duberstein <[email protected]>
C-String literals were added in Rust 1.77. Replace instances of
kernel::c_str!with C-String literals where possible.Reviewed-by Alice Ryhl <[email protected]>Reviewed-by Benno Lossin <[email protected]>Signed-off-by Tamir Duberstein <[email protected]>--- rust/kernel/seq_file.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)rust/kernel/seq_file.rs +2
-3@@ -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
Quoted 4 lines
Best regards,
--
Tamir Duberstein <[email protected]>
@Christian could you please have a look?
Cheers.
Tamir
Quoted 50 lines · Tamir Duberstein
Quoted 41 lines · Tamir Duberstein
From: Tamir Duberstein <[email protected]>
C-String literals were added in Rust 1.77. Replace instances of
kernel::c_str!with C-String literals where possible.Reviewed-by Alice Ryhl <[email protected]>Reviewed-by Benno Lossin <[email protected]>Signed-off-by Tamir Duberstein <[email protected]>--- rust/kernel/seq_file.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)rust/kernel/seq_file.rs +2
-3@@ -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-55ca2ceca0a4Quoted 4 lines
Best regards,
--
Tamir Duberstein <[email protected]>@Christian could you please have a look?
Quoted 2 lines
Cheers.
Tamir
Alexander or Christian: could you please take this through vfs or would you be ok with it going through rust-next?
Quoted 3 lines · Tamir Duberstein
Alexander or Christian: could you please take this through vfs or would you be ok with it going through rust-next?
Either seems good to me, thanks!
For context, this is part of a long migration:
https://github.com/Rust-for-Linux/linux/issues/1075 https://lore.kernel.org/all/[email protected]/
Cheers,
Miguel
Quoted 8 lines · Miguel Ojeda
Quoted 3 lines · Tamir Duberstein
Alexander or Christian: could you please take this through vfs or would you be ok with it going through rust-next?
Either seems good to me, thanks!
Quoted 7 lines
For context, this is part of a long migration:
https://github.com/Rust-for-Linux/linux/issues/1075 https://lore.kernel.org/all/[email protected]/Cheers,
Miguel
Another ping here, folks! Miguel, what can we do if we do not hear from the vfs maintainers?
Quoted 4 lines · Tamir Duberstein
C-String literals were added in Rust 1.77. Replace instances of
kernel::c_str!with C-String literals where possible.
Applied to the vfs-7.0.misc branch of the vfs/vfs.git tree. Patches in the vfs-7.0.misc branch should appear in linux-next soon.
Please report any outstanding bugs that were missed during review in a new review to the original patch series allowing us to drop it.
It's encouraged to provide Acked-bys and Reviewed-bys even though the patch has now been applied. If possible patch trailers will be updated.
Note that commit hashes shown below are subject to change due to rebase, trailer updates or similar. If in doubt, please check the listed branch.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git branch: vfs-7.0.misc
[1/1] rust: seq_file: replace kernel::c_str! with C-Strings
https://git.kernel.org/vfs/vfs/c/40210c2b11a8
Tamir Duberstein
reviewerQuoted 16 lines · Christian Brauner
Quoted 4 lines · Tamir Duberstein
C-String literals were added in Rust 1.77. Replace instances of
kernel::c_str!with C-String literals where possible.Applied to the vfs-7.0.misc branch of the vfs/vfs.git tree. Patches in the vfs-7.0.misc branch should appear in linux-next soon.
Please report any outstanding bugs that were missed during review in a new review to the original patch series allowing us to drop it.
It's encouraged to provide Acked-bys and Reviewed-bys even though the patch has now been applied. If possible patch trailers will be updated.
Quoted 8 lines
Note that commit hashes shown below are subject to change due to rebase, trailer updates or similar. If in doubt, please check the listed branch.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git branch: vfs-7.0.misc[1/1] rust:
seq_file: replacekernel::c_str!with C-Stringshttps://git.kernel.org/vfs/vfs/c/40210c2b11a8
Thanks Cristian. The commit doesn't seem to exist (with this hash or
any other, see https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git/log/?h=vfs-7.0.misc).
Is this expected?
Cheers.
Tamir
Quoted 4 lines · Tamir Duberstein
Thanks Cristian. The commit doesn't seem to exist (with this hash or
any other, see https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git/log/?h=vfs-7.0.misc).
Is this expected?
Christian may not have pushed the batch yet, given the dates in the repository.
Cheers,
Miguel
Tamir Duberstein
reviewerQuoted 8 lines · Miguel Ojeda
Quoted 4 lines · Tamir Duberstein
Thanks Cristian. The commit doesn't seem to exist (with this hash or
any other, see https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git/log/?h=vfs-7.0.misc).
Is this expected?Christian may not have pushed the batch yet, given the dates in the repository.
Indeed, and that remains true now. Unfortunately this commit wont land in linux-next until pushed, which is making me a bit worried about discovering last-minute breakage.