]> git.baikalelectronics.ru Git - kernel.git/commit
libbpf: Add setter for initial value for internal maps
authorToke Høiland-Jørgensen <toke@redhat.com>
Sun, 29 Mar 2020 13:22:52 +0000 (15:22 +0200)
committerDaniel Borkmann <daniel@iogearbox.net>
Sun, 29 Mar 2020 23:17:05 +0000 (01:17 +0200)
commit8a1a2531f237bdc95ea26fe01f3e239ded1670b8
tree9c448a2ad2a0e7dc392015e97a0fbd247dd6a7b6
parentd67fa23d8a8e428a8670daf2282b25dfda8d2e4d
libbpf: Add setter for initial value for internal maps

For internal maps (most notably the maps backing global variables), libbpf
uses an internal mmaped area to store the data after opening the object.
This data is subsequently copied into the kernel map when the object is
loaded.

This adds a function to set a new value for that data, which can be used to
before it is loaded into the kernel. This is especially relevant for RODATA
maps, since those are frozen on load.

Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Andrii Nakryiko <andriin@fb.com>
Link: https://lore.kernel.org/bpf/20200329132253.232541-1-toke@redhat.com
tools/lib/bpf/libbpf.c
tools/lib/bpf/libbpf.h
tools/lib/bpf/libbpf.map