From patchwork Thu Nov 10 16:41:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miguel Ojeda X-Patchwork-Id: 18210 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp251670wru; Thu, 10 Nov 2022 08:44:25 -0800 (PST) X-Google-Smtp-Source: AMsMyM5It0VWJkZ70IIgKiwUGbigSJYTrTjwQnWZGj8Oj3UFIz9sb8vSDspYlkpLEwTF7snrY7si X-Received: by 2002:a17:907:c19:b0:7ad:e10b:c415 with SMTP id ga25-20020a1709070c1900b007ade10bc415mr46499663ejc.537.1668098665065; Thu, 10 Nov 2022 08:44:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668098665; cv=none; d=google.com; s=arc-20160816; b=toLvwHXhpKGGFDyeFhaG88DWcdk0F4WMQpSvgessQIzjkGwdsg/zwDRC97JS1Jk7+1 Jzq2KRnPSTMNLoRv7qkZslwREu4N9bLNi+GJCMfD2uTx9vDNh2EcbhGY8m1vhL0zI9Vh 8bd16ebZ1V4DmnNKpjXKBPCucNhrBDa63PWXFWNdD89SEf1EyiRZUdGSVPYs50MlGuT8 0F6q0Eh0WAENx+FkEBKOuoIYoiMMgOWFCz6ukZ+vlToCq7oOTIl1msC5s7jLv+M+7EyV mmgbL3O7yQdNsQTGX+J0sjAeMX7RH4VQHYcfG3kM3cPPK9S9+wHN4zJ9+Zay2YdzpuUu C8sQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=mgLnLC9ChpCvIxT4ohlVSrmKxcmu75XokevUDFzZeAw=; b=UlSMYGUYMtLDo/dFNrJIddxaLWEPGn/hvTBhyIAXBKTKXE28KEi3gGlDFWbomEFWhc YesI7rDYmNS5XAyWS7nci4Qckxf7Xg+SFRz/w6moFWOMagKs6O2JOyMazI7+JlpQuawd BxqXYZ7AmUaaBgbEdCu+jj64kwCX1lj87cpE4A1bwOJa3YpStEcLPkr/eUEBnMDS8Gch XVLjzQ03Lcy+VIaxWYaDnk1A9tNhzxQRi/0mRLIZevx0xUW92f26u4id7xyizcZEe5+x fHBuLEEuWwk91qjl8b0j/Ku1YN0o6/v+PuRmeTerFl7G78Huf9287bH6t/kWDwWKCtI9 AjVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=defv2G9C; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cf24-20020a170906b2d800b00781e17d3699si14168688ejb.203.2022.11.10.08.44.01; Thu, 10 Nov 2022 08:44:25 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b=defv2G9C; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232122AbiKJQn1 (ORCPT + 99 others); Thu, 10 Nov 2022 11:43:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39930 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232195AbiKJQnC (ORCPT ); Thu, 10 Nov 2022 11:43:02 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4DAB545A02; Thu, 10 Nov 2022 08:42:48 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id ECA7CB8225D; Thu, 10 Nov 2022 16:42:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6557BC433D6; Thu, 10 Nov 2022 16:42:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668098565; bh=zrkavDKsBthT94ju0QKne8tZOVOAyQVpPnOep6nNbD4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=defv2G9CQv4RktVFNQNYIolUchVkLP9Wq9ByfDiqNu63DeSvdvWA0Ax4wY/j5/Sd1 tRNOsoPy3x6hDXT9L2L30RD+6Cgv27U2nN1UaLW2p2TO+f8Bx1FerAC5tJM8Q5luE7 5KGB+tgEub5+QyLrVQAhnAr/adNRgT7mi9c0U880z1OslWQY9D8+jCSGjYprxnCpPG 4NgMnIkawCVT2rS9XKBnQwo6+VNsLqaiGNTSzs1+OjXhtZwRSKsS8rnWmL4Lw1//7P JF680DAc4dhz7Ozt17PuKli23dQr/kaHvXY5dvv4rGBlm6nnKrdyLamMhtImSZ5/wF kQ+e8ErUC2YSQ== From: Miguel Ojeda To: Miguel Ojeda , Wedson Almeida Filho , Alex Gaynor , Boqun Feng , Gary Guo , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= Cc: rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, patches@lists.linux.dev, Viktor Garske Subject: [PATCH v1 09/28] rust: error: add codes from `errno-base.h` Date: Thu, 10 Nov 2022 17:41:21 +0100 Message-Id: <20221110164152.26136-10-ojeda@kernel.org> In-Reply-To: <20221110164152.26136-1-ojeda@kernel.org> References: <20221110164152.26136-1-ojeda@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749128225759217626?= X-GMAIL-MSGID: =?utf-8?q?1749128225759217626?= From: Viktor Garske Only a few codes were added so far. With the `declare_err!` macro in place, add the remaining ones (which is most of them) from `include/uapi/asm-generic/errno-base.h`. Co-developed-by: Wedson Almeida Filho Signed-off-by: Wedson Almeida Filho Signed-off-by: Viktor Garske [Reworded, adapted for upstream and applied latest changes] Signed-off-by: Miguel Ojeda Reviewed-by: Gary Guo --- rust/kernel/error.rs | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/rust/kernel/error.rs b/rust/kernel/error.rs index b843f3445483..861746f2422d 100644 --- a/rust/kernel/error.rs +++ b/rust/kernel/error.rs @@ -17,7 +17,40 @@ pub mod code { }; } + declare_err!(EPERM, "Operation not permitted."); + declare_err!(ENOENT, "No such file or directory."); + declare_err!(ESRCH, "No such process."); + declare_err!(EINTR, "Interrupted system call."); + declare_err!(EIO, "I/O error."); + declare_err!(ENXIO, "No such device or address."); + declare_err!(E2BIG, "Argument list too long."); + declare_err!(ENOEXEC, "Exec format error."); + declare_err!(EBADF, "Bad file number."); + declare_err!(ECHILD, "Exec format error."); + declare_err!(EAGAIN, "Try again."); declare_err!(ENOMEM, "Out of memory."); + declare_err!(EACCES, "Permission denied."); + declare_err!(EFAULT, "Bad address."); + declare_err!(ENOTBLK, "Block device required."); + declare_err!(EBUSY, "Device or resource busy."); + declare_err!(EEXIST, "File exists."); + declare_err!(EXDEV, "Cross-device link."); + declare_err!(ENODEV, "No such device."); + declare_err!(ENOTDIR, "Not a directory."); + declare_err!(EISDIR, "Is a directory."); + declare_err!(EINVAL, "Invalid argument."); + declare_err!(ENFILE, "File table overflow."); + declare_err!(EMFILE, "Too many open files."); + declare_err!(ENOTTY, "Not a typewriter."); + declare_err!(ETXTBSY, "Text file busy."); + declare_err!(EFBIG, "File too large."); + declare_err!(ENOSPC, "No space left on device."); + declare_err!(ESPIPE, "Illegal seek."); + declare_err!(EROFS, "Read-only file system."); + declare_err!(EMLINK, "Too many links."); + declare_err!(EPIPE, "Broken pipe."); + declare_err!(EDOM, "Math argument out of domain of func."); + declare_err!(ERANGE, "Math result not representable."); } /// Generic integer kernel error.