]> 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)
commitf9e1b46f5714a34d83579884cd42c4c6437c3069
tree9c448a2ad2a0e7dc392015e97a0fbd247dd6a7b6
parentd2c30488fc295566cc916b404c4b541ceb0566ce
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