diff options
Diffstat (limited to 'samples/bpf/bpf_load.h')
-rw-r--r-- | samples/bpf/bpf_load.h | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/samples/bpf/bpf_load.h b/samples/bpf/bpf_load.h index 05822f83173a..ca0563d04744 100644 --- a/samples/bpf/bpf_load.h +++ b/samples/bpf/bpf_load.h @@ -15,15 +15,27 @@ struct bpf_map_def { unsigned int inner_map_idx; }; -typedef void (*fixup_map_cb)(struct bpf_map_def *map, const char *map_name, - int idx); +struct bpf_map_data { + int fd; + char *name; + size_t elf_offset; + struct bpf_map_def def; +}; + +typedef void (*fixup_map_cb)(struct bpf_map_data *map, int idx); -extern int map_fd[MAX_MAPS]; extern int prog_fd[MAX_PROGS]; extern int event_fd[MAX_PROGS]; extern char bpf_log_buf[BPF_LOG_BUF_SIZE]; extern int prog_cnt; +/* There is a one-to-one mapping between map_fd[] and map_data[]. + * The map_data[] just contains more rich info on the given map. + */ +extern int map_fd[MAX_MAPS]; +extern struct bpf_map_data map_data[MAX_MAPS]; +extern int map_data_count; + /* parses elf file compiled by llvm .c->.o * . parses 'maps' section and creates maps via BPF syscall * . parses 'license' section and passes it to syscall |