Skip to content

Commit b0c9eb3

Browse files
yonghong-songborkmann
authored andcommitted
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: 6b0a249 ("bpf: Implement link_query for bpf iterators") Signed-off-by: Yonghong Song <[email protected]> Signed-off-by: Daniel Borkmann <[email protected]> Acked-by: Andrii Nakryiko <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
1 parent 661b37c commit b0c9eb3

File tree

2 files changed

+8
-4
lines changed
  • include/uapi/linux
  • tools/include/uapi/linux

2 files changed

+8
-4
lines changed

include/uapi/linux/bpf.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4251,8 +4251,10 @@ struct bpf_link_info {
42514251
__aligned_u64 target_name; /* in/out: target_name buffer ptr */
42524252
__u32 target_name_len; /* in/out: target_name buffer len */
42534253
union {
4254-
__u32 map_id;
4255-
} map;
4254+
struct {
4255+
__u32 map_id;
4256+
} map;
4257+
};
42564258
} iter;
42574259
struct {
42584260
__u32 netns_ino;

tools/include/uapi/linux/bpf.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4251,8 +4251,10 @@ struct bpf_link_info {
42514251
__aligned_u64 target_name; /* in/out: target_name buffer ptr */
42524252
__u32 target_name_len; /* in/out: target_name buffer len */
42534253
union {
4254-
__u32 map_id;
4255-
} map;
4254+
struct {
4255+
__u32 map_id;
4256+
} map;
4257+
};
42564258
} iter;
42574259
struct {
42584260
__u32 netns_ino;

0 commit comments

Comments
 (0)