public inbox for rust-for-linux@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] rust: sync: replace `kernel::c_str!` with C-Strings
@ 2026-01-20 21:13 Tamir Duberstein
  2026-01-20 21:16 ` Gary Guo
  2026-01-21  1:09 ` Boqun Feng
  0 siblings, 2 replies; 8+ messages in thread
From: Tamir Duberstein @ 2026-01-20 21:13 UTC (permalink / raw)
  To: Miguel Ojeda, Boqun Feng, Gary Guo, Björn Roy Baron,
	Benno Lossin, Andreas Hindborg, Alice Ryhl, Trevor Gross,
	Danilo Krummrich
  Cc: rust-for-linux, linux-kernel, Tamir Duberstein

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@kernel.org>
---
This is the same as my earlier change[0] but applies to additional
code[1] which didn't make it to mainline in a timely manner and is now
queued for v7.0.

Link: https://lore.kernel.org/all/20251117-core-cstr-cstrings-v4-1-924886ad9f75@gmail.com/ [0]
Link: https://lore.kernel.org/all/20250811-lock-class-key-cleanup-v3-2-b12967ee1ca2@google.com/ [1]
---
 rust/kernel/sync.rs | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/rust/kernel/sync.rs b/rust/kernel/sync.rs
index b10e576221ff..993dbf2caa0e 100644
--- a/rust/kernel/sync.rs
+++ b/rust/kernel/sync.rs
@@ -126,13 +126,12 @@ fn drop(self: Pin<&mut Self>) {
 /// # Examples
 ///
 /// ```
-/// use kernel::c_str;
 /// use kernel::sync::{static_lock_class, Arc, SpinLock};
 ///
 /// fn new_locked_int() -> Result<Arc<SpinLock<u32>>> {
 ///     Arc::pin_init(SpinLock::new(
 ///         42,
-///         c_str!("new_locked_int"),
+///         c"new_locked_int",
 ///         static_lock_class!(),
 ///     ), GFP_KERNEL)
 /// }

---
base-commit: d08c85ac8894995d4b0d8fb48d2f6a3e53cd79ab
change-id: 20260120-cstr-sync-again-5912d7479909

Best regards,
--  
Tamir Duberstein <tamird@kernel.org>


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] rust: sync: replace `kernel::c_str!` with C-Strings
  2026-01-20 21:13 [PATCH] rust: sync: replace `kernel::c_str!` with C-Strings Tamir Duberstein
@ 2026-01-20 21:16 ` Gary Guo
  2026-01-21  1:09 ` Boqun Feng
  1 sibling, 0 replies; 8+ messages in thread
From: Gary Guo @ 2026-01-20 21:16 UTC (permalink / raw)
  To: Tamir Duberstein, Miguel Ojeda, Boqun Feng, Gary Guo,
	Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl,
	Trevor Gross, Danilo Krummrich
  Cc: rust-for-linux, linux-kernel

On Tue Jan 20, 2026 at 9:13 PM GMT, Tamir Duberstein wrote:
> 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@kernel.org>

Reviewed-by: Gary Guo <gary@garyguo.net>

