[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1431860222-61636-9-git-send-email-wangnan0@huawei.com>
Date: Sun, 17 May 2015 10:56:33 +0000
From: Wang Nan <wangnan0@...wei.com>
To: <paulus@...ba.org>, <a.p.zijlstra@...llo.nl>, <mingo@...hat.com>,
<acme@...nel.org>, <namhyung@...nel.org>, <jolsa@...nel.org>,
<dsahern@...il.com>, <ast@...mgrid.com>, <daniel@...earbox.net>,
<brendan.d.gregg@...il.com>, <masami.hiramatsu.pt@...achi.com>
CC: <lizefan@...wei.com>, <linux-kernel@...r.kernel.org>,
<pi3orama@....com>
Subject: [RFC PATCH v3 08/37] bpf tools: Define basic interface
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 <wangnan0@...wei.com>
---
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 <stdarg.h>
#include <string.h>
#include <unistd.h>
+#include <errno.h>
#include <asm/unistd.h>
#include <linux/bpf.h>
@@ -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 <stdio.h>
+
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@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists