Skip to content

Commit 4867257

Browse files
mrpreKernel Patches Daemon
authored andcommitted
bpftool: Add support for custom BTF path in prog load/loadall
This patch exposes the btf_custom_path feature to bpftool, allowing users to specify a custom BTF file when loading BPF programs using prog load or prog loadall commands. This feature is already supported by libbpf, and this patch makes it accessible through the bpftool command-line interface. Signed-off-by: Jiayuan Chen <[email protected]>
1 parent aaf75a5 commit 4867257

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

tools/bpf/bpftool/prog.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1681,8 +1681,17 @@ static int load_with_options(int argc, char **argv, bool first_prog_only)
16811681
} else if (is_prefix(*argv, "autoattach")) {
16821682
auto_attach = true;
16831683
NEXT_ARG();
1684+
} else if (is_prefix(*argv, "custom_btf")) {
1685+
NEXT_ARG();
1686+
1687+
if (!REQ_ARGS(1))
1688+
goto err_free_reuse_maps;
1689+
1690+
open_opts.btf_custom_path = GET_ARG();
16841691
} else {
1685-
p_err("expected no more arguments, 'type', 'map' or 'dev', got: '%s'?",
1692+
p_err("expected no more arguments, "
1693+
"'type', 'map', 'dev', 'offload_dev', 'xdpmeta_dev', 'pinmaps', "
1694+
"'autoattach', or 'custom_btf', got: '%s'?",
16861695
*argv);
16871696
goto err_free_reuse_maps;
16881697
}

0 commit comments

Comments
 (0)