Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753660AbbEQLEh (ORCPT ); Sun, 17 May 2015 07:04:37 -0400 Received: from szxga01-in.huawei.com ([58.251.152.64]:61091 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753226AbbEQK5q (ORCPT ); Sun, 17 May 2015 06:57:46 -0400 From: Wang Nan To: , , , , , , , , , , CC: , , Subject: [RFC PATCH v3 08/37] bpf tools: Define basic interface Date: Sun, 17 May 2015 10:56:33 +0000 Message-ID: <1431860222-61636-9-git-send-email-wangnan0@huawei.com> X-Mailer: git-send-email 1.8.3.4 In-Reply-To: <1431860222-61636-1-git-send-email-wangnan0@huawei.com> References: <1431860222-61636-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 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/