Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9178b4c1 authored by Jesper Dangaard Brouer's avatar Jesper Dangaard Brouer Committed by David S. Miller
Browse files

samples/bpf: export map_data[] for more info on maps



Giving *_user.c side tools access to map_data[] provides easier
access to information on the maps being loaded.  Still provide
the guarantee that the order maps are being defined in inside the
_kern.c file corresponds with the order in the array.  Now user
tools are not blind, but can inspect and verify the maps that got
loaded from the ELF binary.

Signed-off-by: default avatarJesper Dangaard Brouer <brouer@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 6979bcc7
Loading
Loading
Loading
Loading
+7 −1
Original line number Original line Diff line number Diff line
@@ -24,12 +24,18 @@ struct bpf_map_data {


typedef void (*fixup_map_cb)(struct bpf_map_data *map, int idx);
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 prog_fd[MAX_PROGS];
extern int event_fd[MAX_PROGS];
extern int event_fd[MAX_PROGS];
extern char bpf_log_buf[BPF_LOG_BUF_SIZE];
extern char bpf_log_buf[BPF_LOG_BUF_SIZE];
extern int prog_cnt;
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 elf file compiled by llvm .c->.o
 * . parses 'maps' section and creates maps via BPF syscall
 * . parses 'maps' section and creates maps via BPF syscall
 * . parses 'license' section and passes it to syscall
 * . parses 'license' section and passes it to syscall