diff options
author | Yonghong Song <yhs@fb.com> | 2020-07-23 21:41:19 +0300 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2020-07-26 06:16:33 +0300 |
commit | d8793aca708602c676372b03d6493972457524af (patch) | |
tree | e245a88b1cbd10418cd8eaf8aa1ab2aa732a6dd0 /tools/bpf/bpftool/bash-completion | |
parent | cd31039a7347610863aa8b77a9162048999723d0 (diff) | |
download | linux-d8793aca708602c676372b03d6493972457524af.tar.xz |
tools/bpftool: Add bpftool support for bpf map element iterator
The optional parameter "map MAP" can be added to "bpftool iter"
command to create a bpf iterator for map elements. For example,
bpftool iter pin ./prog.o /sys/fs/bpf/p1 map id 333
For map element bpf iterator "map MAP" parameter is required.
Otherwise, bpf link creation will return an error.
Quentin Monnet kindly provided bash-completion implementation
for new "map MAP" option.
Signed-off-by: Yonghong Song <yhs@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20200723184119.590799-1-yhs@fb.com
Diffstat (limited to 'tools/bpf/bpftool/bash-completion')
-rw-r--r-- | tools/bpf/bpftool/bash-completion/bpftool | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/tools/bpf/bpftool/bash-completion/bpftool b/tools/bpf/bpftool/bash-completion/bpftool index 7b137264ea3a..257fa310ea2b 100644 --- a/tools/bpf/bpftool/bash-completion/bpftool +++ b/tools/bpf/bpftool/bash-completion/bpftool @@ -615,7 +615,23 @@ _bpftool() iter) case $command in pin) - _filedir + case $prev in + $command) + _filedir + ;; + id) + _bpftool_get_map_ids + ;; + name) + _bpftool_get_map_names + ;; + pinned) + _filedir + ;; + *) + _bpftool_one_of_list $MAP_TYPE + ;; + esac return 0 ;; *) |