> ---
> This is the same as my earlier change[0] but applies to additional
> code[1] which didn't make it to mainline in a timely manner and is now
> queued for v7.0.
> 
> Link: https://lore.kernel.org/all/20251117-core-cstr-cstrings-v4-1-924886ad9f75@gmail.com/ [0]
> Link: https://lore.kernel.org/all/20250811-lock-class-key-cleanup-v3-2-b12967ee1ca2@google.com/ [1]
> ---
>  rust/kernel/sync.rs | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] rust: sync: replace `kernel::c_str!` with C-Strings
  2026-01-20 21:13 [PATCH] rust: sync: replace `kernel::c_str!` with C-Strings Tamir Duberstein
  2026-01-20 21:16 ` Gary Guo
@ 2026-01-21  1:09 ` Boqun Feng
  2026-01-23  5:46   ` [GIT PULL][PATCH 0/1] Fixes for Rust synchronization PR of v7.0 Boqun Feng
  1 sibling, 1 reply; 8+ messages in thread
From: Boqun Feng @ 2026-01-21  1:09 UTC (permalink / raw)
  To: Tamir Duberstein, Peter Zijlstra
  Cc: Miguel Ojeda, Gary Guo, Björn Roy Baron, Benno Lossin,
	Andreas Hindborg, Alice Ryhl, Trevor Gross, Danilo Krummrich,
	rust-for-linux, linux-kernel

[Cc Peter]

Peter, could you take this to into tip/locking/core so that it'll be
in the PR of v7.0?

On Tue, Jan 20, 2026 at 04:13:19PM -0500, Tamir Duberstein wrote:
> 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@kernel.org>

Reviewed-by: Boqun Feng <boqun.feng@gmail.com>

Regards,
Boqun

> ---
> This is the same as my earlier change[0] but applies to additional
> code[1] which didn't make it to mainline in a timely manner and is now
> queued for v7.0.
> 
> Link: https://lore.kernel.org/all/20251117-core-cstr-cstrings-v4-1-924886ad9f75@gmail.com/ [0]
> Link: https://lore.kernel.org/all/20250811-lock-class-key-cleanup-v3-2-b12967ee1ca2@google.com/ [1]
> ---
>  rust/kernel/sync.rs | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/rust/kernel/sync.rs b/rust/kernel/sync.rs
> index b10e576221ff..993dbf2caa0e 100644
> --- a/rust/kernel/sync.rs
> +++ b/rust/kernel/sync.rs
> @@ -126,13 +126,12 @@ fn drop(self: Pin<&mut Self>) {
>  /// # Examples
>  ///
>  /// ```
> -/// use kernel::c_str;
>  /// use kernel::sync::{static_lock_class, Arc, SpinLock};
>  ///
>  /// fn new_locked_int() -> Result<Arc<SpinLock<u32>>> {
>  ///     Arc::pin_init(SpinLock::new(
>  ///         42,
> -///         c_str!("new_locked_int"),
> +///         c"new_locked_int",
>  ///         static_lock_class!(),
>  ///     ), GFP_KERNEL)
>  /// }
> 
> ---
> base-commit: d08c85ac8894995d4b0d8fb48d2f6a3e53cd79ab
> change-id: 20260120-cstr-sync-again-5912d7479909
> 
> Best regards,
> --  
> Tamir Duberstein <tamird@kernel.org>
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [GIT PULL][PATCH 0/1] Fixes for Rust synchronization PR of v7.0
  2026-01-21  1:09 ` Boqun Feng
@ 2026-01-23  5:46   ` Boqun Feng
  2026-01-23  5:46     ` [PATCH 1/1] rust: sync: Replace `kernel::c_str!` with C-Strings Boqun Feng
                       ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Boqun Feng @ 2026-01-23  5:46 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: Tamir Duberstein, Miguel Ojeda, Gary Guo, Björn Roy Baron,
	Benno Lossin, Andreas Hindborg, Alice Ryhl, Trevor Gross,
	Danilo Krummrich, rust-for-linux, linux-kernel, Boqun Feng

Hi Peter,

Although we chatted about this over IRC, but I figured it might be
better for me to just send a fix PR for this, so here is it.

Thanks!

Regards,
Boqun

--------------------------------->8
The following changes since commit ccf9e070116a81d29aae30db501d562c8efd1ed8:

  rust: sync: Inline various lock related methods (2026-01-10 10:53:46 +0800)

are available in the Git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/boqun/linux.git tags/rust-sync-fixes-for-v7.0-pr

for you to fetch changes up to 6583920e15fc567109e1c64ca58c917f52f40736:

  rust: sync: Replace `kernel::c_str!` with C-Strings (2026-01-22 21:36:57 -0800)

----------------------------------------------------------------
Fixes for Rust sync v7.0 PR:

- Remove the usage of `c_str!()` in the example of static_lock_class!()
-----BEGIN PGP SIGNATURE-----

iQFJBAABCAAzFiEEj5IosQTPz8XU1wRHSXnow7UH+rgFAmlzCUwVHGJvcXVuLmZl
bmdAZ21haWwuY29tAAoJEEl56MO1B/q43YYIAIkVv+YTbNpODC5Kfy2F0/XxeHoB
MbBSKvma6QR2m1Qx0c09o2NKcEU4ZnoPEi4WDhAs1ftfSyyc1CwE6gBApFirBvIu
VzAWcEKJkM16+IiWQDQKPbWssraNmKGw4zeZlXi6q+iry+2r+Hy+6JdikcgCshYn
+BYKjrkAh+mkXrQ1F95PfK0tfiT8fIbJCIeroPi9HlCmNlAYx0dP0i3YvF+5nWhB
a5rU4TmQDKmCXXwyIqVQeOkK4kMme6wPOOSxjd5g4W/srS9hcmM3mYAASl1omm2X
hr/9yyUOxSLUkG9e0x9XIhBkK4YwGS0dLIG6SQCvh//2vX9ek8BzBUvHzE0=
=xOu4
-----END PGP SIGNATURE-----

----------------------------------------------------------------
Tamir Duberstein (1):
      rust: sync: Replace `kernel::c_str!` with C-Strings

 rust/kernel/sync.rs | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

-- 
2.50.1 (Apple Git-155)


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/1] rust: sync: Replace `kernel::c_str!` with C-Strings
  2026-01-23  5:46   ` [GIT PULL][PATCH 0/1] Fixes for Rust synchronization PR of v7.0 Boqun Feng
