mirror of
https://github.com/netdata/libbpf.git
synced 2026-03-27 11:49:07 +08:00
libbpf: remove prog_info_linear APIs
Remove prog_info_linear-related APIs previously used by perf. Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Link: https://lore.kernel.org/r/20220627211527.2245459-8-andrii@kernel.org Signed-off-by: Alexei Starovoitov <ast@kernel.org>
This commit is contained in:
committed by
Andrii Nakryiko
parent
d32e7ea952
commit
ec3bbc05c0
66
src/libbpf.h
66
src/libbpf.h
@@ -1396,72 +1396,6 @@ LIBBPF_API int libbpf_probe_bpf_map_type(enum bpf_map_type map_type, const void
|
||||
LIBBPF_API int libbpf_probe_bpf_helper(enum bpf_prog_type prog_type,
|
||||
enum bpf_func_id helper_id, const void *opts);
|
||||
|
||||
/*
|
||||
* Get bpf_prog_info in continuous memory
|
||||
*
|
||||
* struct bpf_prog_info has multiple arrays. The user has option to choose
|
||||
* arrays to fetch from kernel. The following APIs provide an uniform way to
|
||||
* fetch these data. All arrays in bpf_prog_info are stored in a single
|
||||
* continuous memory region. This makes it easy to store the info in a
|
||||
* file.
|
||||
*
|
||||
* Before writing bpf_prog_info_linear to files, it is necessary to
|
||||
* translate pointers in bpf_prog_info to offsets. Helper functions
|
||||
* bpf_program__bpil_addr_to_offs() and bpf_program__bpil_offs_to_addr()
|
||||
* are introduced to switch between pointers and offsets.
|
||||
*
|
||||
* Examples:
|
||||
* # To fetch map_ids and prog_tags:
|
||||
* __u64 arrays = (1UL << BPF_PROG_INFO_MAP_IDS) |
|
||||
* (1UL << BPF_PROG_INFO_PROG_TAGS);
|
||||
* struct bpf_prog_info_linear *info_linear =
|
||||
* bpf_program__get_prog_info_linear(fd, arrays);
|
||||
*
|
||||
* # To save data in file
|
||||
* bpf_program__bpil_addr_to_offs(info_linear);
|
||||
* write(f, info_linear, sizeof(*info_linear) + info_linear->data_len);
|
||||
*
|
||||
* # To read data from file
|
||||
* read(f, info_linear, <proper_size>);
|
||||
* bpf_program__bpil_offs_to_addr(info_linear);
|
||||
*/
|
||||
enum bpf_prog_info_array {
|
||||
BPF_PROG_INFO_FIRST_ARRAY = 0,
|
||||
BPF_PROG_INFO_JITED_INSNS = 0,
|
||||
BPF_PROG_INFO_XLATED_INSNS,
|
||||
BPF_PROG_INFO_MAP_IDS,
|
||||
BPF_PROG_INFO_JITED_KSYMS,
|
||||
BPF_PROG_INFO_JITED_FUNC_LENS,
|
||||
BPF_PROG_INFO_FUNC_INFO,
|
||||
BPF_PROG_INFO_LINE_INFO,
|
||||
BPF_PROG_INFO_JITED_LINE_INFO,
|
||||
BPF_PROG_INFO_PROG_TAGS,
|
||||
BPF_PROG_INFO_LAST_ARRAY,
|
||||
};
|
||||
|
||||
struct bpf_prog_info_linear {
|
||||
/* size of struct bpf_prog_info, when the tool is compiled */
|
||||
__u32 info_len;
|
||||
/* total bytes allocated for data, round up to 8 bytes */
|
||||
__u32 data_len;
|
||||
/* which arrays are included in data */
|
||||
__u64 arrays;
|
||||
struct bpf_prog_info info;
|
||||
__u8 data[];
|
||||
};
|
||||
|
||||
LIBBPF_DEPRECATED_SINCE(0, 6, "use a custom linear prog_info wrapper")
|
||||
LIBBPF_API struct bpf_prog_info_linear *
|
||||
bpf_program__get_prog_info_linear(int fd, __u64 arrays);
|
||||
|
||||
LIBBPF_DEPRECATED_SINCE(0, 6, "use a custom linear prog_info wrapper")
|
||||
LIBBPF_API void
|
||||
bpf_program__bpil_addr_to_offs(struct bpf_prog_info_linear *info_linear);
|
||||
|
||||
LIBBPF_DEPRECATED_SINCE(0, 6, "use a custom linear prog_info wrapper")
|
||||
LIBBPF_API void
|
||||
bpf_program__bpil_offs_to_addr(struct bpf_prog_info_linear *info_linear);
|
||||
|
||||
/**
|
||||
* @brief **libbpf_num_possible_cpus()** is a helper function to get the
|
||||
* number of possible CPUs that the host kernel supports and expects.
|
||||
|
||||
Reference in New Issue
Block a user