Skip to content

Commit fe362d7

Browse files
qmonnetkernel-patches-bot
authored andcommitted
Nearly all man pages for bpftool have the same common set of option
flags (--help, --version, --json, --pretty, --debug). The description is duplicated across all the pages, which is more difficult to maintain if the description of an option changes. It may also be confusing to sort out what options are not "common" and should not be copied when creating new manual pages. Let's move the description for those common options to a separate file, which is included with a RST directive when generating the man pages. Signed-off-by: Quentin Monnet <quentin@isovalent.com> Acked-by: Andrii Nakryiko <andriin@fb.com> --- tools/bpf/bpftool/Documentation/Makefile | 2 +- .../bpf/bpftool/Documentation/bpftool-btf.rst | 17 +------------ .../bpftool/Documentation/bpftool-cgroup.rst | 17 +------------ .../bpftool/Documentation/bpftool-feature.rst | 17 +------------ .../bpf/bpftool/Documentation/bpftool-gen.rst | 17 +------------ .../bpftool/Documentation/bpftool-iter.rst | 11 +-------- .../bpftool/Documentation/bpftool-link.rst | 17 +------------ .../bpf/bpftool/Documentation/bpftool-map.rst | 17 +------------ .../bpf/bpftool/Documentation/bpftool-net.rst | 17 +------------ .../bpftool/Documentation/bpftool-perf.rst | 17 +------------ .../bpftool/Documentation/bpftool-prog.rst | 18 +------------- .../Documentation/bpftool-struct_ops.rst | 18 +------------- tools/bpf/bpftool/Documentation/bpftool.rst | 24 +------------------ .../bpftool/Documentation/common_options.rst | 22 +++++++++++++++++ 14 files changed, 35 insertions(+), 196 deletions(-) create mode 100644 tools/bpf/bpftool/Documentation/common_options.rst
1 parent 9f40de5 commit fe362d7

File tree

14 files changed

+35
-196
lines changed

14 files changed

+35
-196
lines changed

tools/bpf/bpftool/Documentation/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ man8dir = $(mandir)/man8
1919
# Load targets for building eBPF helpers man page.
2020
include ../../Makefile.helpers
2121

22-
MAN8_RST = $(filter-out $(HELPERS_RST),$(wildcard *.rst))
22+
MAN8_RST = $(wildcard bpftool*.rst)
2323

2424
_DOC_MAN8 = $(patsubst %.rst,%.8,$(MAN8_RST))
2525
DOC_MAN8 = $(addprefix $(OUTPUT),$(_DOC_MAN8))

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

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -71,22 +71,7 @@ DESCRIPTION
7171

7272
OPTIONS
7373
=======
74-
-h, --help
75-
Print short generic help message (similar to **bpftool help**).
76-
77-
-V, --version
78-
Print version number (similar to **bpftool version**).
79-
80-
-j, --json
81-
Generate JSON output. For commands that cannot produce JSON, this
82-
option has no effect.
83-
84-
-p, --pretty
85-
Generate human-readable JSON output. Implies **-j**.
86-
87-
-d, --debug
88-
Print all logs available from libbpf, including debug-level
89-
information.
74+
.. include:: common_options.rst
9075

9176
EXAMPLES
9277
========

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

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -116,26 +116,11 @@ DESCRIPTION
116116

117117
OPTIONS
118118
=======
119-
-h, --help
120-
Print short generic help message (similar to **bpftool help**).
121-
122-
-V, --version
123-
Print version number (similar to **bpftool version**).
124-
125-
-j, --json
126-
Generate JSON output. For commands that cannot produce JSON, this
127-
option has no effect.
128-
129-
-p, --pretty
130-
Generate human-readable JSON output. Implies **-j**.
119+
.. include:: common_options.rst
131120

132121
-f, --bpffs
133122
Show file names of pinned programs.
134123

135-
-d, --debug
136-
Print all logs available from libbpf, including debug-level
137-
information.
138-
139124
EXAMPLES
140125
========
141126
|

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

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -71,22 +71,7 @@ DESCRIPTION
7171

7272
OPTIONS
7373
=======
74-
-h, --help
75-
Print short generic help message (similar to **bpftool help**).
76-
77-
-V, --version
78-
Print version number (similar to **bpftool version**).
79-
80-
-j, --json
81-
Generate JSON output. For commands that cannot produce JSON, this
82-
option has no effect.
83-
84-
-p, --pretty
85-
Generate human-readable JSON output. Implies **-j**.
86-
87-
-d, --debug
88-
Print all logs available from libbpf, including debug-level
89-
information.
74+
.. include:: common_options.rst
9075

