1 // SPDX-License-Identifier: GPL-2.0 2 /* Copyright (c) 2023 Isovalent */ 3 4 #include "vmlinux.h" 5 #include <bpf/bpf_helpers.h> 6 #include <bpf/bpf_tracing.h> 7 8 __u32 target_id; 9 10 __s64 bpf_map_sum_elem_count(const struct bpf_map *map) __ksym; 11 12 SEC("iter/bpf_map") dump_bpf_map(struct bpf_iter__bpf_map * ctx)13int dump_bpf_map(struct bpf_iter__bpf_map *ctx) 14 { 15 struct seq_file *seq = ctx->meta->seq; 16 struct bpf_map *map = ctx->map; 17 18 if (map && map->id == target_id) 19 BPF_SEQ_PRINTF(seq, "%lld", bpf_map_sum_elem_count(map)); 20 21 return 0; 22 } 23 24 char _license[] SEC("license") = "GPL"; 25