Skip to content

Commit aa438d9

Browse files
qmonnetkernel-patches-bot
authored andcommitted
The "SEE ALSO" sections of bpftool's manual pages refer to bpf(2),
bpf-helpers(7), then all existing bpftool man pages (save the current one). This leads to nearly-identical lists being duplicated in all manual pages. Ideally, when a new page is created, all lists should be updated accordingly, but this has led to omissions and inconsistencies multiple times in the past. Let's take it out of the RST files and generate the "SEE ALSO" sections automatically in the Makefile when generating the man pages. The lists are not really useful in the RST anyway because all other pages are available in the same directory. v2: - Use "echo -n" instead of "printf" in Makefile, to avoid any risk of passing a format string directly to the command. Signed-off-by: Quentin Monnet <[email protected]> Acked-by: Andrii Nakryiko <[email protected]> --- tools/bpf/bpftool/Documentation/Makefile | 12 +++++++++++- tools/bpf/bpftool/Documentation/bpftool-btf.rst | 17 ----------------- .../bpftool/Documentation/bpftool-cgroup.rst | 16 ---------------- .../bpftool/Documentation/bpftool-feature.rst | 16 ---------------- tools/bpf/bpftool/Documentation/bpftool-gen.rst | 16 ---------------- .../bpf/bpftool/Documentation/bpftool-iter.rst | 16 ---------------- .../bpf/bpftool/Documentation/bpftool-link.rst | 17 ----------------- tools/bpf/bpftool/Documentation/bpftool-map.rst | 16 ---------------- tools/bpf/bpftool/Documentation/bpftool-net.rst | 17 ----------------- .../bpf/bpftool/Documentation/bpftool-perf.rst | 17 ----------------- .../bpf/bpftool/Documentation/bpftool-prog.rst | 16 ---------------- .../Documentation/bpftool-struct_ops.rst | 17 ----------------- tools/bpf/bpftool/Documentation/bpftool.rst | 16 ---------------- 13 files changed, 11 insertions(+), 198 deletions(-)
1 parent 3b758fd commit aa438d9

13 files changed

+11
-198
lines changed

tools/bpf/bpftool/Documentation/Makefile

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,21 @@ man8: $(DOC_MAN8)
2929

3030
RST2MAN_DEP := $(shell command -v rst2man 2>/dev/null)
3131

32+
list_pages = $(sort $(basename $(filter-out $(1),$(MAN8_RST))))
33+
see_also = $(subst " ",, \
34+
"\n" \
35+
"SEE ALSO\n" \
36+
"========\n" \
37+
"\t**bpf**\ (2),\n" \
38+
"\t**bpf-helpers**\\ (7)" \
39+
$(foreach page,$(call list_pages,$(1)),",\n\t**$(page)**\\ (8)") \
40+
"\n")
41+
3242
$(OUTPUT)%.8: %.rst
3343
ifndef RST2MAN_DEP
3444
$(error "rst2man not found, but required to generate man pages")
3545
endif
36-
$(QUIET_GEN)rst2man $< > $@
46+
$(QUIET_GEN)( cat $< ; echo -n $(call see_also,$<) ) | rst2man > $@
3747

3848
clean: helpers-clean
3949
$(call QUIET_CLEAN, Documentation)

tools/bpf/bpftool/Documentation/bpftool-btf.rst

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -214,20 +214,3 @@ All the standard ways to specify map or program are supported:
214214
**# bpftool btf dump prog tag b88e0a09b1d9759d**
215215

216216
**# bpftool btf dump prog pinned /sys/fs/bpf/prog_name**
217-
218-
SEE ALSO
219-
========
220-
**bpf**\ (2),
221-
**bpf-helpers**\ (7),
222-
**bpftool**\ (8),
223-
**bpftool-btf**\ (8),
224-
**bpftool-cgroup**\ (8),
225-
**bpftool-feature**\ (8),
226-
**bpftool-gen**\ (8),
227-
**bpftool-iter**\ (8),
228-
**bpftool-link**\ (8),
229-
**bpftool-map**\ (8),
230-
**bpftool-net**\ (8),
231-
**bpftool-perf**\ (8),
232-
**bpftool-prog**\ (8),
233-
**bpftool-struct_ops**\ (8)

tools/bpf/bpftool/Documentation/bpftool-cgroup.rst

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -143,19 +143,3 @@ EXAMPLES
143143
::
144144