@ 2026-01-23  5:46     ` Boqun Feng
  2026-01-27  6:12     ` [GIT PULL][PATCH 0/1] Fixes for Rust synchronization PR of v7.0 Boqun Feng
  2026-01-27  8:30     ` Peter Zijlstra
  2 siblings, 0 replies; 8+ messages in thread
From: Boqun Feng @ 2026-01-23  5:46 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: Tamir Duberstein, Miguel Ojeda, Gary Guo, Björn Roy Baron,
	Benno Lossin, Andreas Hindborg, Alice Ryhl, Trevor Gross,
	Danilo Krummrich, rust-for-linux, linux-kernel, Boqun Feng

From: Tamir Duberstein <tamird@kernel.org>

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@kernel.org>
Reviewed-by: Gary Guo <gary@garyguo.net>
Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
Link: https://patch.msgid.link/20260120-cstr-sync-again-v1-1-2a775a2a36fd@kernel.org
---
 rust/kernel/sync.rs | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/rust/kernel/sync.rs b/rust/kernel/sync.rs
index b10e576221ff..993dbf2caa0e 100644
--- a/rust/kernel/sync.rs
+++ b/rust/kernel/sync.rs
@@ -126,13 +126,12 @@ fn drop(self: Pin<&mut Self>) {
 /// # Examples
 ///
 /// ```
-/// use kernel::c_str;
 /// use kernel::sync::{static_lock_class, Arc, SpinLock};
 ///
 /// fn new_locked_int() -> Result<Arc<SpinLock<u32>>> {
 ///     Arc::pin_init(SpinLock::new(
 ///         42,
-///         c_str!("new_locked_int"),
+///         c"new_locked_int",
 ///         static_lock_class!(),
 ///     ), GFP_KERNEL)
 /// }
-- 
2.50.1 (Apple Git-155)


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [GIT PULL][PATCH 0/1] Fixes for Rust synchronization PR of v7.0
  2026-01-23  5:46   ` [GIT PULL][PATCH 0/1] Fixes for Rust synchronization PR of v7.0 Boqun Feng
  2026-01-23  5:46     ` [PATCH 1/1] rust: sync: Replace `kernel::c_str!` with C-Strings Boqun Feng
@ 2026-01-27  6:12     ` Boqun Feng
  2026-01-27  8:30     ` Peter Zijlstra
  2 siblings, 0 replies; 8+ messages in thread
From: Boqun Feng @ 2026-01-27  6:12 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: Tamir Duberstein, Miguel Ojeda, Gary Guo, Björn Roy Baron,
	Benno Lossin, Andreas Hindborg, Alice Ryhl, Trevor Gross,
	Danilo Krummrich, rust-for-linux, linux-kernel

