libbpf: Skip zeroed or null fields if not found in the kernel type.
authorKui-Feng Lee <thinker.li@gmail.com>
Wed, 13 Mar 2024 21:41:37 +0000 (14:41 -0700)
committerAndrii Nakryiko <andrii@kernel.org>
Thu, 14 Mar 2024 20:47:05 +0000 (13:47 -0700)
commitc911fc61a7ce367f9ea48e457f31bb171e80ca4d
tree80958ee01093375725f14731119423303eee93b0
parent9bf48fa19a4b1d186e08b20bf7e5de26a15644fb
libbpf: Skip zeroed or null fields if not found in the kernel type.

Accept additional fields of a struct_ops type with all zero values even if
these fields are not in the corresponding type in the kernel. This provides
a way to be backward compatible. User space programs can use the same map
on a machine running an old kernel by clearing fields that do not exist in
the kernel.

Signed-off-by: Kui-Feng Lee <thinker.li@gmail.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20240313214139.685112-2-thinker.li@gmail.com
tools/lib/bpf/libbpf.c