[RFC PATCH v2 10/26] perf bpf: Remove unused code in libbpf
From: He Kuang
Date: Sun Jun 26 2016 - 07:26:56 EST
Clean up unnecessary assignments to local variable 'result.pfd', and
remove 'pfd' field in 'struct bpf_prog_prep_result' since no one else
uses it.
Signed-off-by: He Kuang <hekuang@xxxxxxxxxx>
---
tools/lib/bpf/libbpf.c | 4 ----
tools/lib/bpf/libbpf.h | 3 ---
tools/perf/util/bpf-loader.c | 1 -
3 files changed, 8 deletions(-)
diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
index 462e526..754e460 100644
--- a/tools/lib/bpf/libbpf.c
+++ b/tools/lib/bpf/libbpf.c
@@ -979,8 +979,6 @@ bpf_program__load(struct bpf_program *prog,
pr_debug("Skip loading the %dth instance of program '%s'\n",
i, prog->section_name);
prog->instances.fds[i] = -1;
- if (result.pfd)
- *result.pfd = -1;
continue;
}
@@ -994,8 +992,6 @@ bpf_program__load(struct bpf_program *prog,
goto out;
}
- if (result.pfd)
- *result.pfd = fd;
prog->instances.fds[i] = fd;
}
out:
diff --git a/tools/lib/bpf/libbpf.h b/tools/lib/bpf/libbpf.h
index 722f46b..55f65de 100644
--- a/tools/lib/bpf/libbpf.h
+++ b/tools/lib/bpf/libbpf.h
@@ -125,9 +125,6 @@ struct bpf_prog_prep_result {
*/
struct bpf_insn *new_insn_ptr;
int new_insn_cnt;
-
- /* If not NULL, result fd is set to it */
- int *pfd;
};
/*
diff --git a/tools/perf/util/bpf-loader.c b/tools/perf/util/bpf-loader.c
index dcc8845..2ac73e3 100644
--- a/tools/perf/util/bpf-loader.c
+++ b/tools/perf/util/bpf-loader.c
@@ -429,7 +429,6 @@ preproc_gen_prologue(struct bpf_program *prog, int n,
res->new_insn_ptr = buf;
res->new_insn_cnt = prologue_cnt + orig_insns_cnt;
- res->pfd = NULL;
return 0;
errout:
--
1.8.5.2