diff mbox series

[v2] Fit lines in 80 columns

Message ID 20220829195842.85290-1-alx.manpages@gmail.com (mailing list archive)
State Rejected
Delegated to: BPF
Headers show
Series [v2] Fit lines in 80 columns | expand

Checks

Context Check Description
bpf/vmtest-bpf-next-PR pending PR summary
netdev/tree_selection success Not a local patch, async
bpf/vmtest-bpf-next-VM_Test-4 success Logs for llvm-toolchain
bpf/vmtest-bpf-next-VM_Test-5 success Logs for set-matrix
bpf/vmtest-bpf-next-VM_Test-1 success Logs for build for s390x with gcc
bpf/vmtest-bpf-next-VM_Test-2 success Logs for build for x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-3 success Logs for build for x86_64 with llvm-16
bpf/vmtest-bpf-next-VM_Test-6 pending Logs for test_maps on s390x with gcc
bpf/vmtest-bpf-next-VM_Test-7 pending Logs for test_maps on x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-8 pending Logs for test_maps on x86_64 with llvm-16
bpf/vmtest-bpf-next-VM_Test-9 pending Logs for test_progs on s390x with gcc
bpf/vmtest-bpf-next-VM_Test-10 pending Logs for test_progs on x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-11 pending Logs for test_progs on x86_64 with llvm-16
bpf/vmtest-bpf-next-VM_Test-12 pending Logs for test_progs_no_alu32 on s390x with gcc
bpf/vmtest-bpf-next-VM_Test-13 pending Logs for test_progs_no_alu32 on x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-14 pending Logs for test_progs_no_alu32 on x86_64 with llvm-16
bpf/vmtest-bpf-next-VM_Test-15 pending Logs for test_verifier on s390x with gcc
bpf/vmtest-bpf-next-VM_Test-16 pending Logs for test_verifier on x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-17 pending Logs for test_verifier on x86_64 with llvm-16

Commit Message

Alejandro Colomar Aug. 29, 2022, 7:58 p.m. UTC
Those lines is used to generate the bpf-helpers(7) manual page.
They are no-fill lines, since they represent code, which means
that the formatter can't break the line, and instead just runs
across the right margin (in most set-ups this means that the pager
will break the line).

Using <fmt> makes it end exactly at the 80-col right margin, both
in the header file, and also in the manual page, and also seems to
be a sensible name to me.

In the other case, the fix has been to separate the variable
definition and its use, as the kernel coding style recommends.

Nacked-by: Alexei Starovoitov <ast@kernel.org>
Cc: bpf <bpf@vger.kernel.org>
Cc: linux-man <linux-man@vger.kernel.org>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: Andrii Nakryiko <andrii@kernel.org>
Cc: Martin KaFai Lau <kafai@fb.com>
Cc: Song Liu <songliubraving@fb.com>
Cc: Yonghong Song <yhs@fb.com>
Cc: John Fastabend <john.fastabend@gmail.com>
Cc: KP Singh <kpsingh@kernel.org>
Cc: Stanislav Fomichev <sdf@google.com>
Cc: Hao Luo <haoluo@google.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Jesper Dangaard Brouer <brouer@redhat.com>
Cc: Quentin Monnet <quentin@isovalent.com>
Cc: Greg KH <gregkh@linuxfoundation.org>
Cc: "G. Branden Robinson" <g.branden.robinson@gmail.com>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
---
 include/uapi/linux/bpf.h       | 11 ++++++-----
 tools/include/uapi/linux/bpf.h | 11 ++++++-----
 2 files changed, 12 insertions(+), 10 deletions(-)

Comments

