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 2E5F52E36EC; Sat, 5 Jul 2025 09:15:51 +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=1751706952; cv=none; b=IWR+JmA0/ScSJtZ82h4xZ/MPiYTly/KHOduf/SNYWxQ64qw+UcumxzbuuhIUd6nHaaraLKabL8CGsG9V1V1/heH9eiBCYcW9Oc9Mm6mJikxeYiUW+zJWWOs5MirlEzk5WFo9Q6ZzWaNw/z77Yn6UV1ghPRE6rOOjqYDG+f9PvqE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751706952; c=relaxed/simple; bh=zAAwL1qn9DWYaFXEYo3FHdzOi6eWfYIf0GhD/81me8I=; h=Mime-Version:Content-Type:Date:Message-Id:Cc:Subject:From:To: References:In-Reply-To; b=URHhUSaT3lfcaexiZ2c468Vm15hmRMnW85Kzkn4XXXdrlNpnR2i86YslJqrArLUSPKapuIhAKYCiFjXh1zSbdWjLgKyP5+XV85X/Ehq6wvvGgIYX4keDzOH0rUs9ovZgABn0Qi+/QpT7grK3RvB+fY7vkq/Hh6+gaYzGEdFaPCk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=VbXaelXj; 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="VbXaelXj" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DBDB0C4CEE7; Sat, 5 Jul 2025 09:15:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1751706951; bh=zAAwL1qn9DWYaFXEYo3FHdzOi6eWfYIf0GhD/81me8I=; h=Date:Cc:Subject:From:To:References:In-Reply-To:From; b=VbXaelXjrbmiJwwmiM8rVc2FLbx9FZq2GjG+M4uRZSSKbUGRyyKOGF8pC82TJ1Zwe or72p6rhJA8vKjVtOiaX5p2KBpUUA/EaCkQ4HNOoNlR1omc9y0eiAqsevVZ+e2rLJF SMhVZjwHdAGhc3H0hgXTkfLyhNSN1OD9sHfJhq9nFd05Yf1HA5LUQef20WzoVtNSVr E9YT/jjS8tnvHtWwlElv0Y838z0aaLTbhzgYO2ZIs9TQq4ngbO8QjY2Jl6q/9/OTwE Lj6wRBc1lwBLpAwtoTmH6EZoN58NHGrYN8lQst+JZi6lsjf94hqsTwp9hD5kFSP6dr w56MSIa42VUWg== 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: Sat, 05 Jul 2025 11:15:46 +0200 Message-Id: Cc: , , , , Subject: Re: [PATCH 5/6] rust: add `CStr` methods matching `core::ffi::CStr` From: "Benno Lossin" To: "Tamir Duberstein" , "Rafael J. Wysocki" , "Viresh Kumar" , "Danilo Krummrich" , "David Airlie" , "Simona Vetter" , "Nishanth Menon" , "Stephen Boyd" , "Miguel Ojeda" , "Alex Gaynor" , "Boqun Feng" , "Gary Guo" , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= , "Andreas Hindborg" , "Alice Ryhl" , "Trevor Gross" X-Mailer: aerc 0.20.1 References: <20250704-core-cstr-prepare-v1-0-a91524037783@gmail.com> <20250704-core-cstr-prepare-v1-5-a91524037783@gmail.com> In-Reply-To: <20250704-core-cstr-prepare-v1-5-a91524037783@gmail.com> On Fri Jul 4, 2025 at 10:14 PM CEST, Tamir Duberstein wrote: > Prepare for replacing `CStr` with `core::ffi::CStr` by soft-deprecating > methods which don't exist on `core::ffi::CStr`. > > We could keep `as_bytes{,_with_nul}` through an extension trait but > seeing as we have to introduce `as_char_ptr_in_const_context` as a free > function, we may as well introduce `to_bytes{,_with_nul}` here to allow > downstream code to migrate in one cycle rather than two. > > Link: https://github.com/Rust-for-Linux/linux/issues/1075 > Signed-off-by: Tamir Duberstein Reviewed-by: Benno Lossin --- Cheers, Benno > --- > rust/kernel/str.rs | 37 ++++++++++++++++++++++++++++++++++--- > 1 file changed, 34 insertions(+), 3 deletions(-)