Skip to contentSkip to conversation

libbpf: add libbpf_set_strict_mode() API to turn on libbpf 1.0 behaviors

PATCH Superseded Andrii Nakryiko 1 participant 1 message May 21, 2021

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Andrii Nakryiko

author maintainer
#0 lore raw

PATCH 1/5 libbpf: add libbpf_set_strict_mode() API to turn on libbpf 1.0 behaviors

Add libbpf_set_strict_mode() API that allows application to simulate libbpf 1.0 breaking changes before libbpf 1.0 is released. This will help users migrate gradually and with confidence.

For now only ALL or NONE options are available, subsequent patches will add more flags. This patch is preliminary for selftests/bpf changes.

---
 tools/lib/bpf/Makefile        |  1 +
 tools/lib/bpf/libbpf.h        |  1 +
 tools/lib/bpf/libbpf.map      |  5 ++++
 tools/lib/bpf/libbpf_legacy.h | 47 +++++++++++++++++++++++++++++++++++
 4 files changed, 54 insertions(+)
 create mode 100644 tools/lib/bpf/libbpf_legacy.h
tools/lib/bpf/Makefile +1 -0
index e43e1896cb4b..15420303cf06 100644
@@ -229,6 +229,7 @@ install_headers: $(BPF_HELPER_DEFS)
 		$(call do_install,libbpf.h,$(prefix)/include/bpf,644); \
 		$(call do_install,btf.h,$(prefix)/include/bpf,644); \
 		$(call do_install,libbpf_common.h,$(prefix)/include/bpf,644); \
+		$(call do_install,libbpf_legacy.h,$(prefix)/include/bpf,644); \
 		$(call do_install,xsk.h,$(prefix)/include/bpf,644); \
 		$(call do_install,bpf_helpers.h,$(prefix)/include/bpf,644); \
 		$(call do_install,$(BPF_HELPER_DEFS),$(prefix)/include/bpf,644); \
tools/lib/bpf/libbpf.h +1 -0
index d98523558f39..6e61342ba56c 100644
@@ -18,6 +18,7 @@
 #include <linux/bpf.h>
 
 #include "libbpf_common.h"
+#include "libbpf_legacy.h"
 
 #ifdef __cplusplus
 extern "C" {
tools/lib/bpf/libbpf.map +5 -0
index 2abef6f17c06..6c8c16d4c628 100644
@@ -369,3 +369,8 @@ LIBBPF_0.4.0 {
 		bpf_tc_hook_destroy;
 		bpf_tc_query;
 } LIBBPF_0.3.0;
+
+LIBBPF_0.5.0 {
+	global:
+		libbpf_set_strict_mode;
+} LIBBPF_0.4.0;
tools/lib/bpf/libbpf_legacy.h new file +47 -0

47 lines not on this page · raw message

Signature · 1 line
2.30.2