[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <875y8teab3.fsf@metaspace.dk>
Date: Mon, 15 May 2023 20:07:12 +0200
From: Andreas Hindborg <nmi@...aspace.dk>
To: Miguel Ojeda <miguel.ojeda.sandonis@...il.com>
Cc: Greg KH <gregkh@...uxfoundation.org>,
Alice Ryhl <aliceryhl@...gle.com>, gary@...yguo.net,
alex.gaynor@...il.com, benno.lossin@...ton.me,
bjorn3_gh@...tonmail.com, boqun.feng@...il.com,
linux-kernel@...r.kernel.org, ojeda@...nel.org,
patches@...ts.linux.dev, rust-for-linux@...r.kernel.org,
wedsonaf@...il.com
Subject: Re: [PATCH v2] rust: error: add missing error codes
Miguel Ojeda <miguel.ojeda.sandonis@...il.com> writes:
> On Tue, May 9, 2023 at 10:46 AM Greg KH <gregkh@...uxfoundation.org> wrote:
>>
>> 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?
>
> We can do conditional compilation in the same file, possibly with a
> Rust macro which takes a nice table that shows all arches at once.
>
> We can also split into files like C and move it to each `arch/`, there
> are a couple of approaches for this. This is best for `MAINTAINERS`,
> although these headers almost never change, so it is not a big
> advantage.
>
> We could also automatically do everything based on the C headers, too.
> Back then it felt to me like too much complexity for little gain,
> given those C headers almost never change, but now it may be worth it.
> Or, instead, having a test that verifies they are the same instead,
> and that way we don't introduce complexity for the build itself.
>
> Alice only needs `ERESTARTSYS` so far, as far as I understand, so
> perhaps it is simplest to only add the rest of the non-generic ones
> for the moment; and gather opinions on the approaches above meanwhile.
Let's add the ones we need for now. When we need target specific error
codes we can have a `mod` for each arch, gate behind the target
feature and conditionally reexport them.
BR Andreas
Powered by blists - more mailing lists