1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright (c) 2020 Facebook */
4 #include <bpf/bpf_helpers.h>
6 char _license[] SEC("license") = "GPL";
8 __u32 map1_id = 0, map2_id = 0;
9 __u32 map1_accessed = 0, map2_accessed = 0;
10 __u64 map1_seqnum = 0, map2_seqnum1 = 0, map2_seqnum2 = 0;
12 static volatile const __u32 print_len;
13 static volatile const __u32 ret1;
16 int dump_bpf_map(struct bpf_iter__bpf_map *ctx)
18 struct seq_file *seq = ctx->meta->seq;
19 struct bpf_map *map = ctx->map;
26 /* only dump map1_id and map2_id */
27 if (map->id != map1_id && map->id != map2_id)
30 seq_num = ctx->meta->seq_num;
31 if (map->id == map1_id) {
32 map1_seqnum = seq_num;
36 if (map->id == map2_id) {
37 if (map2_accessed == 0) {
38 map2_seqnum1 = seq_num;
42 map2_seqnum2 = seq_num;
47 /* fill seq_file buffer */
48 for (i = 0; i < print_len; i++)
49 bpf_seq_write(seq, &seq_num, sizeof(seq_num));