OSDN Git Service

libbpf: Consistent prefixes for interfaces in nlattr.h.
authorAndrey Ignatov <rdna@fb.com>
Wed, 3 Oct 2018 22:26:40 +0000 (15:26 -0700)
committerDaniel Borkmann <daniel@iogearbox.net>
Thu, 4 Oct 2018 14:04:16 +0000 (16:04 +0200)
commitf04bc8a436e1b32f842a631ff889954bdf56b720
treec598e9e8e3ea958f2e786da456dce11e3f6bf664
parentaae57780107d92de2463e605cb054656ebd233d1
libbpf: Consistent prefixes for interfaces in nlattr.h.

libbpf is used more and more outside kernel tree. That means the library
should follow good practices in library design and implementation to
play well with third party code that uses it.

One of such practices is to have a common prefix (or a few) for every
interface, function or data structure, library provides. I helps to
avoid name conflicts with other libraries and keeps API consistent.

Inconsistent names in libbpf already cause problems in real life. E.g.
an application can't use both libbpf and libnl due to conflicting
symbols.

Having common prefix will help to fix current and avoid future problems.

libbpf already uses the following prefixes for its interfaces:
* bpf_ for bpf system call wrappers, program/map/elf-object
  abstractions and a few other things;
* btf_ for BTF related API;
* libbpf_ for everything else.

The patch adds libbpf_ prefix to interfaces in nlattr.h that use none of
mentioned above prefixes and doesn't fit well into the first two
categories.

Since affected part of API is used in bpftool, the patch applies
corresponding change to bpftool as well. Having it in a separate patch
will cause a state of tree where bpftool is broken what may not be a
good idea.

Signed-off-by: Andrey Ignatov <rdna@fb.com>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
tools/bpf/bpftool/net.c
tools/bpf/bpftool/netlink_dumper.c
tools/lib/bpf/netlink.c
tools/lib/bpf/nlattr.c
tools/lib/bpf/nlattr.h