libbpf-tools: readahead: don't mark struct hist as static
authorJerome Marchand <jmarchan@redhat.com>
Fri, 30 Jul 2021 16:15:05 +0000 (18:15 +0200)
committeryonghong-song <ys114321@gmail.com>
Tue, 3 Aug 2021 00:10:02 +0000 (17:10 -0700)
Libbpf readahead tool does not compile with bpftool v5.14. Since
commit 31332ccb756 ("bpftool: Stop emitting static variables in BPF
skeleton"), bpftool gen skeleton does not include static variables
into the skeleton file anymore.

Fixes the following compilation error:
readahead.c: In function 'main':
readahead.c:153:26: error: 'struct readahead_bpf__bss' has no member named 'hist'
  153 |         histp = &obj->bss->hist;
      |                          ^~

libbpf-tools/readahead.bpf.c

index ba22e534c4ec3ca9742949d422c0e5894a1761a5..b9423c3f9a49382453c843cbc86202da8f1a45bf 100644 (file)
@@ -24,7 +24,7 @@ struct {
        __uint(map_flags, BPF_F_NO_PREALLOC);
 } birth SEC(".maps");
 
-static struct hist hist;
+struct hist hist = {};
 
 SEC("fentry/do_page_cache_ra")
 int BPF_PROG(do_page_cache_ra)