Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp1745052pxy; Fri, 23 Apr 2021 16:15:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwKqRx7zqeaTnN5xdF/Mht6Z7PQZNYgbiq9BG+2dEJ7UnI9KVlwYYxaJFMNBjaN/Y7+cRJ+ X-Received: by 2002:a05:6402:35cd:: with SMTP id z13mr7273440edc.21.1619219742833; Fri, 23 Apr 2021 16:15:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619219742; cv=none; d=google.com; s=arc-20160816; b=Z/jYmAXsk/TDFS12r01KAYfAytXhjxqaNozMZNEgg01zjieGc3K7w/3BlHClCzNFcG AQpB1xVBrqGpwL2uvH3/JYJsthbuyCqyjowb/jLdRDcwV+NjlmAwS4tF7hfUilrfhT+J CSeEf5fm7FfLVHjfs3JqXyUaDsz9qig8dSGYA2SopmVxbbdL2aDyQtPEH370QKcsRddF tdPGzUWLFUwM64IKdlc5ct91eNNfGkcGPDIhA6QZpV6oHDVStJmWKlKIosWw5/K7wUV2 1fF2Ot8sXN3Uosc/9b/SPADg7msock7Hlzh9S81FwmhMhc0ogeH+zlVUFjz6wxT18F8o Qnkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=C4ZPzplc9OAmt+zuL1FDfQQzTkLLffr304oYuA/Q1dQ=; b=kMt0m/OOos3c6ZbfoFEDqAtxjFJKCQYHuWcV26/23mOiuNuaab3d5W9P6UTHZBNxed Lw1dhfIQsFhvjrJHotdra9kga4QJ9XZYdJf4vKBXEcOh227rZ+ak6AQ/891eyuRd+dxi OOLEi11ABo1387xzJUdRMIcXeUccKNKYOnZuKoHmlzYYXblSTI3FjgVp0NPoSrimud+Q Y6BOTnRmTUiorz1Mw+zoT4trdd+eVg22wun9/Pb9Y2LoEdg1Lkn2RajxW2vpg7xJRu9R 4hmPVrKZFDiSDauCD01XlgvRmYvNQGNBKeztjCL125tEa518b7b94BbgXzrjyHNaCXJj LXxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="ckH/C22d"; 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 zm11si6296958ejb.410.2021.04.23.16.15.12; Fri, 23 Apr 2021 16:15:42 -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="ckH/C22d"; 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 S232508AbhDWXOr (ORCPT + 99 others); Fri, 23 Apr 2021 19:14:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44854 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229520AbhDWXOp (ORCPT ); Fri, 23 Apr 2021 19:14:45 -0400 Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4BF19C061574; Fri, 23 Apr 2021 16:14:08 -0700 (PDT) Received: by mail-wm1-x332.google.com with SMTP id d200-20020a1c1dd10000b02901384767d4a5so1991293wmd.3; Fri, 23 Apr 2021 16:14:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=C4ZPzplc9OAmt+zuL1FDfQQzTkLLffr304oYuA/Q1dQ=; b=ckH/C22dufqESO7HjVddJUfyAZ33VYqHuQNSMQ3+1+qtoHtcbJ/ldBtIHL6lOWgV3u euXTvlmDYp13cPXFfy91TfLiEvKeiWy9TyLJxKMjxmRCgnqa/GmyIBe+1aag4gpbpVvc jzSnWkmcb+arhjnDJmXLtreG4TWkZAfkHzcZNnpSoC3hvWZjDu5iAScruFEhY5xvU0n4 I41ao/OW69i9o49aCQ8CKytvCgLpI9j9Sgl8sNjP2ustavT8wBhjO/QoBTZ+Uf2py0gP UgK6gWrVCCHqPEmfxOZSjZhPaLou2eXqaY6xsEocWmN4ZioNpGaUJ+FnLk/7LLAunlR1 iV0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=C4ZPzplc9OAmt+zuL1FDfQQzTkLLffr304oYuA/Q1dQ=; b=teFJ8N79NF17MUg8IHoa95P+gB0I9EVecmZ9CeBloUKqK3xTC455Kk0nAfgQhXlVbf 69jFRcIo5iKpfeB7te7IOT5j99VfoOqGwL6sXhNtDAsfqM/msq939xxDw+d9TfdOmnLr 6O8jPZ/DCvYtlVFEKHmrVoHJwxBdARPTt4cUAZpxxYbVC6QfXCguF5CU5ZglukqiTfIG 1sYH7MRxpdK8310AQWPLmKbfsIbLD71gOc78/gHP4mZ/SamQXanC6/gB75AbejGq6lYk Afuj7mCiYWQKaOJkMo+VUtHX2rj/BSr6n3ItMPZB47+rInZzdluFQdGObI5LIv2sEu/o oiBQ== X-Gm-Message-State: AOAM53117x7MSh+eY9mv4V9q/kbvLzyowvWW+uErNQEU2lQ4uNDU5Rzp PSpvFTyK2n8AO9MX/hTuI9nokWHb9pc= X-Received: by 2002:a1c:6646:: with SMTP id a67mr7982825wmc.86.1619219647099; Fri, 23 Apr 2021 16:14:07 -0700 (PDT) Received: from sqli.sqli.com ([195.53.121.100]) by smtp.googlemail.com with ESMTPSA id w4sm10883653wrp.58.2021.04.23.16.14.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Apr 2021 16:14:06 -0700 (PDT) From: Alejandro Colomar To: mtk.manpages@gmail.com, linux-man@vger.kernel.org Cc: Alejandro Colomar , linux-kernel@vger.kernel.org, libc-alpha@sourceware.org, gcc-patches@gcc.gnu.org Subject: [RFC] bpf.2: Use standard types and attributes Date: Sat, 24 Apr 2021 01:06:10 +0200 Message-Id: <20210423230609.13519-1-alx.manpages@gmail.com> X-Mailer: git-send-email 2.31.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Some manual pages are already using C99 syntax for integral types 'uint32_t', but some aren't. There are some using kernel syntax '__u32'. Fix those. Some pages also document attributes, using GNU syntax '__attribute__((xxx))'. Update those to use the shorter and more portable C2x syntax, which hasn't been standardized yet, but is already implemented in GCC, and available through either --std=c2x or any of the --std=gnu... options. Signed-off-by: Alejandro Colomar --- man2/bpf.2 | 47 +++++++++++++++++++++++------------------------ 1 file changed, 23 insertions(+), 24 deletions(-) diff --git a/man2/bpf.2 b/man2/bpf.2 index 6e1ffa198..204f01bfc 100644 --- a/man2/bpf.2 +++ b/man2/bpf.2 @@ -188,39 +188,38 @@ commands: .EX union bpf_attr { struct { /* Used by BPF_MAP_CREATE */ - __u32 map_type; - __u32 key_size; /* size of key in bytes */ - __u32 value_size; /* size of value in bytes */ - __u32 max_entries; /* maximum number of entries - in a map */ + uint32_t map_type; + uint32_t key_size; /* size of key in bytes */ + uint32_t value_size; /* size of value in bytes */ + uint32_t max_entries; /* maximum number of entries + in a map */ }; - struct { /* Used by BPF_MAP_*_ELEM and BPF_MAP_GET_NEXT_KEY - commands */ - __u32 map_fd; - __aligned_u64 key; + struct { /* Used by BPF_MAP_*_ELEM and BPF_MAP_GET_NEXT_KEY commands */ + uint32_t map_fd; + uint64_t [[gnu::aligned(8)]] key; union { - __aligned_u64 value; - __aligned_u64 next_key; + uint64_t [[gnu::aligned(8)]] value; + uint64_t [[gnu::aligned(8)]] next_key; }; - __u64 flags; + uint64_t flags; }; struct { /* Used by BPF_PROG_LOAD */ - __u32 prog_type; - __u32 insn_cnt; - __aligned_u64 insns; /* \(aqconst struct bpf_insn *\(aq */ - __aligned_u64 license; /* \(aqconst char *\(aq */ - __u32 log_level; /* verbosity level of verifier */ - __u32 log_size; /* size of user buffer */ - __aligned_u64 log_buf; /* user supplied \(aqchar *\(aq - buffer */ - __u32 kern_version; - /* checked when prog_type=kprobe - (since Linux 4.1) */ + uint32_t prog_type; + uint32_t insn_cnt; + uint64_t [[gnu::aligned(8)]] insns; /* \(aqconst struct bpf_insn *\(aq */ + uint64_t [[gnu::aligned(8)]] license; /* \(aqconst char *\(aq */ + uint32_t log_level; /* verbosity level of verifier */ + uint32_t log_size; /* size of user buffer */ + uint64_t [[gnu::aligned(8)]] log_buf; /* user supplied \(aqchar *\(aq + buffer */ + uint32_t kern_version; + /* checked when prog_type=kprobe + (since Linux 4.1) */ .\" commit 2541517c32be2531e0da59dfd7efc1ce844644f5 }; -} __attribute__((aligned(8))); +} [[gnu::aligned(8)]]; .EE .in .\" -- 2.31.0