On Thu, Jan 22, 2026 at 09:46:23PM -0800, Boqun Feng wrote:
> Hi Peter,
> 

Gentle ping ;-)

Thanks!

Regards,
Boqun

> Although we chatted about this over IRC, but I figured it might be
> better for me to just send a fix PR for this, so here is it.
> 
> Thanks!
> 
> Regards,
> Boqun
> 
> --------------------------------->8
> The following changes since commit ccf9e070116a81d29aae30db501d562c8efd1ed8:
> 
>   rust: sync: Inline various lock related methods (2026-01-10 10:53:46 +0800)
> 
> are available in the Git repository at:
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/boqun/linux.git tags/rust-sync-fixes-for-v7.0-pr
> 
> for you to fetch changes up to 6583920e15fc567109e1c64ca58c917f52f40736:
> 
>   rust: sync: Replace `kernel::c_str!` with C-Strings (2026-01-22 21:36:57 -0800)
> 
> ----------------------------------------------------------------
> Fixes for Rust sync v7.0 PR:
> 
> - Remove the usage of `c_str!()` in the example of static_lock_class!()
> -----BEGIN PGP SIGNATURE-----
> 
> iQFJBAABCAAzFiEEj5IosQTPz8XU1wRHSXnow7UH+rgFAmlzCUwVHGJvcXVuLmZl
> bmdAZ21haWwuY29tAAoJEEl56MO1B/q43YYIAIkVv+YTbNpODC5Kfy2F0/XxeHoB
> MbBSKvma6QR2m1Qx0c09o2NKcEU4ZnoPEi4WDhAs1ftfSyyc1CwE6gBApFirBvIu
> VzAWcEKJkM16+IiWQDQKPbWssraNmKGw4zeZlXi6q+iry+2r+Hy+6JdikcgCshYn
> +BYKjrkAh+mkXrQ1F95PfK0tfiT8fIbJCIeroPi9HlCmNlAYx0dP0i3YvF+5nWhB
> a5rU4TmQDKmCXXwyIqVQeOkK4kMme6wPOOSxjd5g4W/srS9hcmM3mYAASl1omm2X
> hr/9yyUOxSLUkG9e0x9XIhBkK4YwGS0dLIG6SQCvh//2vX9ek8BzBUvHzE0=
> =xOu4
> -----END PGP SIGNATURE-----
> 
> ----------------------------------------------------------------
> Tamir Duberstein (1):
>       rust: sync: Replace `kernel::c_str!` with C-Strings
> 
>  rust/kernel/sync.rs | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> -- 
> 2.50.1 (Apple Git-155)
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [GIT PULL][PATCH 0/1] Fixes for Rust synchronization PR of v7.0
  2026-01-23  5:46   ` [GIT PULL][PATCH 0/1] Fixes for Rust synchronization PR of v7.0 Boqun Feng
  2026-01-23  5:46     ` [PATCH 1/1] rust: sync: Replace `kernel::c_str!` with C-Strings Boqun Feng
  2026-01-27  6:12     ` [GIT PULL][PATCH 0/1] Fixes for Rust synchronization PR of v7.0 Boqun Feng
@ 2026-01-27  8:30     ` Peter Zijlstra
  2026-01-27 14:06       ` Boqun Feng
  2 siblings, 1 reply; 8+ messages in thread
From: Peter Zijlstra @ 2026-01-27  8:30 UTC (permalink / raw)
  To: Boqun Feng
  Cc: Tamir Duberstein, Miguel Ojeda, Gary Guo, Björn Roy Baron,
	Benno Lossin, Andreas Hindborg, Alice Ryhl, Trevor Gross,
	Danilo Krummrich, rust-for-linux, linux-kernel

On Thu, Jan 22, 2026 at 09:46:23PM -0800, Boqun Feng wrote:
> Hi Peter,
> 
> Although we chatted about this over IRC, but I figured it might be
> better for me to just send a fix PR for this, so here is it.
> 
> Thanks!
> 
> Regards,
> Boqun
> 
> --------------------------------->8
> The following changes since commit ccf9e070116a81d29aae30db501d562c8efd1ed8:
> 
>   rust: sync: Inline various lock related methods (2026-01-10 10:53:46 +0800)
> 
> are available in the Git repository at:
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/boqun/linux.git tags/rust-sync-fixes-for-v7.0-pr
> 
> for you to fetch changes up to 6583920e15fc567109e1c64ca58c917f52f40736:
> 
>   rust: sync: Replace `kernel::c_str!` with C-Strings (2026-01-22 21:36:57 -0800)
> 
> ----------------------------------------------------------------
> Fixes for Rust sync v7.0 PR:
> 
> - Remove the usage of `c_str!()` in the example of static_lock_class!()

So I'm notoriously bad at keeping track of version numbers; but I'm
thinking you want this in tip/locking/urgent, right? Thing is, it
doesn't apply :/

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [GIT PULL][PATCH 0/1] Fixes for Rust synchronization PR of v7.0
  2026-01-27  8:30     ` Peter Zijlstra
