fix build failure
This commit is contained in:
parent
22560aeff3
commit
9ceda5876d
62
adapted-libbpf-library-interface-to-fix-build-failure.patch
Normal file
62
adapted-libbpf-library-interface-to-fix-build-failure.patch
Normal file
@ -0,0 +1,62 @@
|
||||
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
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
Name: A-Tune-BPF-Collection
|
||||
Version: 1.0.0
|
||||
Release: 6
|
||||
Release: 7
|
||||
License: MulanPSL-2.0
|
||||
Summary: BPF program collection to adjust fine-grained kernel mode to get better performance
|
||||
URL: https://gitee.com/openeuler/A-Tune-BPF-Collection
|
||||
@ -10,6 +10,7 @@ Patch1: remove-spec-file-and-change-start_readahead_tune-s-d.patch
|
||||
Patch2: Drop-using-legacy-BPF-map-declaration.patch
|
||||
Patch3: use-generated-vmlinux.h-instead-of-bpftool-gen-vmlin.patch
|
||||
Patch4: Add-stack-protector-compile-option.patch
|
||||
Patch5: adapted-libbpf-library-interface-to-fix-build-failure.patch
|
||||
|
||||
BuildRequires: clang, llvm, libbpf-devel
|
||||
Requires: libbpf
|
||||
@ -42,6 +43,12 @@ install -D -p -m 0644 readahead_tune.conf %{buildroot}%{_sysconfdir}/sysconfig/r
|
||||
%config(noreplace) %{_sysconfdir}/sysconfig/readahead_tune.conf
|
||||
|
||||
%changelog
|
||||
* Tue Feb 27 2024 zhoupengcheng<zhoupengcheng11@huawei.com> - 1.0.0-7
|
||||
- Type:bugfix
|
||||
- ID:NA
|
||||
- SUG:NA
|
||||
- DESC: adapted libbpf library interface to fix build failure
|
||||
|
||||
* Fri May 5 2023 li-miaomiao_zhr<mmlidc@isoftstone.com> - 1.0.0-6
|
||||
- Type:bugfix
|
||||
- ID:NA
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user