• David Ahern's avatar
    bpftool: Improve handling of ENOENT on map dumps · cb4e74c1
    David Ahern authored
    [ Upstream commit bf598a8f ]
    
    bpftool output is not user friendly when dumping a map with only a few
    populated entries:
    
        $ bpftool map
        1: devmap  name tx_devmap  flags 0x0
                key 4B  value 4B  max_entries 64  memlock 4096B
        2: array  name tx_idxmap  flags 0x0
                key 4B  value 4B  max_entries 64  memlock 4096B
    
        $ bpftool map dump id 1
        key:
        00 00 00 00
        value:
        No such file or directory
        key:
        01 00 00 00
        value:
        No such file or directory
        key:
        02 00 00 00
        value:
        No such file or directory
        key: 03 00 00 00  value: 03 00 00 00
    
    Handle ENOENT by keeping the line format sane and dumping
    "<no entry>" for the value
    
        $ bpftool map dump id 1
        key: 00 00 00 00  value: <no entry>
        key: 01 00 00 00  value: <no entry>
        key: 02 00 00 00  value: <no entry>
        key: 03 00 00 00  value: 03 00 00 00
        ...
    Signed-off-by: 's avatarDavid Ahern <dsahern@gmail.com>
    Acked-by: 's avatarJakub Kicinski <jakub.kicinski@netronome.com>
    Signed-off-by: 's avatarDaniel Borkmann <daniel@iogearbox.net>
    Signed-off-by: 's avatarSasha Levin <sashal@kernel.org>
    cb4e74c1
Name
Last commit
Last update
..
bpftool Loading commit data...
.gitignore Loading commit data...
Makefile Loading commit data...
Makefile.helpers Loading commit data...
bpf_asm.c Loading commit data...
bpf_dbg.c Loading commit data...
bpf_exp.l Loading commit data...
bpf_exp.y Loading commit data...
bpf_jit_disasm.c Loading commit data...