9176
SEE ALSO
9277
========

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

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -126,22 +126,7 @@ DESCRIPTION
126126

127127
OPTIONS
128128
=======
129-
-h, --help
130-
Print short generic help message (similar to **bpftool help**).
131-
132-
-V, --version
133-
Print version number (similar to **bpftool version**).
134-
135-
-j, --json
136-
Generate JSON output. For commands that cannot produce JSON,
137-
this option has no effect.
138-
139-
-p, --pretty
140-
Generate human-readable JSON output. Implies **-j**.
141-
142-
-d, --debug
143-
Print all logs available from libbpf, including debug-level
144-
information.
129+
.. include:: common_options.rst
145130

146131
EXAMPLES
147132
========

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

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,16 +51,7 @@ DESCRIPTION
5151

5252
OPTIONS
5353
=======
54-
-h, --help
55-
Print short generic help message (similar to **bpftool help**).
56-
57-
-V, --version
58-
Print version number (similar to **bpftool version**).
59-
60-
-d, --debug
61-
Print all logs available, even debug-level information. This
62-
includes logs from libbpf as well as from the verifier, when
63-
attempting to load programs.
54+
.. include:: common_options.rst
6455

6556
EXAMPLES
6657
========

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

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -62,18 +62,7 @@ DESCRIPTION
6262

6363
OPTIONS
6464
=======
65-
-h, --help
66-
Print short generic help message (similar to **bpftool help**).
67-
68-
-V, --version
69-
Print version number (similar to **bpftool version**).
70-
71-
-j, --json
72-
Generate JSON output. For commands that cannot produce JSON, this
73-
option has no effect.
74-
75-
-p, --pretty
76-
Generate human-readable JSON output. Implies **-j**.
65+
.. include:: common_options.rst
7766

7867
-f, --bpffs
7968
When showing BPF links, show file names of pinned
@@ -83,10 +72,6 @@ OPTIONS
8372
Do not automatically attempt to mount any virtual file system
8473
(such as tracefs or BPF virtual file system) when necessary.
8574

86-
-d, --debug
87-
Print all logs available, even debug-level information. This
88-
includes logs from libbpf.
89-
9075
EXAMPLES
9176
========
9277
**# bpftool link show**

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

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -155,18 +155,7 @@ DESCRIPTION
155155

156156
OPTIONS
157157
=======
158-
-h, --help
159-
Print short generic help message (similar to **bpftool help**).
160-
161-
-V, --version
162-
Print version number (similar to **bpftool version**).
163-
164-
-j, --json
165-
Generate JSON output. For commands that cannot produce JSON, this
166-
option has no effect.
167-
168-
-p, --pretty
169-
Generate human-readable JSON output. Implies **-j**.
158+
.. include:: common_options.rst
170159

171160
-f, --bpffs
172161
Show file names of pinned maps.
@@ -175,10 +164,6 @@ OPTIONS
175164
Do not automatically attempt to mount any virtual file system
176165
(such as tracefs or BPF virtual file system) when necessary.
177166

178-
-d, --debug
179-
Print all logs available from libbpf, including debug-level
180-
information.
181-
182167
EXAMPLES
183168
========
184169
**# bpftool map show**

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

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -75,22 +75,7 @@ DESCRIPTION
7575

7676
OPTIONS
7777
=======
78-
-h, --help
79-
Print short generic help message (similar to **bpftool help**).
80-
81-
-V, --version
82-
Print version number (similar to **bpftool version**).
83-
84-
-j, --json
85-
Generate JSON output. For commands that cannot produce JSON, this
86-
option has no effect.
87-
88-
-p, --pretty
89-
Generate human-readable JSON output. Implies **-j**.
90-
91-
-d, --debug
92-
Print all logs available from libbpf, including debug-level
93-
information.
78+
.. include:: common_options.rst
9479

9580
EXAMPLES
9681
========

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

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -40,22 +40,7 @@ DESCRIPTION
4040

4141
OPTIONS
4242
=======
43-
-h, --help
44-
Print short generic help message (similar to **bpftool help**).
45-
46-
-V, --version
47-
Print version number (similar to **bpftool version**).
48-
49-
-j, --json
50-
Generate JSON output. For commands that cannot produce JSON, this
51-
option has no effect.
52-
53-
-p, --pretty
54-
Generate human-readable JSON output. Implies **-j**.
55-
56-
-d, --debug
57-
Print all logs available from libbpf, including debug-level
58-
information.
43+
.. include:: common_options.rst
5944

6045
EXAMPLES
6146
========

0 commit comments

Comments
 (0)