Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp411932ybz; Tue, 21 Apr 2020 11:25:48 -0700 (PDT) X-Google-Smtp-Source: APiQypJBgGJjWGxzn28i2xwJuucMNK5C00etwcmJudbBe6lNacWln5lUcW7nzfs1IGA4++masVc6 X-Received: by 2002:a17:907:2155:: with SMTP id rk21mr23364676ejb.163.1587493548229; Tue, 21 Apr 2020 11:25:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587493548; cv=none; d=google.com; s=arc-20160816; b=XHKuHwNxAubKLUOJ9VSWcf4F247OR1BGyYG/ioNWC8wxuHcvBC2649YXhzU3gpCfXz bkmkuTD0TzlqdbgQ0RGO2VOf23OyQ8AYtC6Kex9S7296sYFD72qJXIX7suVxzSh275wY QHL7bS3Hff2Fp6RPI9TYna/82bwgclgOUR84sfRalp/YwAe+H/IDii/RaUEeBozESpzq LA0rn1vdmRzqaln19LxoF0SPSwKbwkFocL4ljoWzfCH6+DzQ5m7BU7lA4kia+vlfryxC INC+dxq+44m8H1X9e2w1b82z39f299Hh2QuxhSZZfkbJp5d4kRQ206aV6GN2P/6ibzjL 09Ww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=1MpibdzZKUcWDPxbG1corhK5+ajDsK8Y+8yjQ5ScihQ=; b=vpMPNLIXA0R50MNT+GvXbbshn714af/mzXj0p3kY4TxV8se/m4J2zHzQFrl/8fUMBI K0oNh4dRCpFPNBkVhiMtnclHk9OvtnusMfFMb/ER1HIAKkz9qa9BZ+D1qNO9fZ13+hNQ Lfg3tWZw6vnAElcI0yG+V736epDeToX6lhYNKm9XssHoMj12Zks7sLv4+SXkzOtGGErf HYFkKgAK3olNm5LA6vci1y1sKmb7HIGt9wiYhYQvxFKiF+SRjcyXhnHUX1YpfsxA89SO a5wVN5UNC9Y0D65ZMgrcwvGhyGucT6fhjLY7uMaQWhKg81RALd7HvlhY7Ak0l75gZ4Qg +6DA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=B5ZLuleR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 3si2184420ejz.2.2020.04.21.11.25.24; Tue, 21 Apr 2020 11:25:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=B5ZLuleR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729310AbgDUSYN (ORCPT + 99 others); Tue, 21 Apr 2020 14:24:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56750 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725987AbgDUSYM (ORCPT ); Tue, 21 Apr 2020 14:24:12 -0400 Received: from mail-qv1-xf42.google.com (mail-qv1-xf42.google.com [IPv6:2607:f8b0:4864:20::f42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 37D4AC0610D5; Tue, 21 Apr 2020 11:24:12 -0700 (PDT) Received: by mail-qv1-xf42.google.com with SMTP id h6so3520340qvz.8; Tue, 21 Apr 2020 11:24:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=1MpibdzZKUcWDPxbG1corhK5+ajDsK8Y+8yjQ5ScihQ=; b=B5ZLuleRvVuEnP3GDHokJgx7lo+qLJYkVM0wzkxOrBWtY0WKsdpbmFVbxW819LaToB VRj00+31R6wouGqtzN3SnitnTZ1cEN6GlaVGdEo3+0u8rdwCv0U8HJeZJ6ZASV4roWpg ueA9YujFUn1j5pr/C+XW2RjJ5CTYf2J++wt4z3cQAC8WBRyyWDOv9QiX536GXeTxdOOj lANT7y6quUtL2IfixkMG3WbXMolwfa5LWu4Mcz/h59ptEU6NnnZ60E+sbk79JcUnlx38 LHiUnnuSWMsoJBCkfeTFGUrtHrJyfgS/KZ7VmSxdmhOLfJtmVjcVCWC0VYcKGPOhH0s/ BD4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=1MpibdzZKUcWDPxbG1corhK5+ajDsK8Y+8yjQ5ScihQ=; b=Qzfw7aCe6fpNYEB/5eirCY7k6Dv83VO5cpsEaKjNoTehg0JR3jaEDLine3sQypX3OZ DJ6ijREubJx+Udu3rKt2ARGvHso8IvXnGSbUxtVvAYWZ7MKj/DYePC/RsTlSfvxkxPsu 83WFgdxpIgMtLyl8Cqyl0k5aI2qYO6pyR2I2U//rc8PPm5yK4yi78SQXqXtud0TE6v5n q0Ui0KAzNYaO9Nxfv8OCV1+16rZMZPvUYfQpqCSsnaxgH0AcsY/ZAnwBEI1Aj7TH0NIz bxqqCR/Vegf5yPtFyNo5m6Iy3Id7gMKVrInEMs/PpWc8fXrXF71iDo50kPNgDWNRkqFv FP1A== X-Gm-Message-State: AGi0Pub6KZrCARDIYHhf3pXxHZSXMtBGIrUHI7ct1zYMfuHPUwq1RvJq HHRKLxtcVpjTsc8mxjnXpeI+N3x44I/2+gkQIfg= X-Received: by 2002:ad4:4c03:: with SMTP id bz3mr8359756qvb.224.1587493451343; Tue, 21 Apr 2020 11:24:11 -0700 (PDT) MIME-Version: 1.0 References: <20200420083046.GB28749@infradead.org> In-Reply-To: From: Andrii Nakryiko Date: Tue, 21 Apr 2020 11:24:00 -0700 Message-ID: Subject: Re: [RFC] uapi: Convert stat.h #define flags to enums To: Daniel Xu Cc: Christoph Hellwig , open list , bpf , Kernel Team , Jiri Olsa , Brendan Gregg , Alexei Starovoitov Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Apr 20, 2020 at 9:39 AM Daniel Xu 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