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
47484748 * Execute bpf syscall with given arguments.
47494749 * Return
47504750 * 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.
47514757 */
47524758 #define __BPF_FUNC_MAPPER(FN) \
47534759 FN(unspec), \
@@ -4917,6 +4923,7 @@ union bpf_attr { · 163 unmodified lines
49174923 FN(for_each_map_elem), \
49184924 FN(snprintf), \
49194925 FN(sys_bpf), \
4926+ FN(btf_find_by_name_kind), \
49204927 /* */
49214928
49224929 /* integer value in 'imm' field of BPF_CALL instruction selects which helper