samples, bpf: Refactor kprobe, tail call kern progs map definition
Because the previous two commit replaced the bpf_load implementation of the user program with libbpf, the corresponding kernel program's MAP definition can be replaced with new BTF-defined map syntax. This commit only updates the samples which uses libbpf API for loading bpf program not with bpf_load. Signed-off-by: Daniel T. Lee <danieltimlee@gmail.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Acked-by: Yonghong Song <yhs@fb.com> Link: https://lore.kernel.org/bpf/20200516040608.1377876-6-danieltimlee@gmail.com
This commit is contained in:

committed by
Daniel Borkmann

parent
14846dda63
commit
59929cd1fe
@@ -15,12 +15,12 @@ struct pair {
|
||||
u64 ip;
|
||||
};
|
||||
|
||||
struct bpf_map_def SEC("maps") my_map = {
|
||||
.type = BPF_MAP_TYPE_HASH,
|
||||
.key_size = sizeof(long),
|
||||
.value_size = sizeof(struct pair),
|
||||
.max_entries = 1000000,
|
||||
};
|
||||
struct {
|
||||
__uint(type, BPF_MAP_TYPE_HASH);
|
||||
__type(key, long);
|
||||
__type(value, struct pair);
|
||||
__uint(max_entries, 1000000);
|
||||
} my_map SEC(".maps");
|
||||
|
||||
/* kprobe is NOT a stable ABI. If kernel internals change this bpf+kprobe
|
||||
* example will no longer be meaningful
|
||||
|
Reference in New Issue
Block a user