0001
0002
0003 #include "bpf_iter.h"
0004 #include <bpf/bpf_helpers.h>
0005
0006 char _license[] SEC("license") = "GPL";
0007
0008 SEC("iter/bpf_map")
0009 int dump_bpf_map(struct bpf_iter__bpf_map *ctx)
0010 {
0011 struct seq_file *seq = ctx->meta->seq;
0012 __u64 seq_num = ctx->meta->seq_num;
0013 struct bpf_map *map = ctx->map;
0014
0015 if (map == (void *)0) {
0016 BPF_SEQ_PRINTF(seq, " %%%%%% END %%%%%%\n");
0017 return 0;
0018 }
0019
0020 if (seq_num == 0)
0021 BPF_SEQ_PRINTF(seq, " id refcnt usercnt locked_vm\n");
0022
0023 BPF_SEQ_PRINTF(seq, "%8u %8ld %8ld %10lu\n", map->id, map->refcnt.counter,
0024 map->usercnt.counter,
0025 0LLU);
0026 return 0;
0027 }