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
This commit is contained in:

committed by
Alexei Starovoitov

parent
cd31039a73
commit
d8793aca70
@@ -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
|
||||
;;
|
||||
*)
|
||||
|
Reference in New Issue
Block a user