Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964944AbbEOH6e (ORCPT ); Fri, 15 May 2015 03:58:34 -0400 Received: from szxga03-in.huawei.com ([119.145.14.66]:13518 "EHLO szxga03-in.huawei.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S934283AbbEOHwt (ORCPT ); Fri, 15 May 2015 03:52:49 -0400 From: Wang Nan To: , , , , , , , , , , , CC: , , , Subject: [RFC PATCH v2 07/37] tools lib bpf: defines basic interface. Date: Fri, 15 May 2015 07:51:00 +0000 Message-ID: <1431676290-1230-8-git-send-email-wangnan0@huawei.com> X-Mailer: git-send-email 1.8.3.4 In-Reply-To: <1431676290-1230-1-git-send-email-wangnan0@huawei.com> References: <1431676290-1230-1-git-send-email-wangnan0@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.107.197.200] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020202.5555A599.007B,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2013-05-26 15:14:31, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: f798a59b624ca0074b469b3495f0903b Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1747 Lines: 65 bpf_open_object() and bpf_close_object() are open and close function of eBPF object files. 'struct bpf_object' will be handler of one object file. Its internal structure is hide to user. Signed-off-by: Wang Nan --- tools/lib/bpf/libbpf.c | 11 +++++++++++ tools/lib/bpf/libbpf.h | 8 ++++++++ 2 files changed, 19 insertions(+) diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c index d7a7869..f8decff 100644 --- a/tools/lib/bpf/libbpf.c +++ b/tools/lib/bpf/libbpf.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include @@ -56,3 +57,13 @@ void libbpf_set_print(int (*warn)(const char *format, ...), __pr_info = info; __pr_debug = debug; } + +struct bpf_object *bpf_open_object(const char *path) +{ + return NULL; +} + +void bpf_close_object(struct bpf_object *object) +{ + return 0; +} diff --git a/tools/lib/bpf/libbpf.h b/tools/lib/bpf/libbpf.h index eb306c0..e523ae9 100644 --- a/tools/lib/bpf/libbpf.h +++ b/tools/lib/bpf/libbpf.h @@ -9,8 +9,16 @@ #ifndef __BPF_LIBBPF_H #define __BPF_LIBBPF_H +#include + void libbpf_set_print(int (*warn)(const char *format, ...), int (*info)(const char *format, ...), int (*debug)(const char *format, ...)); +/* Hide internal to user */ +struct bpf_object; + +struct bpf_object *bpf_open_object(const char *path); +void bpf_close_object(struct bpf_object *object); + #endif -- 1.8.3.4 -- 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/