Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758514AbbKHHdN (ORCPT ); Sun, 8 Nov 2015 02:33:13 -0500 Received: from terminus.zytor.com ([198.137.202.10]:46099 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754548AbbKHHdL (ORCPT ); Sun, 8 Nov 2015 02:33:11 -0500 Date: Sat, 7 Nov 2015 23:32:57 -0800 From: tip-bot for Wang Nan Message-ID: Cc: tglx@linutronix.de, namhyung@kernel.org, lizefan@huawei.com, hpa@zytor.com, linux-kernel@vger.kernel.org, wangnan0@huawei.com, mingo@kernel.org, jolsa@kernel.org, acme@redhat.com Reply-To: mingo@kernel.org, jolsa@kernel.org, acme@redhat.com, tglx@linutronix.de, namhyung@kernel.org, lizefan@huawei.com, linux-kernel@vger.kernel.org, hpa@zytor.com, wangnan0@huawei.com In-Reply-To: <1446817783-86722-3-git-send-email-wangnan0@huawei.com> References: <1446817783-86722-3-git-send-email-wangnan0@huawei.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/urgent] bpf tools: Add new API bpf_object__get_kversion () Git-Commit-ID: 45825d8ab8ef6287f5d05aea141419d8d4278852 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2182 Lines: 60 Commit-ID: 45825d8ab8ef6287f5d05aea141419d8d4278852 Gitweb: http://git.kernel.org/tip/45825d8ab8ef6287f5d05aea141419d8d4278852 Author: Wang Nan AuthorDate: Fri, 6 Nov 2015 13:49:38 +0000 Committer: Arnaldo Carvalho de Melo CommitDate: Fri, 6 Nov 2015 15:56:41 -0300 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: Wang Nan Cc: Jiri Olsa Cc: Namhyung Kim Cc: Zefan Li 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 --- 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 07b492d..e176bad 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 30a40e9..c9a9aef 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) \ -- 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/