Messages in this thread | | | From | Miguel Ojeda <> | Date | Tue, 9 May 2023 13:10:54 +0200 | Subject | Re: [PATCH v2] rust: error: add missing error codes |
| |
On Tue, May 9, 2023 at 10:46 AM Greg KH <gregkh@linuxfoundation.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.
Cheers, Miguel
| |