History

bpf: Add bpf_btf_find_by_name_kind() helper.

Add new helper: long bpf_btf_find_by_name_kind(char *name, int name_sz, u32 kind, int flags) Description Find BTF type with given name and kind in vmlinux BTF or in module's BTFs. Return Returns btf_id and btf_obj_fd in lower and upper 32 bits. It will be used by loader program to find btf_id to attach the program to and to find btf_ids of ksyms.

Alexei Starovoitov committed 5 years ago

Commit 3d784171 parent 387544b5 files · +79 −0Browse files

Showing the changes to tools/include/uapi/linux (1 of 5 files). Show all

Unified · Split

tools/include/uapi/linux/bpf.h+7−0
@@ -4748,6 +4748,12 @@ union bpf_attr { · 4747 unmodified lines
4748 * Execute bpf syscall with given arguments.4748 * Execute bpf syscall with given arguments.
4749 * Return4749 * Return
4750 * A syscall result.4750 * A syscall result.
4751 *
4752 * long bpf_btf_find_by_name_kind(char *name, int name_sz, u32 kind, int flags)
4753 * Description
4754 * Find BTF type with given name and kind in vmlinux BTF or in module's BTFs.
4755 * Return
4756 * Returns btf_id and btf_obj_fd in lower and upper 32 bits.
4751 */4757 */
4752#define __BPF_FUNC_MAPPER(FN) \4758#define __BPF_FUNC_MAPPER(FN) \
4753 FN(unspec), \4759 FN(unspec), \
@@ -4917,6 +4923,7 @@ union bpf_attr { · 163 unmodified lines
4917 FN(for_each_map_elem), \4923 FN(for_each_map_elem), \
4918 FN(snprintf), \4924 FN(snprintf), \
4919 FN(sys_bpf), \4925 FN(sys_bpf), \
4926 FN(btf_find_by_name_kind), \
4920 /* */4927 /* */
4921 4928
4922/* integer value in 'imm' field of BPF_CALL instruction selects which helper4929/* integer value in 'imm' field of BPF_CALL instruction selects which helper