Messages in this thread | | | From | Andrii Nakryiko <> | Date | Tue, 21 Apr 2020 11:24:00 -0700 | Subject | Re: [RFC] uapi: Convert stat.h #define flags to enums |
| |
On Mon, Apr 20, 2020 at 9:39 AM Daniel Xu <dxu@dxuuu.xyz> wrote: > > Hi Christoph, > > On Sun Apr 19, 2020 at 6:30 PM PST, Christoph Hellwig wrote: > > And that breaks every userspace program using ifdef to check if a > > symbolic name has been defined. > > How about shadowing #define's? Like for `enum nfnetlink_groups` in > include/uapi/linux/netfilter/nfnetlink.h . >
FWIW, we did #define to enum conversion for big chunks of BPF UAPI headers ([0]) and that greatly improved BPF user experience. A bunch of other kernel headers are already using enums for constants. I think converting more Linux headers to use enums for constants and capture them as part of type information is a good step forward that should further simplify writing all kinds of introspection and monitoring tools.
[0] https://patchwork.ozlabs.org/project/netdev/patch/20200303003233.3496043-2-andriin@fb.com/
> Thanks, > Daniel
| |