From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 854A230115E; Fri, 4 Jul 2025 13:00:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751634040; cv=none; b=SKe0fAGSOx1JFqKAcC7jmbgGSKazfi17EXF98nTfCmeLnq5yV7JyZniqn3sNm6fGwQLfnaIfSZLVUC+FbTQn4OP/RgdcfInNo+4CMKE5qavggoSjnODOt4nhk3dqf3bDU2yp8zT4MMt9x24YnXYwbL4otgL1SIEvJhq/e6tLIH8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751634040; c=relaxed/simple; bh=PQ+uuvbgXKFc5vIr220QI1Lf8oYUGvsoSa+Kga5uCxI=; h=Mime-Version:Content-Type:Date:Message-Id:Subject:From:To:Cc: References:In-Reply-To; b=CyR8vl9fWmINm7RKWId4dKPyemJ+9FqSebnWLZfFSs+UEEcvziTdvmE78TALAjSnNGurITdNjyS+SEu8DCBS807qDW6WL/bDrnQZx5dCJuxYJE94bbP6/KZGu2OL2Hm6q/X0mtxxoz1z+F233S/Li37GmVT0W4joNTzs5rGAUGU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=mi+LrZHj; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="mi+LrZHj" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3F840C4CEE3; Fri, 4 Jul 2025 13:00:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1751634040; bh=PQ+uuvbgXKFc5vIr220QI1Lf8oYUGvsoSa+Kga5uCxI=; h=Date:Subject:From:To:Cc:References:In-Reply-To:From; b=mi+LrZHjF+yRfLmrMqCm45+w6sUTBWLIFLln4t06TCRfNNID72odMCaUkq6P7uCUX 6UUsEVXl8dcAwtsGpEQ4be8tzBNVlVqFR/dHUws6kyBu1YvtpkQhwwKUxloNwWR9R/ IGSdHN0MxrYLaSCkpAV78+BdMxg3sCNdQTC9sRmKmYWFLMqIw4rrFCZRyV7KRJtd2E 0j73lXtusTnleqcS0NxrPxjaCD0MHAoeWaeskbB4i7ET3pELASmMynDmabvpgju8s5 lM5kWnUgAXLXzxzcI7AEuaVKCn3OYtKdR4/uhCwyRJ5lqmW3Ng5o+Qj0VkMX0rxdf6 342H5Q7Nz/erA== Precedence: bulk X-Mailing-List: rust-for-linux@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Fri, 04 Jul 2025 15:00:24 +0200 Message-Id: Subject: Re: [PATCH v13 3/5] rust: replace `CStr` with `core::ffi::CStr` From: "Benno Lossin" To: "Tamir Duberstein" , "Michal Rostecki" , "Miguel Ojeda" , "Alex Gaynor" , "Boqun Feng" , "Gary Guo" , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= , "Andreas Hindborg" , "Alice Ryhl" , "Trevor Gross" , "Brendan Higgins" , "David Gow" , "Rae Moar" , "Danilo Krummrich" , "Maarten Lankhorst" , "Maxime Ripard" , "Thomas Zimmermann" , "David Airlie" , "Simona Vetter" , "Greg Kroah-Hartman" , "Rafael J. Wysocki" , "Luis Chamberlain" , "Russ Weight" , "FUJITA Tomonori" , "Rob Herring" , "Saravana Kannan" , "Peter Zijlstra" , "Ingo Molnar" , "Will Deacon" , "Waiman Long" , "Nathan Chancellor" , "Nick Desaulniers" , "Bill Wendling" , "Justin Stitt" , "Andrew Lunn" , "Heiner Kallweit" , "Russell King" , "David S. Miller" , "Eric Dumazet" , "Jakub Kicinski" , "Paolo Abeni" , "Bjorn Helgaas" , "Arnd Bergmann" , "Jens Axboe" , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , "Dave Ertman" , "Ira Weiny" , "Leon Romanovsky" , "Breno Leitao" , "Viresh Kumar" , "Michael Turquette" , "Stephen Boyd" Cc: , , , , , , , , , , , , X-Mailer: aerc 0.20.1 References: <20250701-cstr-core-v13-0-29f7d3eb97a6@gmail.com> <20250701-cstr-core-v13-3-29f7d3eb97a6@gmail.com> In-Reply-To: <20250701-cstr-core-v13-3-29f7d3eb97a6@gmail.com> On Tue Jul 1, 2025 at 6:49 PM CEST, Tamir Duberstein wrote: > `kernel::ffi::CStr` was introduced in commit d126d2380131 ("rust: str: > add `CStr` type") in November 2022 as an upstreaming of earlier work > that was done in May 2021[0]. That earlier work, having predated the > inclusion of `CStr` in `core`, largely duplicated the implementation of > `std::ffi::CStr`. > > `std::ffi::CStr` was moved to `core::ffi::CStr` in Rust 1.64 in > September 2022. Hence replace `kernel::str::CStr` with `core::ffi::CStr` > to reduce our custom code footprint, and retain needed custom > functionality through an extension trait. > > C-String literals were added in Rust 1.77, while our MSRV is 1.78. Thus > opportunistically replace instances of `kernel::c_str!` with C-String > literals where other code changes were already necessary or where > existing code triggered clippy lints; the rest will be done in a later > commit. > > Link: https://github.com/Rust-for-Linux/linux/commit/faa3cbcca03d0dec8f8e= 43f1d8d5c0860d98a23f [0] > Acked-by: Greg Kroah-Hartman > Reviewed-by: Alice Ryhl > Signed-off-by: Tamir Duberstein > --- > drivers/gpu/drm/drm_panic_qr.rs | 2 +- > rust/kernel/auxiliary.rs | 4 +- > rust/kernel/configfs.rs | 4 +- > rust/kernel/cpufreq.rs | 2 +- > rust/kernel/device.rs | 4 +- > rust/kernel/drm/device.rs | 4 +- > rust/kernel/error.rs | 4 +- > rust/kernel/firmware.rs | 11 +- > rust/kernel/kunit.rs | 6 +- > rust/kernel/miscdevice.rs | 2 +- > rust/kernel/net/phy.rs | 2 +- > rust/kernel/of.rs | 2 +- > rust/kernel/prelude.rs | 5 +- > rust/kernel/seq_file.rs | 4 +- > rust/kernel/str.rs | 394 +++++++++++-----------------------= ------ > rust/kernel/sync/condvar.rs | 2 +- > rust/kernel/sync/lock.rs | 2 +- > rust/kernel/sync/lock/global.rs | 2 +- > samples/rust/rust_configfs.rs | 2 +- > 19 files changed, 140 insertions(+), 318 deletions(-) Is it also possible to split this? First rename the existing functions on our CStr to match upstream & then you don't need to do the rename & removal of our CStr in the same patch? --- Cheers, Benno