Re: [PATCH v3] bpf.2: Use standard types and attributes
From: Daniel Borkmann <daniel@iogearbox.net>
Date: 2021-05-17 18:56:38
Also in:
bpf, lkml
On 5/16/21 11:16 AM, Alejandro Colomar (man-pages) wrote:
On 5/15/21 9:01 PM, Alejandro Colomar wrote:quoted
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. Both the kernel and the standard types are 100% binary compatible, and the source code differences between them are very small, and not important in a manual page: - Some of them are implemented with different underlying types (e.g., s64 is always long long, while int64_t may be long long or long, depending on the arch). This causes the following differences. - length modifiers required by printf are different, resulting in a warning ('-Wformat='). - pointer assignment causes a warning: ('-Wincompatible-pointer-types'), but there aren't any pointers in this page. But, AFAIK, all of those warnings can be safely ignored, due to the binary compatibility between the types. ... Some pages also document attributes, using GNU syntax '__attribute__((xxx))'. Update those to use the shorter and more portable C11 keywords such as 'alignas()' when possible, and C2x syntax '[[gnu::xxx]]' elsewhere, 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. The standard isn't very clear on how to use alignas() or [[]]-style attributes, and the GNU documentation isn't better, so the following link is a useful experiment about the different alignment syntaxes: __attribute__((aligned())), alignas(), and [[gnu::aligned()]]: <https://stackoverflow.com/q/67271825/6872717> Signed-off-by: Alejandro Colomar <redacted>Discussion: <https://lore.kernel.org/linux-man/6740a229-842e-b368-86eb-defc786b3658@gmail.com/T/ (local)>quoted
Nacked-by: Alexei Starovoitov [off-list ref] Nacked-by: Greg Kroah-Hartman [off-list ref]
You forgot to retain my ... Nacked-by: Daniel Borkmann [off-list ref]
quoted
Acked-by: Zack Weinberg <redacted> Cc: LKML <redacted> Cc: glibc <redacted> Cc: GCC <redacted> Cc: bpf <redacted> Cc: David Laight <redacted> Cc: Joseph Myers <redacted> Cc: Florian Weimer <redacted> Cc: Daniel Borkmann <daniel@iogearbox.net> --- man2/bpf.2 | 49 ++++++++++++++++++++++++------------------------- 1 file changed, 24 insertions(+), 25 deletions(-)