Messages in this thread Patch in this message | | | From | Wang Nan <> | Subject | [RFC PATCH v2 07/37] tools lib bpf: defines basic interface. | Date | Fri, 15 May 2015 07:51:00 +0000 |
| |
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@huawei.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
| |