]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: Add d_path helper
authorJiri Olsa <jolsa@kernel.org>
Tue, 25 Aug 2020 19:21:20 +0000 (21:21 +0200)
committerAlexei Starovoitov <ast@kernel.org>
Tue, 25 Aug 2020 22:41:15 +0000 (15:41 -0700)
commit0f32050fb5e73eee56aaa034b9f69b502c18015c
tree0421c44d1e43134bdf0abcdf575b0520e99796ec
parentdc8311c950cd718074cc6c64f758f8aad1422f7a
bpf: Add d_path helper

Adding d_path helper function that returns full path for
given 'struct path' object, which needs to be the kernel
BTF 'path' object. The path is returned in buffer provided
'buf' of size 'sz' and is zero terminated.

  bpf_d_path(&file->f_path, buf, size);

The helper calls directly d_path function, so there's only
limited set of function it can be called from. Adding just
very modest set for the start.

Updating also bpf.h tools uapi header and adding 'path' to
bpf_helpers_doc.py script.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Andrii Nakryiko <andriin@fb.com>
Acked-by: KP Singh <kpsingh@google.com>
Link: https://lore.kernel.org/bpf/20200825192124.710397-11-jolsa@kernel.org
include/uapi/linux/bpf.h
kernel/trace/bpf_trace.c
scripts/bpf_helpers_doc.py
tools/include/uapi/linux/bpf.h