path: root/tools/lib/bpf/libbpf.h
diff options
authorAndrii Nakryiko <andriin@fb.com>2019-12-18 16:28:35 -0800
committerAlexei Starovoitov <ast@kernel.org>2019-12-18 17:33:36 -0800
commit8601fd422148a8f7ff5f7eaf75b6703d5166332c (patch)
treeb490138fcfb50121dbef61121adccbe6d546172b /tools/lib/bpf/libbpf.h
parentlibbpf: Put Kconfig externs into .kconfig section (diff)
libbpf: Allow to augment system Kconfig through extra optional config
Instead of all or nothing approach of overriding Kconfig file location, allow to extend it with extra values and override chosen subset of values though optional user-provided extra config, passed as a string through open options' .kconfig option. If same config key is present in both user-supplied config and Kconfig, user-supplied one wins. This allows applications to more easily test various conditions despite host kernel's real configuration. If all of BPF object's __kconfig externs are satisfied from user-supplied config, system Kconfig won't be read at all. Simplify selftests by not needing to create temporary Kconfig files. Suggested-by: Alexei Starovoitov <ast@fb.com> Signed-off-by: Andrii Nakryiko <andriin@fb.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Link: https://lore.kernel.org/bpf/20191219002837.3074619-3-andriin@fb.com
Diffstat (limited to '')
1 files changed, 4 insertions, 4 deletions
diff --git a/tools/lib/bpf/libbpf.h b/tools/lib/bpf/libbpf.h
index ad8c1c127933..fe592ef48f1b 100644
--- a/tools/lib/bpf/libbpf.h
+++ b/tools/lib/bpf/libbpf.h
@@ -85,12 +85,12 @@ struct bpf_object_open_opts {
const char *pin_root_path;
__u32 attach_prog_fd;
- /* kernel config file path override (for CONFIG_ externs); can point
- * to either uncompressed text file or .gz file
+ /* Additional kernel config content that augments and overrides
+ * system Kconfig for CONFIG_xxx externs.
- const char *kconfig_path;
+ const char *kconfig;
-#define bpf_object_open_opts__last_field kconfig_path
+#define bpf_object_open_opts__last_field kconfig
LIBBPF_API struct bpf_object *bpf_object__open(const char *path);
LIBBPF_API struct bpf_object *