mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Alice Ryhl <aliceryhl@google.com>
Cc: gary@garyguo.net, alex.gaynor@gmail.com, benno.lossin@proton.me,
	bjorn3_gh@protonmail.com, boqun.feng@gmail.com,
	linux-kernel@vger.kernel.org, ojeda@kernel.org,
	patches@lists.linux.dev, rust-for-linux@vger.kernel.org,
	wedsonaf@gmail.com
Subject: Re: [PATCH v2] rust: error: add missing error codes
Date: Tue, 9 May 2023 10:46:37 +0200	[thread overview]
Message-ID: <2023050937-scouring-truck-d7c0@gregkh> (raw)
In-Reply-To: <20230509080700.1608146-1-aliceryhl@google.com>

On Tue, May 09, 2023 at 08:07:00AM +0000, Alice Ryhl wrote:
> On Mon, 8 May 2023 12:47:01 +0100
> Gary Guo <gary@garyguo.net> wrote:
> > On Thu,  4 May 2023 06:48:54 +0000
> > Alice Ryhl <aliceryhl@google.com> wrote:
> > > This adds the error codes from `include/linux/errno.h` to the list of
> > > Rust error constants. These errors were not included originally, because
> > > they are not supposed to be visible from userspace. However, they are
> > > still a perfectly valid error to use when writing a kernel driver. For
> > > example, you might want to return ERESTARTSYS if you receive a signal
> > > during a call to `schedule`.
> > 
> > `include/linux/errno.h` also includes all of `asm/errno.h`,
> > which defines EDEADLK - EHWPOISON, which is not included in this patch.
> > I feel like these error codes should be added first?
> 
> It seems like there are a lot of asm/errno.h files:
> 
> $ find . -name errno.h
> ./arch/powerpc/include/uapi/asm/errno.h
> ./arch/mips/include/asm/errno.h
> ./arch/mips/include/uapi/asm/errno.h
> ./arch/alpha/include/uapi/asm/errno.h
> ./arch/parisc/include/uapi/asm/errno.h
> ./arch/sparc/include/uapi/asm/errno.h
> ./arch/x86/include/generated/uapi/asm/errno.h
> ./tools/arch/powerpc/include/uapi/asm/errno.h
> ./tools/arch/mips/include/asm/errno.h
> ./tools/arch/mips/include/uapi/asm/errno.h
> ./tools/arch/alpha/include/uapi/asm/errno.h
> ./tools/arch/parisc/include/uapi/asm/errno.h
> ./tools/arch/sparc/include/uapi/asm/errno.h
> ./tools/arch/x86/include/uapi/asm/errno.h
> ./tools/include/nolibc/errno.h
> ./tools/include/uapi/asm/errno.h
> ./tools/include/uapi/asm-generic/errno.h

You can ignore the tool ones.

> ./include/uapi/asm-generic/errno.h
> ./include/uapi/linux/errno.h
> ./include/linux/errno.h
> 
> How should I proceed with this? You mention EDEADLK - EHWPOISON, but its
> not clear to me which asm/errno.h file I should base this on.

It depends on which arch you are building for.  That's why we have
per-platform errno.h files, the values are different for different ones.
So you need to handle them all properly somehow.  How is rust going to
handle per-arch stuff like this?

thanks,

greg k-h

  reply	other threads:[~2023-05-09  8:46 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-04  6:48 Alice Ryhl
2023-05-04 12:40 ` Martin Rodriguez Reboredo
2023-05-08 11:47 ` Gary Guo
2023-05-09  8:07   ` Alice Ryhl
2023-05-09  8:46     ` Greg KH [this message]
2023-05-09 11:10       ` Miguel Ojeda
2023-05-15 18:07         ` Andreas Hindborg
2023-05-31 17:11 ` Miguel Ojeda

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2023050937-scouring-truck-d7c0@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=alex.gaynor@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=benno.lossin@proton.me \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=gary@garyguo.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ojeda@kernel.org \
    --cc=patches@lists.linux.dev \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=wedsonaf@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®