Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp51809rdb; Mon, 22 Jan 2024 11:36:12 -0800 (PST) X-Google-Smtp-Source: AGHT+IFsEg62a4CqZMmvhId3WKqraDzyCvd1TaVyTLjGWwgX/D9J+lp5jpwgceOykn3LP9ub4YlP X-Received: by 2002:a05:6808:19a8:b0:3bd:bd4a:73d3 with SMTP id bj40-20020a05680819a800b003bdbd4a73d3mr1161065oib.16.1705952172134; Mon, 22 Jan 2024 11:36:12 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705952172; cv=pass; d=google.com; s=arc-20160816; b=a/G8+j69+o9nWySLwOiyZE6r5GklH7Vz/QVGAc/A5f1T+/pHrRvvvT2ehRONlkC9am rlpZqF3IZV3fyqp4gyvwbHz8M4ECqsXv2vslr/zGv5tgyCGVJed6mY88ysnIojirPEA0 aAVZylNkjvPdlhYChneSns3l++1ONEpS85FbcBEsEflO8aCUDKAkX1qwSOLsFG2ON/J9 jLlbFXD80G7Di/2oI+a6HBiek2RJRZVryOF4hglxc/IXcG8LTXbLgUARJRlkPaBZYlYI 5jFjrzixQ0qSHTUwzsHcebj2xd7CsNYoCpe4PGMquVp/hzqR9XkGAWkHyi5W390sc6bE PXUw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=mH+A2U1VvSMyIWwTHttmN2seE3o82SuUwBxBewBrKCA=; fh=BftBq2Ne7b3nwEL/3woVXwgJZZtPhaDK7dJnuLuxbeU=; b=YvfVUD9/ufg9nIWKpLQtGxsuWNKT2hU0/LOYQfiauUq+VPwTj7Wocbw8sjEmyOpUBX BFqFqG024LSJhtAkyMAMErTi8re9Idgzb2SBx20E8IKiXRpaxLoxAXSrPtR8HPn52Uy4 RmaGRGn5fMCU1DIzcxrmAGnAM4VIUgyOCuDcUJCuSNGKtTKIsD0Mvh47cWY3NfGIgCJk xg27m76Jl7sns+knQJWlmMqhRvrNPqPNquH6brJPlFiuTLyI0hb8HKY16oECtSnqt9qg HNACdRyPLOdqfm3FzpP+G1zIgMS8CpzQ2dot0HqirDKNqAEdJmhC/gtjcOeFLBC/Y1j4 Sdtw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="Qrhe2/lN"; arc=pass (i=1 dkim=pass dkdomain=linuxfoundation.org); spf=pass (google.com: domain of linux-kernel+bounces-34058-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-34058-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id c5-20020ac87d85000000b00429e709ac37si6355293qtd.478.2024.01.22.11.36.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 11:36:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-34058-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="Qrhe2/lN"; arc=pass (i=1 dkim=pass dkdomain=linuxfoundation.org); spf=pass (google.com: domain of linux-kernel+bounces-34058-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-34058-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 5C5401C289FE for ; Mon, 22 Jan 2024 19:35:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5AEF53F8EC; Mon, 22 Jan 2024 19:35:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="Qrhe2/lN" 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 7317C3E48B; Mon, 22 Jan 2024 19:35:35 +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=1705952135; cv=none; b=NKdf+YKKD8fJ7CnDMzEvpQ2uBHnmjyHJb77e07xaouS7ZLFBoaNz9w2CoMsAa6KZs+2SHD4bzv5PvLsDYWvm/vNPb3NzTDrlDfWjUdo4yjFvqXDdGdqLdp1rlegGqllzI+ELkVCZdLUA28a7NuzLDg3cSHyx7GTYONRH9IGe9mU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705952135; c=relaxed/simple; bh=1lXOq5qDkUOa83Aa7WVT5wfgzQWPcBZAWgjgHtQo6dU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=CYC5gbeHsxB5f+HP4kQ0gfcEMJf1BK7qSqfkwNoieGBhDDvgyDeNOPK/38dyZ4psKL3XVYk0J/Od93iirgR554pza33HAQGLo2De/dLp4FVWdPOS0IlMa4AMmYT+DY6EQIwS4GIHnQipLhBNCV7RbS7+wycCMUa3Q7C+1ZR70CA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=Qrhe2/lN; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id B4EFCC43390; Mon, 22 Jan 2024 19:35:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1705952134; bh=1lXOq5qDkUOa83Aa7WVT5wfgzQWPcBZAWgjgHtQo6dU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Qrhe2/lNlzMbLaFZRMOAm/C/oaHx6uGK9m4wem30PrUcGh2FkSk/9KmYD/7wXd0Rm hU2tILOfmfuoJSIe1D80A/EbKhu8S/FVCC/+K0bK4PE6KHya9Yj/E3Y1xvMuX/6H7o nJ1RxGKqPq5YmhTEMp806hubvEpG/NQoQNKJVRO0= Date: Mon, 22 Jan 2024 11:35:29 -0800 From: Greg KH To: Danilo Krummrich Cc: ojeda@kernel.org, alex.gaynor@gmail.com, wedsonaf@gmail.com, boqun.feng@gmail.com, gary@garyguo.net, bjorn3_gh@protonmail.com, benno.lossin@proton.me, a.hindborg@samsung.com, aliceryhl@google.com, rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] rust: str: add to_ascii_{upper,lower}case() to CString Message-ID: <2024012252-attempt-tables-e3fc@gregkh> References: <20240122184608.11863-1-dakr@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240122184608.11863-1-dakr@redhat.com> On Mon, Jan 22, 2024 at 07:45:57PM +0100, Danilo Krummrich wrote: > Add functions to convert a CString to upper- / lowercase assuming all > characters are ASCII encoded. > > Signed-off-by: Danilo Krummrich > --- > rust/kernel/str.rs | 10 ++++++++++ > 1 file changed, 10 insertions(+) > > diff --git a/rust/kernel/str.rs b/rust/kernel/str.rs > index 7d848b83add4..d21151d89861 100644 > --- a/rust/kernel/str.rs > +++ b/rust/kernel/str.rs > @@ -581,6 +581,16 @@ pub fn try_from_fmt(args: fmt::Arguments<'_>) -> Result { > // exist in the buffer. > Ok(Self { buf }) > } > + > + /// Converts the whole CString to lowercase. > + pub fn to_ascii_lowercase(&mut self) { > + self.buf.make_ascii_lowercase(); > + } > + > + /// Converts the whole CString to uppercase. > + pub fn to_ascii_uppercase(&mut self) { > + self.buf.make_ascii_uppercase(); > + } How are you handling locales? thanks, greg k-h