tools/bpftool: Remove libbpf_internal.h usage in bpftool

Most netlink-related functions were unique to bpftool usage, so I moved them
into net.c. Few functions are still used by both bpftool and libbpf itself
internally, so I've copy-pasted them (libbpf_nl_get_link,
libbpf_netlink_open). It's a bit of duplication of code, but better separation
of libbpf as a library with public API and bpftool, relying on unexposed
functions in libbpf.

Signed-off-by: Andrii Nakryiko <andriin@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20200819013607.3607269-3-andriin@fb.com
This commit is contained in:
Andrii Nakryiko
2020-08-18 18:36:05 -07:00
committed by Alexei Starovoitov
parent 029258d7b2
commit 7084566a23
4 changed files with 288 additions and 150 deletions

View File

@@ -19,11 +19,9 @@
#include <sys/mman.h>
#include <bpf/btf.h>
#include "bpf/libbpf_internal.h"
#include "json_writer.h"
#include "main.h"
#define MAX_OBJ_NAME_LEN 64
static void sanitize_identifier(char *name)