Daniel Borkmann Aug. 29, 2022, 8:29 p.m. UTC | #1
On 8/29/22 9:58 PM, Alejandro Colomar wrote:
> Those lines is used to generate the bpf-helpers(7) manual page.
> They are no-fill lines, since they represent code, which means
> that the formatter can't break the line, and instead just runs
> across the right margin (in most set-ups this means that the pager
> will break the line).
> 
> Using <fmt> makes it end exactly at the 80-col right margin, both
> in the header file, and also in the manual page, and also seems to
> be a sensible name to me.
> 
> In the other case, the fix has been to separate the variable
> definition and its use, as the kernel coding style recommends.
> 
> Nacked-by: Alexei Starovoitov <ast@kernel.org>
> Cc: bpf <bpf@vger.kernel.org>
> Cc: linux-man <linux-man@vger.kernel.org>
> Cc: Daniel Borkmann <daniel@iogearbox.net>
> Cc: Andrii Nakryiko <andrii@kernel.org>
> Cc: Martin KaFai Lau <kafai@fb.com>
> Cc: Song Liu <songliubraving@fb.com>
> Cc: Yonghong Song <yhs@fb.com>
> Cc: John Fastabend <john.fastabend@gmail.com>
> Cc: KP Singh <kpsingh@kernel.org>
> Cc: Stanislav Fomichev <sdf@google.com>
> Cc: Hao Luo <haoluo@google.com>
> Cc: Jiri Olsa <jolsa@kernel.org>
> Cc: Jesper Dangaard Brouer <brouer@redhat.com>
> Cc: Quentin Monnet <quentin@isovalent.com>
> Cc: Greg KH <gregkh@linuxfoundation.org>
> Cc: "G. Branden Robinson" <g.branden.robinson@gmail.com>
> Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
> ---
>   include/uapi/linux/bpf.h       | 11 ++++++-----
>   tools/include/uapi/linux/bpf.h | 11 ++++++-----
>   2 files changed, 12 insertions(+), 10 deletions(-)
> 
> diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
> index ef78e0e1a754..1443fa2a1915 100644
> --- a/include/uapi/linux/bpf.h
> +++ b/include/uapi/linux/bpf.h
> @@ -1619,7 +1619,7 @@ union bpf_attr {
>    *
>    * 		::
>    *
> - * 			telnet-470   [001] .N.. 419421.045894: 0x00000001: <formatted msg>
> + * 			telnet-470   [001] .N.. 419421.045894: 0x00000001: <fmt>
>    *
>    * 		In the above:
>    *
> @@ -1636,8 +1636,7 @@ union bpf_attr {
>    * 			* ``419421.045894`` is a timestamp.
>    * 			* ``0x00000001`` is a fake value used by BPF for the
>    * 			  instruction pointer register.
> - * 			* ``<formatted msg>`` is the message formatted with
> - * 			  *fmt*.
> + * 			* ``<fmt>`` is the message formatted with *fmt*.
>    *
>    * 		The conversion specifiers supported by *fmt* are similar, but
>    * 		more limited than for printk(). They are **%d**, **%i**,
> @@ -3860,8 +3859,10 @@ union bpf_attr {
>    * 			void bpf_sys_open(struct pt_regs *ctx)
>    * 			{
>    * 			        char buf[PATHLEN]; // PATHLEN is defined to 256
> - * 			        int res = bpf_probe_read_user_str(buf, sizeof(buf),
> - * 				                                  ctx->di);
> + * 			        int res;
> + *
> + * 			        res = bpf_probe_read_user_str(buf, sizeof(buf),
> + * 				                              ctx->di);
>    *

Aside that this has been Nacked before, this looks really ugly. I'm not applying
this, sorry.

Thanks,
Daniel
diff mbox series

Patch

diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
index ef78e0e1a754..1443fa2a1915 100644
--- a/include/uapi/linux/bpf.h
+++ b/include/uapi/linux/bpf.h
@@ -1619,7 +1619,7 @@  union bpf_attr {
  *
  * 		::
  *
- * 			telnet-470   [001] .N.. 419421.045894: 0x00000001: <formatted msg>
+ * 			telnet-470   [001] .N.. 419421.045894: 0x00000001: <fmt>
  *
  * 		In the above:
  *
@@ -1636,8 +1636,7 @@  union bpf_attr {
  * 			* ``419421.045894`` is a timestamp.
  * 			* ``0x00000001`` is a fake value used by BPF for the
  * 			  instruction pointer register.
- * 			* ``<formatted msg>`` is the message formatted with
- * 			  *fmt*.
+ * 			* ``<fmt>`` is the message formatted with *fmt*.
  *
  * 		The conversion specifiers supported by *fmt* are similar, but
  * 		more limited than for printk(). They are **%d**, **%i**,
@@ -3860,8 +3859,10 @@  union bpf_attr {
  * 			void bpf_sys_open(struct pt_regs *ctx)
  * 			{
  * 			        char buf[PATHLEN]; // PATHLEN is defined to 256
- * 			        int res = bpf_probe_read_user_str(buf, sizeof(buf),
- * 				                                  ctx->di);
+ * 			        int res;
+ *
+ * 			        res = bpf_probe_read_user_str(buf, sizeof(buf),
+ * 				                              ctx->di);
  *
  * 				// Consume buf, for example push it to
  * 				// userspace via bpf_perf_event_output(); we
diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/bpf.h
index ef78e0e1a754..1443fa2a1915 100644
--- a/tools/include/uapi/linux/bpf.h
+++ b/tools/include/uapi/linux/bpf.h
@@ -1619,7 +1619,7 @@  union bpf_attr {
  *
  * 		::
  *
- * 			telnet-470   [001] .N.. 419421.045894: 0x00000001: <formatted msg>
+ * 			telnet-470   [001] .N.. 419421.045894: 0x00000001: <fmt>
  *
  * 		In the above:
  *
@@ -1636,8 +1636,7 @@  union bpf_attr {
  * 			* ``419421.045894`` is a timestamp.
  * 			* ``0x00000001`` is a fake value used by BPF for the
  * 			  instruction pointer register.
- * 			* ``<formatted msg>`` is the message formatted with
- * 			  *fmt*.
+ * 			* ``<fmt>`` is the message formatted with *fmt*.
  *
  * 		The conversion specifiers supported by *fmt* are similar, but
  * 		more limited than for printk(). They are **%d**, **%i**,
@@ -3860,8 +3859,10 @@  union bpf_attr {
  * 			void bpf_sys_open(struct pt_regs *ctx)
  * 			{
  * 			        char buf[PATHLEN]; // PATHLEN is defined to 256
- * 			        int res = bpf_probe_read_user_str(buf, sizeof(buf),
- * 				                                  ctx->di);
+ * 			        int res;
+ *
+ * 			        res = bpf_probe_read_user_str(buf, sizeof(buf),
+ * 				                              ctx->di);
  *
  * 				// Consume buf, for example push it to
  * 				// userspace via bpf_perf_event_output(); we