Projects
Eulaceura:Factory
A-Tune-BPF-Collection
_service:obs_scm:adapted-libbpf-library-interfa...
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File _service:obs_scm:adapted-libbpf-library-interface-to-fix-build-failure.patch of Package A-Tune-BPF-Collection
From acd74c90cf258fd70bd0c59a441c980b14886686 Mon Sep 17 00:00:00 2001 From: zhoupengcheng <zhoupengcheng11@huawei.com> Date: Mon, 26 Feb 2024 10:27:19 +0800 Subject: [PATCH] adapted-libbpf-library-interface-to-fix-build-failure 1. adapted bpf_prog_load() 2. bpf_object__find_program_by_title() is discarding,Replace bpf_object__find_program_by_name() with bpf_object__find_program_by_title() --- readahead_tune.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/readahead_tune.c b/readahead_tune.c index f07f56e..7ec00ca 100644 --- a/readahead_tune.c +++ b/readahead_tune.c @@ -163,8 +163,13 @@ int main(int argc, char *argv[]) const char *file = "readahead_tune.bpf.o"; struct bpf_object *obj = NULL; unsigned int where = TERM; - int prog_fd = -1; - + + LIBBPF_OPTS(bpf_prog_load_opts, opts); + struct bpf_insn insns[] = { + { BPF_ALU64 | BPF_MOV | BPF_K, BPF_REG_0, 0, 0, 0 }, + { BPF_JMP | BPF_EXIT, 0, 0, 0, 0 }, + }; + int err = argp_parse(&argp, argc, argv, 0, NULL, NULL); if (err) { return err; @@ -188,7 +193,7 @@ int main(int argc, char *argv[]) /* Bump RLIMIT_MEMLOCK to create BPF maps */ bump_memlock_rlimit(where); - err = bpf_prog_load(file, BPF_PROG_TYPE_UNSPEC, &obj, &prog_fd); + err = bpf_prog_load(BPF_PROG_TYPE_UNSPEC, file, "GPL", insns, sizeof(insns)/sizeof(insns[0]), &opts); if (err) { log(where, LOG_ERR, "Failed to load BPF program\n"); return err; @@ -208,7 +213,7 @@ int main(int argc, char *argv[]) } const char *prog_name = "raw_tracepoint.w/" READ_TP_NAME; - struct bpf_program *prog = bpf_object__find_program_by_title(obj, prog_name); + struct bpf_program *prog = bpf_object__find_program_by_name(obj, prog_name); if (!prog) { log(where, LOG_ERR, "Failed to find program %s\n", prog_name); err = -EINVAL; @@ -223,7 +228,7 @@ int main(int argc, char *argv[]) } prog_name = "raw_tracepoint/" RELEASE_TP_NAME; - prog = bpf_object__find_program_by_title(obj, prog_name); + prog = bpf_object__find_program_by_name(obj, prog_name); if (!prog) { log(where, LOG_ERR, "Failed to find program %s\n", prog_name); err = -EINVAL; -- 2.33.0
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2