]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
bpf: rename MAX_BPF_LINK_TYPE into __MAX_BPF_LINK_TYPE for consistency
authorAndrii Nakryiko <andrii@kernel.org>
Wed, 6 Dec 2023 19:09:20 +0000 (11:09 -0800)
committerAlexei Starovoitov <ast@kernel.org>
Wed, 6 Dec 2023 22:41:16 +0000 (14:41 -0800)
To stay consistent with the naming pattern used for similar cases in BPF
UAPI (__MAX_BPF_ATTACH_TYPE, etc), rename MAX_BPF_LINK_TYPE into
__MAX_BPF_LINK_TYPE.

Also similar to MAX_BPF_ATTACH_TYPE and MAX_BPF_REG, add:

  #define MAX_BPF_LINK_TYPE __MAX_BPF_LINK_TYPE

Not all __MAX_xxx enums have such #define, so I'm not sure if we should
add it or not, but I figured I'll start with a completely backwards
compatible way, and we can drop that, if necessary.

Also adjust a selftest that used MAX_BPF_LINK_TYPE enum.

Suggested-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Acked-by: Yonghong Song <yonghong.song@linux.dev>
Link: https://lore.kernel.org/r/20231206190920.1651226-1-andrii@kernel.org
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
include/uapi/linux/bpf.h
tools/include/uapi/linux/bpf.h
tools/testing/selftests/bpf/prog_tests/libbpf_str.c

index 4df2d025c784526b434bcebc3e1a1e218fa1c48c..e0545201b55f6ddfbdf0c0cce703a40fcd36f4a7 100644 (file)
@@ -1108,9 +1108,11 @@ enum bpf_link_type {
        BPF_LINK_TYPE_TCX = 11,
        BPF_LINK_TYPE_UPROBE_MULTI = 12,
        BPF_LINK_TYPE_NETKIT = 13,
-       MAX_BPF_LINK_TYPE,
+       __MAX_BPF_LINK_TYPE,
 };
 
+#define MAX_BPF_LINK_TYPE __MAX_BPF_LINK_TYPE
+
 enum bpf_perf_event_type {
        BPF_PERF_EVENT_UNSPEC = 0,
        BPF_PERF_EVENT_UPROBE = 1,
index 4df2d025c784526b434bcebc3e1a1e218fa1c48c..e0545201b55f6ddfbdf0c0cce703a40fcd36f4a7 100644 (file)
@@ -1108,9 +1108,11 @@ enum bpf_link_type {
        BPF_LINK_TYPE_TCX = 11,
        BPF_LINK_TYPE_UPROBE_MULTI = 12,
        BPF_LINK_TYPE_NETKIT = 13,
-       MAX_BPF_LINK_TYPE,
+       __MAX_BPF_LINK_TYPE,
 };
 
+#define MAX_BPF_LINK_TYPE __MAX_BPF_LINK_TYPE
+
 enum bpf_perf_event_type {
        BPF_PERF_EVENT_UNSPEC = 0,
        BPF_PERF_EVENT_UPROBE = 1,
index 384bc1f7a65ea039a13136d3fa38050422e62f30..62ea855ec4d04a8947a5aefcb0ed973bdf686af9 100644 (file)
@@ -87,7 +87,7 @@ static void test_libbpf_bpf_link_type_str(void)
                const char *link_type_str;
                char buf[256];
 
-               if (link_type == MAX_BPF_LINK_TYPE)
+               if (link_type == __MAX_BPF_LINK_TYPE)
                        continue;
 
                link_type_name = btf__str_by_offset(btf, e->name_off);