Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1264533
| From | Arnaldo Carvalho de Melo <acme@kernel.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 05/11] bpf tools: Add new API bpf_object__get_kversion() |
| Date | 2015-11-06 22:00 +0100 |
| Message-ID | <qrWh4-13l-29@gated-at.bofh.it> (permalink) |
| References | <qrWh3-13l-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
From: Wang Nan <wangnan0@huawei.com>
bpf_object__get_kversion() can be used to fetch value of object's
'version' section. Following patch will use it for error reporting.
Signed-off-by: Wang Nan <wangnan0@huawei.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Zefan Li <lizefan@huawei.com>
Cc: pi3orama@163.com
Link: http://lkml.kernel.org/r/1446817783-86722-3-git-send-email-wangnan0@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/lib/bpf/libbpf.c | 8 ++++++++
tools/lib/bpf/libbpf.h | 1 +
2 files changed, 9 insertions(+)
diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
index 07b492d3dfaa..e176bad19bcb 100644
--- a/tools/lib/bpf/libbpf.c
+++ b/tools/lib/bpf/libbpf.c
@@ -1055,6 +1055,14 @@ bpf_object__get_name(struct bpf_object *obj)
return obj->path;
}
+unsigned int
+bpf_object__get_kversion(struct bpf_object *obj)
+{
+ if (!obj)
+ return 0;
+ return obj->kern_version;
+}
+
struct bpf_program *
bpf_program__next(struct bpf_program *prev, struct bpf_object *obj)
{
diff --git a/tools/lib/bpf/libbpf.h b/tools/lib/bpf/libbpf.h
index 30a40e9fa503..c9a9aef2806c 100644
--- a/tools/lib/bpf/libbpf.h
+++ b/tools/lib/bpf/libbpf.h
@@ -56,6 +56,7 @@ void bpf_object__close(struct bpf_object *object);
int bpf_object__load(struct bpf_object *obj);
int bpf_object__unload(struct bpf_object *obj);
const char *bpf_object__get_name(struct bpf_object *obj);
+unsigned int bpf_object__get_kversion(struct bpf_object *obj);
struct bpf_object *bpf_object__next(struct bpf_object *prev);
#define bpf_object__for_each_safe(pos, tmp) \
--
2.1.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[GIT PULL 00/11] perf/core improvements and fixes Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-11-06 22:00 +0100 [PATCH 01/11] perf stat: Make stat options global Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-11-06 22:00 +0100 [PATCH 07/11] perf bpf: Improve BPF related error messages Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-11-06 22:00 +0100 [PATCH 10/11] perf test: Add 'perf test BPF' Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-11-06 22:00 +0100 [PATCH 03/11] perf probe: Cleanup find_perf_probe_point_from_map to reduce redundancy Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-11-06 22:00 +0100 [PATCH 06/11] perf tools: Make fetch_kernel_version() publicly available Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-11-06 22:00 +0100 [PATCH 05/11] bpf tools: Add new API bpf_object__get_kversion() Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-11-06 22:00 +0100 [PATCH 02/11] perf annotate: Inform the user about objdump failures in --stdio Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-11-06 22:00 +0100 [PATCH 11/11] perf test: Do not be case sensitive when searching for matching tests Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-11-06 22:00 +0100 [PATCH 04/11] bpf tools: Improve libbpf error reporting Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-11-06 22:00 +0100 [PATCH 09/11] perf test: Enhance the LLVM tests: add kbuild test Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-11-06 22:00 +0100 Re: [GIT PULL 00/11] perf/core improvements and fixes Ingo Molnar <mingo@kernel.org> - 2015-11-08 08:30 +0100
csiph-web