145145
ID AttachType AttachFlags Name
146-
147-
SEE ALSO
148-
========
149-
**bpf**\ (2),
150-
**bpf-helpers**\ (7),
151-
**bpftool**\ (8),
152-
**bpftool-btf**\ (8),
153-
**bpftool-feature**\ (8),
154-
**bpftool-gen**\ (8),
155-
**bpftool-iter**\ (8),
156-
**bpftool-link**\ (8),
157-
**bpftool-map**\ (8),
158-
**bpftool-net**\ (8),
159-
**bpftool-perf**\ (8),
160-
**bpftool-prog**\ (8),
161-
**bpftool-struct_ops**\ (8)

tools/bpf/bpftool/Documentation/bpftool-feature.rst

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -72,19 +72,3 @@ DESCRIPTION
7272
OPTIONS
7373
=======
7474
.. include:: common_options.rst
75-
76-
SEE ALSO
77-
========
78-
**bpf**\ (2),
79-
**bpf-helpers**\ (7),
80-
**bpftool**\ (8),
81-
**bpftool-btf**\ (8),
82-
**bpftool-cgroup**\ (8),
83-
**bpftool-gen**\ (8),
84-
**bpftool-iter**\ (8),
85-
**bpftool-link**\ (8),
86-
**bpftool-map**\ (8),
87-
**bpftool-net**\ (8),
88-
**bpftool-perf**\ (8),
89-
**bpftool-prog**\ (8),
90-
**bpftool-struct_ops**\ (8)

tools/bpf/bpftool/Documentation/bpftool-gen.rst

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -275,19 +275,3 @@ and global variables.
275275
my_static_var: 7
276276

277277
This is a stripped-out version of skeleton generated for above example code.
278-
279-
SEE ALSO
280-
========
281-
**bpf**\ (2),
282-
**bpf-helpers**\ (7),
283-
**bpftool**\ (8),
284-
**bpftool-btf**\ (8),
285-
**bpftool-cgroup**\ (8),
286-
**bpftool-feature**\ (8),
287-
**bpftool-iter**\ (8),
288-
**bpftool-link**\ (8),
289-
**bpftool-map**\ (8),
290-
**bpftool-net**\ (8),
291-
**bpftool-perf**\ (8),
292-
**bpftool-prog**\ (8),
293-
**bpftool-struct_ops**\ (8)

tools/bpf/bpftool/Documentation/bpftool-iter.rst

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -68,19 +68,3 @@ EXAMPLES
6868

6969
Create a file-based bpf iterator from bpf_iter_hashmap.o and map with
7070
id 20, and pin it to /sys/fs/bpf/my_hashmap
71-
72-
SEE ALSO
73-
========
74-
**bpf**\ (2),
75-
**bpf-helpers**\ (7),
76-
**bpftool**\ (8),
77-
**bpftool-btf**\ (8),
78-
**bpftool-cgroup**\ (8),
79-
**bpftool-feature**\ (8),
80-
**bpftool-gen**\ (8),
81-
**bpftool-link**\ (8),
82-
**bpftool-map**\ (8),
83-
**bpftool-net**\ (8),
84-
**bpftool-perf**\ (8),
85-
**bpftool-prog**\ (8),
86-
**bpftool-struct_ops**\ (8)

tools/bpf/bpftool/Documentation/bpftool-link.rst

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -106,20 +106,3 @@ EXAMPLES
106106
::
107107

108108
-rw------- 1 root root 0 Apr 23 21:39 link
109-
110-
111-
SEE ALSO
112-
========
113-
**bpf**\ (2),
114-
**bpf-helpers**\ (7),
115-
**bpftool**\ (8),
116-
**bpftool-btf**\ (8),
117-
**bpftool-cgroup**\ (8),
118-
**bpftool-feature**\ (8),
119-
**bpftool-gen**\ (8),
120-
**bpftool-iter**\ (8),
121-
**bpftool-map**\ (8),
122-
**bpftool-net**\ (8),
123-
**bpftool-perf**\ (8),
124-
**bpftool-prog**\ (8),
125-
**bpftool-struct_ops**\ (8)

tools/bpf/bpftool/Documentation/bpftool-map.rst

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -261,19 +261,3 @@ would be lost as soon as bpftool exits).
261261

262262
key: 00 00 00 00 value: 22 02 00 00
263263
Found 1 element
264-
265-
SEE ALSO
266-
========
267-
**bpf**\ (2),
268-
**bpf-helpers**\ (7),
269-
**bpftool**\ (8),
270-
**bpftool-btf**\ (8),
271-
**bpftool-cgroup**\ (8),
272-
**bpftool-feature**\ (8),
273-
**bpftool-gen**\ (8),
274-
**bpftool-iter**\ (8),
275-
**bpftool-link**\ (8),
276-
**bpftool-net**\ (8),
277-
**bpftool-perf**\ (8),
278-
**bpftool-prog**\ (8),
279-
**bpftool-struct_ops**\ (8)

