summaryrefslogtreecommitdiff
path: root/tools/bpf/bpftool/prog.c
diff options
context:
space:
mode:
authorKui-Feng Lee <thinker.li@gmail.com>2023-04-19 17:28:21 -0700
committerAlexei Starovoitov <ast@kernel.org>2023-04-21 11:10:10 -0700
commit0232b788978652571c4f4e57dc26ff8e4837926a (patch)
tree96f9779db401ce754b781c8bd47eda57cacd4c24 /tools/bpf/bpftool/prog.c
parent833d67ecdc5f35f1ebf59d0fccc1ce771434be9c (diff)
downloadlinux-0232b788978652571c4f4e57dc26ff8e4837926a.tar.gz
linux-0232b788978652571c4f4e57dc26ff8e4837926a.tar.bz2
linux-0232b788978652571c4f4e57dc26ff8e4837926a.zip
bpftool: Register struct_ops with a link.
You can include an optional path after specifying the object name for the 'struct_ops register' subcommand. Since the commit 226bc6ae6405 ("Merge branch 'Transit between BPF TCP congestion controls.'") has been accepted, it is now possible to create a link for a struct_ops. This can be done by defining a struct_ops in SEC(".struct_ops.link") to make libbpf returns a real link. If we don't pin the links before leaving bpftool, they will disappear. To instruct bpftool to pin the links in a directory with the names of the maps, we need to provide the path of that directory. Signed-off-by: Kui-Feng Lee <kuifeng@meta.com> Reviewed-by: Quentin Monnet <quentin@isovalent.com> Link: https://lore.kernel.org/r/20230420002822.345222-1-kuifeng@meta.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools/bpf/bpftool/prog.c')
-rw-r--r--tools/bpf/bpftool/prog.c13
1 files changed, 0 insertions, 13 deletions
diff --git a/tools/bpf/bpftool/prog.c b/tools/bpf/bpftool/prog.c
index e5b613a7974c..91b6075b2db3 100644
--- a/tools/bpf/bpftool/prog.c
+++ b/tools/bpf/bpftool/prog.c
@@ -1476,19 +1476,6 @@ auto_attach_program(struct bpf_program *prog, const char *path)
return err;
}
-static int pathname_concat(char *buf, size_t buf_sz, const char *path, const char *name)
-{
- int len;
-
- len = snprintf(buf, buf_sz, "%s/%s", path, name);
- if (len < 0)
- return -EINVAL;
- if ((size_t)len >= buf_sz)
- return -ENAMETOOLONG;
-
- return 0;
-}
-
static int
auto_attach_programs(struct bpf_object *obj, const char *path)
{