[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAEf4BzYfEuiMsn_MWAFHRHYSMB0dFP10dgdKixXATD=65F6SqA@mail.gmail.com>
Date: Tue, 21 Apr 2020 11:24:00 -0700
From: Andrii Nakryiko <andrii.nakryiko@...il.com>
To: Daniel Xu <dxu@...uu.xyz>
Cc: Christoph Hellwig <hch@...radead.org>,
open list <linux-kernel@...r.kernel.org>,
bpf <bpf@...r.kernel.org>, Kernel Team <kernel-team@...com>,
Jiri Olsa <jolsa@...nel.org>,
Brendan Gregg <brendan.d.gregg@...il.com>,
Alexei Starovoitov <ast@...nel.org>
Subject: Re: [RFC] uapi: Convert stat.h #define flags to enums
On Mon, Apr 20, 2020 at 9:39 AM Daniel Xu <dxu@...uu.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
Powered by blists - more mailing lists