tools/bpf/bpftool/Documentation/bpftool-net.rst

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -172,20 +172,3 @@ EXAMPLES
172172
::
173173

174174
xdp:
175-
176-
177-
SEE ALSO
178-
========
179-
**bpf**\ (2),
180-
**bpf-helpers**\ (7),
181-
**bpftool**\ (8),
182-
**bpftool-btf**\ (8),
183-
**bpftool-cgroup**\ (8),
184-
**bpftool-feature**\ (8),
185-
**bpftool-gen**\ (8),
186-
**bpftool-iter**\ (8),
187-
**bpftool-link**\ (8),
188-
**bpftool-map**\ (8),
189-
**bpftool-perf**\ (8),
190-
**bpftool-prog**\ (8),
191-
**bpftool-struct_ops**\ (8)

tools/bpf/bpftool/Documentation/bpftool-perf.rst

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -63,20 +63,3 @@ EXAMPLES
6363
{"pid":21765,"fd":5,"prog_id":7,"fd_type":"kretprobe","func":"__x64_sys_nanosleep","offset":0}, \
6464
{"pid":21767,"fd":5,"prog_id":8,"fd_type":"tracepoint","tracepoint":"sys_enter_nanosleep"}, \
6565
{"pid":21800,"fd":5,"prog_id":9,"fd_type":"uprobe","filename":"/home/yhs/a.out","offset":1159}]
66-
67-
68-
SEE ALSO
69-
========
70-
**bpf**\ (2),
71-
**bpf-helpers**\ (7),
72-
**bpftool**\ (8),
73-
**bpftool-btf**\ (8),
74-
**bpftool-cgroup**\ (8),
75-
**bpftool-feature**\ (8),
76-
**bpftool-gen**\ (8),
77-
**bpftool-iter**\ (8),
78-
**bpftool-link**\ (8),
79-
**bpftool-map**\ (8),
80-
**bpftool-net**\ (8),
81-
**bpftool-prog**\ (8),
82-
**bpftool-struct_ops**\ (8)

tools/bpf/bpftool/Documentation/bpftool-prog.rst

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -326,19 +326,3 @@ EXAMPLES
326326
40176203 cycles (83.05%)
327327
42518139 instructions # 1.06 insns per cycle (83.39%)
328328
123 llc_misses # 2.89 LLC misses per million insns (83.15%)
329-
330-
SEE ALSO
331-
========
332-
**bpf**\ (2),
333-
**bpf-helpers**\ (7),
334-
**bpftool**\ (8),
335-
**bpftool-btf**\ (8),
336-
**bpftool-cgroup**\ (8),
337-
**bpftool-feature**\ (8),
338-
**bpftool-gen**\ (8),
339-
**bpftool-iter**\ (8),
340-
**bpftool-link**\ (8),
341-
**bpftool-map**\ (8),
342-
**bpftool-net**\ (8),
343-
**bpftool-perf**\ (8),
344-
**bpftool-struct_ops**\ (8)

tools/bpf/bpftool/Documentation/bpftool-struct_ops.rst

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -82,20 +82,3 @@ EXAMPLES
8282
::
8383

8484
Registered tcp_congestion_ops cubic id 110
85-
86-
87-
SEE ALSO
88-
========
89-
**bpf**\ (2),
90-
**bpf-helpers**\ (7),
91-
**bpftool**\ (8),
92-
**bpftool-btf**\ (8),
93-
**bpftool-cgroup**\ (8),
94-
**bpftool-feature**\ (8),
95-
**bpftool-gen**\ (8),
96-
**bpftool-iter**\ (8),
97-
**bpftool-link**\ (8),
98-
**bpftool-map**\ (8),
99-
**bpftool-net**\ (8),
100-
**bpftool-perf**\ (8),
101-
**bpftool-prog**\ (8)

tools/bpf/bpftool/Documentation/bpftool.rst

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -54,19 +54,3 @@ OPTIONS
5454
-n, --nomount
5555
Do not automatically attempt to mount any virtual file system
5656
(such as tracefs or BPF virtual file system) when necessary.
57-
58-
SEE ALSO
59-
========
60-
**bpf**\ (2),
61-
**bpf-helpers**\ (7),
62-
**bpftool-btf**\ (8),
63-
**bpftool-cgroup**\ (8),
64-
**bpftool-feature**\ (8),
65-
**bpftool-gen**\ (8),
66-
**bpftool-iter**\ (8),
67-
**bpftool-link**\ (8),
68-
**bpftool-map**\ (8),
69-
**bpftool-net**\ (8),
70-
**bpftool-perf**\ (8),
71-
**bpftool-prog**\ (8),
72-
**bpftool-struct_ops**\ (8)

0 commit comments

Comments
 (0)