mbox series

[net-next,V4,0/3] tools: bpftool: show filenames of pinned objects

Message ID 20171108045549.5356-1-bhole_prashant_q7@lab.ntt.co.jp
Headers show
Series tools: bpftool: show filenames of pinned objects | expand

Message

Prashant Bhole Nov. 8, 2017, 4:55 a.m. UTC
This patchset adds support to show pinned objects in object details.

Patch1 adds a funtionality to open a path in bpf-fs regardless of its object
type.

Patch2 adds actual functionality by scanning the bpf-fs once and adding
object information in hash table, with object id as a key. One object may be
associated with multiple paths because an object can be pinned multiple times

Patch3 adds command line option to enable this functionality. Making it optional
because scanning bpf-fs can be costly.

v1->v2:
 - Dynamically identify bpf-fs moutpoint
 - Close files descriptors before returning on error
 - Change command line option from {-l|--pinned} to {-f|--bpffs}
 - Updated documentation
 - Fixed line break for proper output formatting
 - Code style: wrapped lines > 80, used reverse christmastree style

v2->v3:
 - Handle multiple bpffs mountpoints
 - Code style: fixed line break indentation

v3->v4:
 - Removed unnecessary hash empty check
 - Code style changes

Prashant Bhole (3):
  tools: bpftool: open pinned object without type check
  tools: bpftool: show filenames of pinned objects
  tools: bpftool: optionally show filenames of pinned objects

 tools/bpf/bpftool/Documentation/bpftool-map.rst  |  5 +-
 tools/bpf/bpftool/Documentation/bpftool-prog.rst |  5 +-
 tools/bpf/bpftool/common.c                       | 97 +++++++++++++++++++++++-
 tools/bpf/bpftool/main.c                         | 18 ++++-
 tools/bpf/bpftool/main.h                         | 21 ++++-
 tools/bpf/bpftool/map.c                          | 22 ++++++
 tools/bpf/bpftool/prog.c                         | 25 ++++++
 7 files changed, 187 insertions(+), 6 deletions(-)

Comments

Jakub Kicinski Nov. 8, 2017, 3:11 p.m. UTC | #1
On Wed,  8 Nov 2017 13:55:46 +0900, Prashant Bhole wrote:
> This patchset adds support to show pinned objects in object details.
> 
> Patch1 adds a funtionality to open a path in bpf-fs regardless of its object
> type.
> 
> Patch2 adds actual functionality by scanning the bpf-fs once and adding
> object information in hash table, with object id as a key. One object may be
> associated with multiple paths because an object can be pinned multiple times
> 
> Patch3 adds command line option to enable this functionality. Making it optional
> because scanning bpf-fs can be costly.

Acked-by: Jakub Kicinski <jakub.kicinski@netronome.com>

Thank you!
David Miller Nov. 11, 2017, 4:05 a.m. UTC | #2
From: Prashant Bhole <bhole_prashant_q7@lab.ntt.co.jp>
Date: Wed,  8 Nov 2017 13:55:46 +0900

> This patchset adds support to show pinned objects in object details.
> 
> Patch1 adds a funtionality to open a path in bpf-fs regardless of its object
> type.
> 
> Patch2 adds actual functionality by scanning the bpf-fs once and adding
> object information in hash table, with object id as a key. One object may be
> associated with multiple paths because an object can be pinned multiple times
> 
> Patch3 adds command line option to enable this functionality. Making it optional
> because scanning bpf-fs can be costly.

Series applied, thanks!