]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: Emit bpf_timer in vmlinux BTF
authorYonghong Song <yhs@fb.com>
Fri, 11 Feb 2022 19:49:48 +0000 (11:49 -0800)
committerAlexei Starovoitov <ast@kernel.org>
Fri, 11 Feb 2022 21:21:47 +0000 (13:21 -0800)
commit89db4abffaf27140087227a5a0a7bfae5ebf76a3
treeda6ca95ebff9eb46e37000d5d8aded9c722bf6f2
parent61847181df0cc1ebdc950d977ece3a4282222ea2
bpf: Emit bpf_timer in vmlinux BTF

Currently the following code in check_and_init_map_value()
  *(struct bpf_timer *)(dst + map->timer_off) =
      (struct bpf_timer){};
can help generate bpf_timer definition in vmlinuxBTF.
But the code above may not zero the whole structure
due to anonymour members and that code will be replaced
by memset in the subsequent patch and
bpf_timer definition will disappear from vmlinuxBTF.
Let us emit the type explicitly so bpf program can continue
to use it from vmlinux.h.

Signed-off-by: Yonghong Song <yhs@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20220211194948.3141529-1-yhs@fb.com
kernel/bpf/helpers.c