Message ID | 20230224-rust-error-v2-1-3900319812da@asahilina.net |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp372213vqo; Wed, 29 Mar 2023 05:26:23 -0700 (PDT) X-Google-Smtp-Source: AKy350bdRfrkxxac5hTwpqX/iKom0Y0KAWx2EhP6+Xx8f0E+iR2OyWKV/6Zr1qnKWgHPmJIboBcr X-Received: by 2002:a17:90a:4bca:b0:23d:2d91:ab71 with SMTP id u10-20020a17090a4bca00b0023d2d91ab71mr20430706pjl.6.1680092782841; Wed, 29 Mar 2023 05:26:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680092782; cv=none; d=google.com; s=arc-20160816; b=Ts1TFJWfuzSIyjr+pkXiqwEVGcWeA3WtyTpOPxF0R+oa84oAlFpz7CdGuSGwnhh7wK Mr9/K9SoOs0KABuNTzigENqg6qUhyfVLLrjjib89yKtBEdWK0mKn0arj8dzQkSerrWGe 6slFla9roWjunHwDl1jFm42gLAcHQ2L6aW74uyd2mly+LOjJra/HhXoXaubMbVL/wbsZ 6Q3F2jOfxitOxiQD4su6CEqUR1huVei1sh6vzqphXYtR860MW0LYIMuJMXTSDdKpYmcl AOYCMIdCtGy367tk58GX+Tuu68AuQSGTtqQcBuyBv2/cWdrMkXUuVELQRnokAb38Ns6o N9yw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=d/ZDZp//qJmdJeOAOMWmN1GFeD5lXGfLDYrTs+QHN0c=; b=JRmCUklNN8O6m/CGF2B+urZWaP0q7bKwDV0OVl+XAJvmy9ciAk3mmSJxUrcxSLS6GZ Fk4nw2kO5x2QknjPxtA2Zx1ixQ/2bKTAMMjqgTGhGP6A5eNihpcnCgHlOQ0rO8Ov67gF f2vVi0rDZTQO9yuBxInlXn27O1nw+963VNcp33Hro+YtmqVf5ijEJQIErYEgPmaVXNn5 8MEsxZKTfXpJCH1XVsE7jVrySmKfpbberQ3woIHtFboDatHaF4PedlLq/c7rqlAB4CNf t59yxrA2XmVgw/AfDoKrB05HGQ8COZiapiCH92ePe1PX+ZZa1QJYmIBjaPA+PeSucNWE MVHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@asahilina.net header.s=default header.b=LkP9Ew+Y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=asahilina.net Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t14-20020a63224e000000b0050be4f9909bsi31371888pgm.695.2023.03.29.05.26.09; Wed, 29 Mar 2023 05:26:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@asahilina.net header.s=default header.b=LkP9Ew+Y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=asahilina.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230012AbjC2MFB (ORCPT <rfc822;rua109.linux@gmail.com> + 99 others); Wed, 29 Mar 2023 08:05:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43086 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229750AbjC2MEs (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 29 Mar 2023 08:04:48 -0400 Received: from mail.marcansoft.com (marcansoft.com [212.63.210.85]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BEFC4C0; Wed, 29 Mar 2023 05:04:47 -0700 (PDT) Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: linasend@asahilina.net) by mail.marcansoft.com (Postfix) with ESMTPSA id DF14441F98; Wed, 29 Mar 2023 12:04:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=asahilina.net; s=default; t=1680091486; bh=7wja8b7e1cR7sIIhKDHqBGrFHH4ZjjMoaG3eC2S/l8g=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=LkP9Ew+YkGZHBzX3b2qYbkE7xE0CHA/iZmwS4N+CxN7LgjWneIu9PHW5BFwVvChfx 004xcRMCJ9EmycJwq1YC7TsehLfdcq5z0BR/EBb6xlotuU6Dwt0cYsjj+zM0vwYCd4 A78F7/TuXmCFRUnvkgv0JTWx+uVVt3dijOdkNp6jva+WSSG/9qlmq9U0n+Ql6E1msi j1md0IBdYgcyQP+ksBGqWNgWgijcaOFAoxdUbyKFzBwWXWLdQNfZKVH8jpJJBJ7V5f bHJtjnH4WBsb9chQsRPvS+4bb4wBvGFK0fH1NtFFZYPMob4Jy9RaaL5b1RzBnHNpMe gAn2Z/VKBNwVQ== From: Asahi Lina <lina@asahilina.net> Date: Wed, 29 Mar 2023 21:04:33 +0900 Subject: [PATCH v2 1/6] rust: error: Rename to_kernel_errno() -> to_errno() MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20230224-rust-error-v2-1-3900319812da@asahilina.net> References: <20230224-rust-error-v2-0-3900319812da@asahilina.net> In-Reply-To: <20230224-rust-error-v2-0-3900319812da@asahilina.net> To: Miguel Ojeda <ojeda@kernel.org>, Alex Gaynor <alex.gaynor@gmail.com>, Wedson Almeida Filho <wedsonaf@gmail.com>, Boqun Feng <boqun.feng@gmail.com>, Gary Guo <gary@garyguo.net>, =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= <bjorn3_gh@protonmail.com>, Sven Van Asbroeck <thesven73@gmail.com> Cc: Fox Chen <foxhlchen@gmail.com>, Martin Rodriguez Reboredo <yakoyoku@gmail.com>, Andreas Hindborg <a.hindborg@samsung.com>, rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, asahi@lists.linux.dev, Asahi Lina <lina@asahilina.net> X-Mailer: b4 0.12.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1680091478; l=1196; i=lina@asahilina.net; s=20230221; h=from:subject:message-id; bh=7wja8b7e1cR7sIIhKDHqBGrFHH4ZjjMoaG3eC2S/l8g=; b=kne0zLSHrTRwLBNWWdJZlyhEqojrap6mEiUNwT9Hya5xcb05TI6ZxL69UCWKZQx6xmRUYUVM3 Jzl9RWFoI49D0aF6WsvriRs9AcTLEXYceVVElED7tqThMqYoX15j38o X-Developer-Key: i=lina@asahilina.net; a=ed25519; pk=Qn8jZuOtR1m5GaiDfTrAoQ4NE1XoYVZ/wmt5YtXWFC4= X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761704969976212830?= X-GMAIL-MSGID: =?utf-8?q?1761704969976212830?= |
Series |
rust: error: Add missing wrappers to convert to/from kernel error codes
|
|
Commit Message
Asahi Lina
March 29, 2023, 12:04 p.m. UTC
This is kernel code, so specifying "kernel" is redundant. Let's simplify
things and just call it to_errno().
Signed-off-by: Asahi Lina <lina@asahilina.net>
---
rust/kernel/error.rs | 2 +-
rust/macros/module.rs | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
Comments
On 3/29/23 09:04, Asahi Lina wrote: > This is kernel code, so specifying "kernel" is redundant. Let's simplify > things and just call it to_errno(). > > Signed-off-by: Asahi Lina <lina@asahilina.net> > --- > rust/kernel/error.rs | 2 +- > rust/macros/module.rs | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/rust/kernel/error.rs b/rust/kernel/error.rs > index 5b9751d7ff1d..35894fa35efe 100644 > --- a/rust/kernel/error.rs > +++ b/rust/kernel/error.rs > @@ -73,7 +73,7 @@ pub struct Error(core::ffi::c_int); > > impl Error { > /// Returns the kernel error code. > - pub fn to_kernel_errno(self) -> core::ffi::c_int { > + pub fn to_errno(self) -> core::ffi::c_int { > self.0 > } > } > diff --git a/rust/macros/module.rs b/rust/macros/module.rs > index a7e363c2b044..143336543866 100644 > --- a/rust/macros/module.rs > +++ b/rust/macros/module.rs > @@ -258,7 +258,7 @@ pub(crate) fn module(ts: TokenStream) -> TokenStream { > return 0; > }} > Err(e) => {{ > - return e.to_kernel_errno(); > + return e.to_errno(); > }} > }} > }} > Reviewed-by: Martin Rodriguez Reboredo
On Wed, Mar 29, 2023 at 4:47 PM Martin Rodriguez Reboredo <yakoyoku@gmail.com> wrote: > > Reviewed-by: Martin Rodriguez Reboredo These (in the different patches) are supposed to have <yakoyoku@gmail.com> email when I take them, right? (no need to resend them) Cheers, Miguel
On 3/29/23 12:04, Miguel Ojeda wrote: > On Wed, Mar 29, 2023 at 4:47 PM Martin Rodriguez Reboredo > <yakoyoku@gmail.com> wrote: >> >> Reviewed-by: Martin Rodriguez Reboredo > > These (in the different patches) are supposed to have > <yakoyoku@gmail.com> email when I take them, right? (no need to resend > them) > > Cheers, > Miguel Ah, yes, they were supposed to have my email with it. I wasn't that livened up when I sent them. Thanks -> Martin
On Wed, 29 Mar 2023 21:04:33 +0900 Asahi Lina <lina@asahilina.net> wrote: > This is kernel code, so specifying "kernel" is redundant. Let's simplify > things and just call it to_errno(). > > Signed-off-by: Asahi Lina <lina@asahilina.net> Thanks Lina for implementing my suggestion. Reviewed-by: Gary Guo <gary@garyguo.net> > --- > rust/kernel/error.rs | 2 +- > rust/macros/module.rs | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/rust/kernel/error.rs b/rust/kernel/error.rs > index 5b9751d7ff1d..35894fa35efe 100644 > --- a/rust/kernel/error.rs > +++ b/rust/kernel/error.rs > @@ -73,7 +73,7 @@ pub struct Error(core::ffi::c_int); > > impl Error { > /// Returns the kernel error code. > - pub fn to_kernel_errno(self) -> core::ffi::c_int { > + pub fn to_errno(self) -> core::ffi::c_int { > self.0 > } > } > diff --git a/rust/macros/module.rs b/rust/macros/module.rs > index a7e363c2b044..143336543866 100644 > --- a/rust/macros/module.rs > +++ b/rust/macros/module.rs > @@ -258,7 +258,7 @@ pub(crate) fn module(ts: TokenStream) -> TokenStream { > return 0; > }} > Err(e) => {{ > - return e.to_kernel_errno(); > + return e.to_errno(); > }} > }} > }} >
On Wed, Mar 29, 2023 at 8:16 PM Martin Rodriguez Reboredo <yakoyoku@gmail.com> wrote: > > Ah, yes, they were supposed to have my email with it. I wasn't that > livened up when I sent them. No problem at all! And thanks for reviewing! Cheers, Miguel
On Wed, Mar 29, 2023 at 10:32 PM Gary Guo <gary@garyguo.net> wrote: > > Thanks Lina for implementing my suggestion. I will add a `Suggested-by: you` too when I apply this, shout if you don't want it! Cheers, Miguel
diff --git a/rust/kernel/error.rs b/rust/kernel/error.rs index 5b9751d7ff1d..35894fa35efe 100644 --- a/rust/kernel/error.rs +++ b/rust/kernel/error.rs @@ -73,7 +73,7 @@ pub struct Error(core::ffi::c_int); impl Error { /// Returns the kernel error code. - pub fn to_kernel_errno(self) -> core::ffi::c_int { + pub fn to_errno(self) -> core::ffi::c_int { self.0 } } diff --git a/rust/macros/module.rs b/rust/macros/module.rs index a7e363c2b044..143336543866 100644 --- a/rust/macros/module.rs +++ b/rust/macros/module.rs @@ -258,7 +258,7 @@ pub(crate) fn module(ts: TokenStream) -> TokenStream { return 0; }} Err(e) => {{ - return e.to_kernel_errno(); + return e.to_errno(); }} }} }}