Commit 45825d8a authored by Wang Nan's avatar Wang Nan Committed by Arnaldo Carvalho de Melo

bpf tools: Add new API bpf_object__get_kversion()

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: default avatarWang 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.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 6371ca3b
...@@ -1055,6 +1055,14 @@ bpf_object__get_name(struct bpf_object *obj) ...@@ -1055,6 +1055,14 @@ bpf_object__get_name(struct bpf_object *obj)
return obj->path; return obj->path;
} }
unsigned int
bpf_object__get_kversion(struct bpf_object *obj)
{
if (!obj)
return 0;
return obj->kern_version;
}
struct bpf_program * struct bpf_program *
bpf_program__next(struct bpf_program *prev, struct bpf_object *obj) bpf_program__next(struct bpf_program *prev, struct bpf_object *obj)
{ {
......
...@@ -56,6 +56,7 @@ void bpf_object__close(struct bpf_object *object); ...@@ -56,6 +56,7 @@ void bpf_object__close(struct bpf_object *object);
int bpf_object__load(struct bpf_object *obj); int bpf_object__load(struct bpf_object *obj);
int bpf_object__unload(struct bpf_object *obj); int bpf_object__unload(struct bpf_object *obj);
const char *bpf_object__get_name(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); struct bpf_object *bpf_object__next(struct bpf_object *prev);
#define bpf_object__for_each_safe(pos, tmp) \ #define bpf_object__for_each_safe(pos, tmp) \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment