[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250710-core-cstr-cstrings-v1-5-027420ea799e@gmail.com>
Date: Thu, 10 Jul 2025 11:31:08 -0400
From: Tamir Duberstein <tamird@...il.com>
To: "Rafael J. Wysocki" <rafael@...nel.org>,
Viresh Kumar <viresh.kumar@...aro.org>, Miguel Ojeda <ojeda@...nel.org>,
Alex Gaynor <alex.gaynor@...il.com>, Boqun Feng <boqun.feng@...il.com>,
Gary Guo <gary@...yguo.net>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>,
Benno Lossin <lossin@...nel.org>, Andreas Hindborg <a.hindborg@...nel.org>,
Alice Ryhl <aliceryhl@...gle.com>, Trevor Gross <tmgross@...ch.edu>,
Danilo Krummrich <dakr@...nel.org>,
Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
Maxime Ripard <mripard@...nel.org>, Thomas Zimmermann <tzimmermann@...e.de>,
David Airlie <airlied@...il.com>, Simona Vetter <simona@...ll.ch>,
FUJITA Tomonori <fujita.tomonori@...il.com>, Andrew Lunn <andrew@...n.ch>,
Heiner Kallweit <hkallweit1@...il.com>,
Russell King <linux@...linux.org.uk>,
"David S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
Michael Turquette <mturquette@...libre.com>,
Stephen Boyd <sboyd@...nel.org>, Breno Leitao <leitao@...ian.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Luis Chamberlain <mcgrof@...nel.org>, Russ Weight <russ.weight@...ux.dev>,
Dave Ertman <david.m.ertman@...el.com>, Ira Weiny <ira.weiny@...el.com>,
Leon Romanovsky <leon@...nel.org>, Bjorn Helgaas <bhelgaas@...gle.com>,
Krzysztof Wilczyński <kwilczynski@...nel.org>,
Arnd Bergmann <arnd@...db.de>, Brendan Higgins <brendan.higgins@...ux.dev>,
David Gow <davidgow@...gle.com>, Rae Moar <rmoar@...gle.com>,
Jens Axboe <axboe@...nel.dk>
Cc: linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org,
rust-for-linux@...r.kernel.org, nouveau@...ts.freedesktop.org,
dri-devel@...ts.freedesktop.org, netdev@...r.kernel.org,
linux-clk@...r.kernel.org, linux-pci@...r.kernel.org,
linux-kselftest@...r.kernel.org, kunit-dev@...glegroups.com,
linux-block@...r.kernel.org, Tamir Duberstein <tamird@...il.com>
Subject: [PATCH 05/17] rust: configfs: 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.
Acked-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Reviewed-by: Alice Ryhl <aliceryhl@...gle.com>
Signed-off-by: Tamir Duberstein <tamird@...il.com>
---
rust/kernel/configfs.rs | 5 ++---
samples/rust/rust_configfs.rs | 5 ++---
2 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/rust/kernel/configfs.rs b/rust/kernel/configfs.rs
index d4797c41ba77..9e7308e4d4ce 100644
--- a/rust/kernel/configfs.rs
+++ b/rust/kernel/configfs.rs
@@ -21,7 +21,6 @@
//!
//! ```ignore
//! use kernel::alloc::flags;
-//! use kernel::c_str;
//! use kernel::configfs_attrs;
//! use kernel::configfs;
//! use kernel::new_mutex;
@@ -50,7 +49,7 @@
//!
//! try_pin_init!(Self {
//! config <- configfs::Subsystem::new(
-//! c_str!("rust_configfs"), item_type, Configuration::new()
+//! c"rust_configfs", item_type, Configuration::new()
//! ),
//! })
//! }
@@ -66,7 +65,7 @@
//! impl Configuration {
//! fn new() -> impl PinInit<Self, Error> {
//! try_pin_init!(Self {
-//! message: c_str!("Hello World\n"),
+//! message: c"Hello World\n",
//! bar <- new_mutex!((KBox::new([0; PAGE_SIZE], flags::GFP_KERNEL)?, 0)),
//! })
//! }
diff --git a/samples/rust/rust_configfs.rs b/samples/rust/rust_configfs.rs
index 5005453f874d..ea84c23b784b 100644
--- a/samples/rust/rust_configfs.rs
+++ b/samples/rust/rust_configfs.rs
@@ -3,7 +3,6 @@
//! Rust configfs sample.
use kernel::alloc::flags;
-use kernel::c_str;
use kernel::configfs;
use kernel::configfs_attrs;
use kernel::new_mutex;
@@ -35,7 +34,7 @@ struct Configuration {
impl Configuration {
fn new() -> impl PinInit<Self, Error> {
try_pin_init!(Self {
- message: c_str!("Hello World\n"),
+ message: c"Hello World\n",
bar <- new_mutex!((KBox::new([0; PAGE_SIZE], flags::GFP_KERNEL)?, 0)),
})
}
@@ -61,7 +60,7 @@ fn init(_module: &'static ThisModule) -> impl PinInit<Self, Error> {
try_pin_init!(Self {
config <- configfs::Subsystem::new(
- c_str!("rust_configfs"), item_type, Configuration::new()
+ c"rust_configfs", item_type, Configuration::new()
),
})
}
--
2.50.0
Powered by blists - more mailing lists