Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tools: bpftool: print built-in features, automate some of the documentation #18

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
sudo: required
language: bash
dist: bionic
services:
- docker

env:
global:
- PROJECT_NAME='libbpf'
- AUTHOR_EMAIL="$(git log -1 --pretty=\"%aE\")"
- REPO_ROOT="$TRAVIS_BUILD_DIR"
- CI_ROOT="$REPO_ROOT/travis-ci"
- VMTEST_ROOT="$CI_ROOT/vmtest"

addons:
apt:
packages:
- qemu-kvm
- zstd
- binutils-dev
- elfutils
- libcap-dev
- libelf-dev
- libdw-dev

jobs:
include:
- stage: Builds & Tests
name: Kernel LATEST + selftests
language: bash
env: KERNEL=LATEST
script: $CI_ROOT/vmtest/run_vmtest.sh || travis_terminate 1
14 changes: 12 additions & 2 deletions tools/bpf/bpftool/Documentation/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ man8dir = $(mandir)/man8
# Load targets for building eBPF helpers man page.
include ../../Makefile.helpers

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

_DOC_MAN8 = $(patsubst %.rst,%.8,$(MAN8_RST))
DOC_MAN8 = $(addprefix $(OUTPUT),$(_DOC_MAN8))
Expand All @@ -29,11 +29,21 @@ man8: $(DOC_MAN8)

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

list_pages = $(sort $(basename $(filter-out $(1),$(MAN8_RST))))
see_also = $(subst " ",, \
"\n" \
"SEE ALSO\n" \
"========\n" \
"\t**bpf**\ (2),\n" \
"\t**bpf-helpers**\\ (7)" \
$(foreach page,$(call list_pages,$(1)),",\n\t**$(page)**\\ (8)") \
"\n")

$(OUTPUT)%.8: %.rst
ifndef RST2MAN_DEP
$(error "rst2man not found, but required to generate man pages")
endif
$(QUIET_GEN)rst2man $< > $@
$(QUIET_GEN)( cat $< ; echo -n $(call see_also,$<) ) | rst2man > $@

clean: helpers-clean
$(call QUIET_CLEAN, Documentation)
Expand Down
34 changes: 1 addition & 33 deletions tools/bpf/bpftool/Documentation/bpftool-btf.rst
Original file line number Diff line number Diff line change
Expand Up @@ -71,22 +71,7 @@ DESCRIPTION

OPTIONS
=======
-h, --help
Print short generic help message (similar to **bpftool help**).

-V, --version
Print version number (similar to **bpftool version**).

-j, --json
Generate JSON output. For commands that cannot produce JSON, this
option has no effect.

-p, --pretty
Generate human-readable JSON output. Implies **-j**.

-d, --debug
Print all logs available from libbpf, including debug-level
information.
.. include:: common_options.rst

EXAMPLES
========
Expand Down Expand Up @@ -229,20 +214,3 @@ All the standard ways to specify map or program are supported:
**# bpftool btf dump prog tag b88e0a09b1d9759d**

**# bpftool btf dump prog pinned /sys/fs/bpf/prog_name**

SEE ALSO
========
**bpf**\ (2),
**bpf-helpers**\ (7),
**bpftool**\ (8),
**bpftool-btf**\ (8),
**bpftool-cgroup**\ (8),
**bpftool-feature**\ (8),
**bpftool-gen**\ (8),
**bpftool-iter**\ (8),
**bpftool-link**\ (8),
**bpftool-map**\ (8),
**bpftool-net**\ (8),
**bpftool-perf**\ (8),
**bpftool-prog**\ (8),
**bpftool-struct_ops**\ (8)
33 changes: 1 addition & 32 deletions tools/bpf/bpftool/Documentation/bpftool-cgroup.rst
Original file line number Diff line number Diff line change
Expand Up @@ -116,26 +116,11 @@ DESCRIPTION

OPTIONS
=======
-h, --help
Print short generic help message (similar to **bpftool help**).

-V, --version
Print version number (similar to **bpftool version**).

-j, --json
Generate JSON output. For commands that cannot produce JSON, this
option has no effect.

-p, --pretty
Generate human-readable JSON output. Implies **-j**.
.. include:: common_options.rst

-f, --bpffs
Show file names of pinned programs.

-d, --debug
Print all logs available from libbpf, including debug-level
information.

EXAMPLES
========
|
Expand All @@ -158,19 +143,3 @@ EXAMPLES
::

ID AttachType AttachFlags Name

SEE ALSO
========
**bpf**\ (2),
**bpf-helpers**\ (7),
**bpftool**\ (8),
**bpftool-btf**\ (8),
**bpftool-feature**\ (8),
**bpftool-gen**\ (8),
**bpftool-iter**\ (8),
**bpftool-link**\ (8),
**bpftool-map**\ (8),
**bpftool-net**\ (8),
**bpftool-perf**\ (8),
**bpftool-prog**\ (8),
**bpftool-struct_ops**\ (8)
33 changes: 1 addition & 32 deletions tools/bpf/bpftool/Documentation/bpftool-feature.rst
Original file line number Diff line number Diff line change
Expand Up @@ -71,35 +71,4 @@ DESCRIPTION

OPTIONS
=======
-h, --help
Print short generic help message (similar to **bpftool help**).

-V, --version
Print version number (similar to **bpftool version**).

-j, --json
Generate JSON output. For commands that cannot produce JSON, this
option has no effect.

-p, --pretty
Generate human-readable JSON output. Implies **-j**.

-d, --debug
Print all logs available from libbpf, including debug-level
information.

