From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ej1-x632.google.com (mail-ej1-x632.google.com [IPv6:2a00:1450:4864:20::632]) by sourceware.org (Postfix) with ESMTPS id 4A848385DC31 for ; Thu, 25 Aug 2022 07:48:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 4A848385DC31 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linuxfoundation.org Received: by mail-ej1-x632.google.com with SMTP id u15so29230190ejt.6 for ; Thu, 25 Aug 2022 00:48:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc; bh=pTSOf4yZBT6vxC8cWVxq54me3auAZtvDfhz2BczVtgE=; b=Ig6BLIDsaP7fwO4f2tblxSV8D0IEZ23t5746evH4pnH6oehSyZT/w7P79opUL+FnmK po3y3tMhPtweDHchzB18ityI3jwyATZyGSAP0WrqhvTn5ohd5US0JPEFOAGmxSk5vacw sKRqdCKWOUSMVwQEX9dCud+27HCTh3lUtbqk4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc; bh=pTSOf4yZBT6vxC8cWVxq54me3auAZtvDfhz2BczVtgE=; b=ijR/CNpRG5fOAxfhwoVe8ruNPW+46WCn4yGPUJrrN0QwSEHeuWiYNVDYUcZB4XEh2B 3scP1lcFbWk2fivnEKWqfM2Aa1DfN/62cQkTyxmy3TRnLPtqaJwaNGemnzRbLzbEHFPO tKPCCF9BzWSGdHY68kGq6WzvgzdaD62eMGPEnuyQToUFcblPMB/IvZl89nuU20LWvL5h c1A/OABhslZ5vG3opl+CfUePiRt/SBb9z8Nms/dNIUqA6IPM/EEkAK0+TGIsXGz8Dpcb UtxcfxxygFXLeEtti259sXy484OxlRsN7ijTr8kHWIN6P4NwO6yIigrebhzMa4xhKad4 4GXw== X-Gm-Message-State: ACgBeo1hsoq7uh2b34OVuddEHQQ0Z/qTCnV/XXP9gAqSxkCIp8m9rjMa f+I19Dc387UGGtHmE3cawD1cUcWJJrmFBht8Mfw= X-Google-Smtp-Source: AA6agR5Rhc15+Vu5GsvtMOF8GE7JV1TwJNw/NqHTOb5NmPuEoVN4HiSNqJD+bzoJaedwYtrwXMnOFw== X-Received: by 2002:a17:907:728d:b0:731:8396:ea86 with SMTP id dt13-20020a170907728d00b007318396ea86mr1598603ejc.361.1661413695689; Thu, 25 Aug 2022 00:48:15 -0700 (PDT) Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com. [209.85.128.48]) by smtp.gmail.com with ESMTPSA id c6-20020aa7d606000000b004478be33bddsm1935639edr.15.2022.08.25.00.48.15 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 25 Aug 2022 00:48:15 -0700 (PDT) Received: by mail-wm1-f48.google.com with SMTP id d5so9846870wms.5 for ; Thu, 25 Aug 2022 00:48:15 -0700 (PDT) X-Received: by 2002:a7b:c399:0:b0:3a5:f3fb:85e0 with SMTP id s25-20020a7bc399000000b003a5f3fb85e0mr1402129wmj.38.1661413369950; Thu, 25 Aug 2022 00:42:49 -0700 (PDT) MIME-Version: 1.0 References: <20210423230609.13519-1-alx.manpages@gmail.com> <20220824185505.56382-1-alx.manpages@gmail.com> <20d93962-538c-d2c9-1696-a1bdbffa87f8@gmail.com> In-Reply-To: <20d93962-538c-d2c9-1696-a1bdbffa87f8@gmail.com> From: Linus Torvalds Date: Thu, 25 Aug 2022 00:42:32 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v3] Many pages: Document fixed-width types with ISO C naming To: Alejandro Colomar Cc: Alexei Starovoitov , Alex Colomar , Alexei Starovoitov , linux-man , Greg Kroah-Hartman , Daniel Borkmann , Zack Weinberg , LKML , glibc , GCC , bpf , LTP List , Linux API , linux-arch , David Laight , Joseph Myers , Florian Weimer , Cyril Hrubis , David Howells , Arnd Bergmann , Rich Felker , Adhemerval Zanella , Michael Kerrisk Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Thu, Aug 25, 2022 at 12:20 AM Alejandro Colomar wrote: > > This patch is not about kernel, but about the section 2 and 3 manual > pages, which are directed towards user-space readers most of the time. They are about the types to the kernel interfaces. Those types that the kernel defines and exposes. And the kernel type in question looks like this: struct { /* anonymous struct used by BPF_PROG_LOAD command */ __u32 prog_type; /* one of enum bpf_prog_type */ __u32 insn_cnt; __aligned_u64 insns; __aligned_u64 license; because the kernel UAPI header wants to (a) work whether or not was included (b) doesn't want to include so as to not pollute the namespace (c) actually wants to use our special types I quoted a few more fields for that (c) reason: we've had a long history of getting the user space API wrong due to strange alignment issues, where 32-bit and 64-bit targets had different alignment for types. So then we ended up with various compat structures to translate from one to the other because they had all the same fields, but different padding. This happened a few times with the DRM people, and they finally got tired of it, and started using that "__aligned_u64" type, which is just the same old __u64, but explicitly aligned to its natural alignment. So these are the members that the interface actually uses. If you document those members, wouldn't it be good to have that documentation be actually accurate? Honestly, I don't think it makes a *huge* amount of difference, but documentation that doesn't actually match the source of the documentation will just confuse somebody in the end. Somebody will go "that's not right", and maybe even change the structure definitions to match the documentation. Which would be wrong. Now, you don't have to take the kernel uapi headers. We *try* to make those usable as-is, but hey, there has been problems in the past, and it's not necessarily wrong to take the kernel header and then munge it to be "appropriate" for user space. So I guess you can just make your own structures with the names and syntax you want, and say "these are *my* header files, and *my* documentation for them". That's fine. But I'm not surprised if the kernel maintainer then goes "no, that's not the interface I agreed to" if only because it's a pain to verify that you got it all right. Maybe it was all trivial and automated and there can be no errors, but it's still a "why is there a different copy of this complicated interface". If you really want to describe things to people, wouldn't it be nicer to just say "there's a 32-bit unsigned 'prog_type' member" and leave it at that? Do you really want to enforce your opinion of what is prettier on the maintainer that wrote that thing, and then argue with him when he doesn't agree? Linus