]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: Make bpf_link_info.iter similar to bpf_iter_link_info
authorYonghong Song <yhs@fb.com>
Fri, 28 Aug 2020 05:19:22 +0000 (22:19 -0700)
committerDaniel Borkmann <daniel@iogearbox.net>
Fri, 28 Aug 2020 12:33:24 +0000 (14:33 +0200)
commit8ec440bdfe88e469430b3373aed0723e623ecc92
treeba3ab56b0661dd01c0de5432e344c975ff4495ff
parentaa916c00331f8c8e1e4287fc49ef9c8825a7b6e9
bpf: Make bpf_link_info.iter similar to bpf_iter_link_info

bpf_link_info.iter is used by link_query to return bpf_iter_link_info
to user space. Fields may be different, e.g., map_fd vs. map_id, so
we cannot reuse the exact structure. But make them similar, e.g.,

  struct bpf_link_info {
     /* common fields */
     union {
struct { ... } raw_tracepoint;
struct { ... } tracing;
...
struct {
    /* common fields for iter */
    union {
struct {
    __u32 map_id;
} map;
/* other structs for other targets */
    };
};
    };
 };

so the structure is extensible the same way as bpf_iter_link_info.

Fixes: d5e2ebe5189a ("bpf: Implement link_query for bpf iterators")
Signed-off-by: Yonghong Song <yhs@fb.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Andrii Nakryiko <andriin@fb.com>
Link: https://lore.kernel.org/bpf/20200828051922.758950-1-yhs@fb.com
include/uapi/linux/bpf.h
tools/include/uapi/linux/bpf.h