@ 2026-01-27 14:06       ` Boqun Feng
  0 siblings, 0 replies; 8+ messages in thread
From: Boqun Feng @ 2026-01-27 14:06 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: Tamir Duberstein, Miguel Ojeda, Gary Guo, Björn Roy Baron,
	Benno Lossin, Andreas Hindborg, Alice Ryhl, Trevor Gross,
	Danilo Krummrich, rust-for-linux, linux-kernel

On Tue, Jan 27, 2026 at 09:30:14AM +0100, Peter Zijlstra wrote:
> On Thu, Jan 22, 2026 at 09:46:23PM -0800, Boqun Feng wrote:
> > Hi Peter,
> > 
> > Although we chatted about this over IRC, but I figured it might be
> > better for me to just send a fix PR for this, so here is it.
> > 
> > Thanks!
> > 
> > Regards,
> > Boqun
> > 
> > --------------------------------->8
> > The following changes since commit ccf9e070116a81d29aae30db501d562c8efd1ed8:
> > 
> >   rust: sync: Inline various lock related methods (2026-01-10 10:53:46 +0800)
> > 
> > are available in the Git repository at:
> > 
> >   git://git.kernel.org/pub/scm/linux/kernel/git/boqun/linux.git tags/rust-sync-fixes-for-v7.0-pr
> > 
> > for you to fetch changes up to 6583920e15fc567109e1c64ca58c917f52f40736:
> > 
> >   rust: sync: Replace `kernel::c_str!` with C-Strings (2026-01-22 21:36:57 -0800)
> > 
> > ----------------------------------------------------------------
> > Fixes for Rust sync v7.0 PR:
> > 
> > - Remove the usage of `c_str!()` in the example of static_lock_class!()
> 
> So I'm notoriously bad at keeping track of version numbers; but I'm
> thinking you want this in tip/locking/urgent, right? Thing is, it

No, it's targeting tip/locking/core, it's a fix to the PR that is going
into v7.0. Or I guess I could just say it's a "part 2" for the PR to
reduce ambiguity?

Regards,
Boqun

> doesn't apply :/

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2026-01-27 14:06 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-20 21:13 [PATCH] rust: sync: replace `kernel::c_str!` with C-Strings Tamir Duberstein
2026-01-20 21:16 ` Gary Guo
2026-01-21  1:09 ` Boqun Feng
2026-01-23  5:46   ` [GIT PULL][PATCH 0/1] Fixes for Rust synchronization PR of v7.0 Boqun Feng
2026-01-23  5:46     ` [PATCH 1/1] rust: sync: Replace `kernel::c_str!` with C-Strings Boqun Feng
2026-01-27  6:12     ` [GIT PULL][PATCH 0/1] Fixes for Rust synchronization PR of v7.0 Boqun Feng
2026-01-27  8:30     ` Peter Zijlstra
2026-01-27 14:06       ` Boqun Feng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox