mirror of
https://github.com/netdata/libbpf.git
synced 2026-04-12 03:29:06 +08:00
bpf: Add bpf_seq_printf_btf helper
A helper is added to allow seq file writing of kernel data
structures using vmlinux BTF. Its signature is
long bpf_seq_printf_btf(struct seq_file *m, struct btf_ptr *ptr,
u32 btf_ptr_size, u64 flags);
Flags and struct btf_ptr definitions/use are identical to the
bpf_snprintf_btf helper, and the helper returns 0 on success
or a negative error value.
Suggested-by: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Signed-off-by: Alan Maguire <alan.maguire@oracle.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/1601292670-1616-8-git-send-email-alan.maguire@oracle.com
This commit is contained in:
committed by
Andrii Nakryiko
parent
e7647823a1
commit
2654268c79
@@ -3630,6 +3630,14 @@ union bpf_attr {
|
|||||||
* The number of bytes that were written (or would have been
|
* The number of bytes that were written (or would have been
|
||||||
* written if output had to be truncated due to string size),
|
* written if output had to be truncated due to string size),
|
||||||
* or a negative error in cases of failure.
|
* or a negative error in cases of failure.
|
||||||
|
*
|
||||||
|
* long bpf_seq_printf_btf(struct seq_file *m, struct btf_ptr *ptr, u32 ptr_size, u64 flags)
|
||||||
|
* Description
|
||||||
|
* Use BTF to write to seq_write a string representation of
|
||||||
|
* *ptr*->ptr, using *ptr*->type_id as per bpf_snprintf_btf().
|
||||||
|
* *flags* are identical to those used for bpf_snprintf_btf.
|
||||||
|
* Return
|
||||||
|
* 0 on success or a negative error in case of failure.
|
||||||
*/
|
*/
|
||||||
#define __BPF_FUNC_MAPPER(FN) \
|
#define __BPF_FUNC_MAPPER(FN) \
|
||||||
FN(unspec), \
|
FN(unspec), \
|
||||||
@@ -3782,6 +3790,7 @@ union bpf_attr {
|
|||||||
FN(d_path), \
|
FN(d_path), \
|
||||||
FN(copy_from_user), \
|
FN(copy_from_user), \
|
||||||
FN(snprintf_btf), \
|
FN(snprintf_btf), \
|
||||||
|
FN(seq_printf_btf), \
|
||||||
/* */
|
/* */
|
||||||
|
|
||||||
/* integer value in 'imm' field of BPF_CALL instruction selects which helper
|
/* integer value in 'imm' field of BPF_CALL instruction selects which helper
|
||||||
|
|||||||
Reference in New Issue
Block a user