SEE ALSO
========
**bpf**\ (2),
**bpf-helpers**\ (7),
**bpftool**\ (8),
**bpftool-btf**\ (8),
**bpftool-cgroup**\ (8),
**bpftool-gen**\ (8),
**bpftool-iter**\ (8),
**bpftool-link**\ (8),
**bpftool-map**\ (8),
**bpftool-net**\ (8),
**bpftool-perf**\ (8),
**bpftool-prog**\ (8),
**bpftool-struct_ops**\ (8)
.. include:: common_options.rst
33 changes: 1 addition & 32 deletions tools/bpf/bpftool/Documentation/bpftool-gen.rst
Original file line number Diff line number Diff line change
Expand Up @@ -126,22 +126,7 @@ DESCRIPTION

OPTIONS
=======
-h, --help
Print short generic help message (similar to **bpftool help**).

-V, --version
Print version number (similar to **bpftool version**).

-j, --json
Generate JSON output. For commands that cannot produce JSON,
this option has no effect.

-p, --pretty
Generate human-readable JSON output. Implies **-j**.

-d, --debug
Print all logs available from libbpf, including debug-level
information.
.. include:: common_options.rst

EXAMPLES
========
Expand Down Expand Up @@ -290,19 +275,3 @@ and global variables.
my_static_var: 7

This is a stripped-out version of skeleton generated for above example code.

SEE ALSO
========
**bpf**\ (2),
**bpf-helpers**\ (7),
**bpftool**\ (8),
**bpftool-btf**\ (8),
**bpftool-cgroup**\ (8),
**bpftool-feature**\ (8),
**bpftool-iter**\ (8),
**bpftool-link**\ (8),
**bpftool-map**\ (8),
**bpftool-net**\ (8),
**bpftool-perf**\ (8),
**bpftool-prog**\ (8),
**bpftool-struct_ops**\ (8)
27 changes: 1 addition & 26 deletions tools/bpf/bpftool/Documentation/bpftool-iter.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,7 @@ DESCRIPTION

OPTIONS
=======
-h, --help
Print short generic help message (similar to **bpftool help**).

-V, --version
Print version number (similar to **bpftool version**).

-d, --debug
Print all logs available, even debug-level information. This
includes logs from libbpf as well as from the verifier, when
attempting to load programs.
.. include:: common_options.rst

EXAMPLES
========
Expand All @@ -77,19 +68,3 @@ EXAMPLES

Create a file-based bpf iterator from bpf_iter_hashmap.o and map with
id 20, and pin it to /sys/fs/bpf/my_hashmap

SEE ALSO
========
**bpf**\ (2),
**bpf-helpers**\ (7),
**bpftool**\ (8),
**bpftool-btf**\ (8),
**bpftool-cgroup**\ (8),
**bpftool-feature**\ (8),
**bpftool-gen**\ (8),
**bpftool-link**\ (8),
**bpftool-map**\ (8),
**bpftool-net**\ (8),
**bpftool-perf**\ (8),
**bpftool-prog**\ (8),
**bpftool-struct_ops**\ (8)
34 changes: 1 addition & 33 deletions tools/bpf/bpftool/Documentation/bpftool-link.rst
Original file line number Diff line number Diff line change
Expand Up @@ -62,18 +62,7 @@ DESCRIPTION

OPTIONS
=======
-h, --help
Print short generic help message (similar to **bpftool help**).

-V, --version
Print version number (similar to **bpftool version**).

-j, --json
Generate JSON output. For commands that cannot produce JSON, this
option has no effect.

-p, --pretty
Generate human-readable JSON output. Implies **-j**.
.. include:: common_options.rst

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

-d, --debug
Print all logs available, even debug-level information. This
includes logs from libbpf.

EXAMPLES
========
**# bpftool link show**
Expand Down Expand Up @@ -121,20 +106,3 @@ EXAMPLES
::

-rw------- 1 root root 0 Apr 23 21:39 link


SEE ALSO
========
**bpf**\ (2),
**bpf-helpers**\ (7),
**bpftool**\ (8),
**bpftool-btf**\ (8),
**bpftool-cgroup**\ (8),
**bpftool-feature**\ (8),
**bpftool-gen**\ (8),
**bpftool-iter**\ (8),
**bpftool-map**\ (8),
**bpftool-net**\ (8),
**bpftool-perf**\ (8),
**bpftool-prog**\ (8),
**bpftool-struct_ops**\ (8)
33 changes: 1 addition & 32 deletions tools/bpf/bpftool/Documentation/bpftool-map.rst
Original file line number Diff line number Diff line change
Expand Up @@ -155,18 +155,7 @@ DESCRIPTION

OPTIONS
=======
-h, --help
Print short generic help message (similar to **bpftool help**).

-V, --version
Print version number (similar to **bpftool version**).

-j, --json
Generate JSON output. For commands that cannot produce JSON, this
option has no effect.

-p, --pretty
Generate human-readable JSON output. Implies **-j**.
.. include:: common_options.rst

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

-d, --debug
Print all logs available from libbpf, including debug-level
information.

EXAMPLES
========
**# bpftool map show**
Expand Down Expand Up @@ -276,19 +261,3 @@ would be lost as soon as bpftool exits).

key: 00 00 00 00 value: 22 02 00 00
Found 1 element

SEE ALSO
========
**bpf**\ (2),
**bpf-helpers**\ (7),
**bpftool**\ (8),
**bpftool-btf**\ (8),
**bpftool-cgroup**\ (8),
**bpftool-feature**\ (8),
**bpftool-gen**\ (8),
**bpftool-iter**\ (8),
**bpftool-link**\ (8),
**bpftool-net**\ (8),
**bpftool-perf**\ (8),
**bpftool-prog**\ (8),
**bpftool-struct_ops**\ (8)
Loading