Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0
0002 /* Copyright (c) 2022 Red Hat, Inc. */
0003 #include "bpf_iter.h"
0004 #include <bpf/bpf_helpers.h>
0005 
0006 char _license[] SEC("license") = "GPL";
0007 
0008 SEC("iter/bpf_link")
0009 int dump_bpf_link(struct bpf_iter__bpf_link *ctx)
0010 {
0011     struct seq_file *seq = ctx->meta->seq;
0012     struct bpf_link *link = ctx->link;
0013     int link_id;
0014 
0015     if (!link)
0016         return 0;
0017 
0018     link_id = link->id;
0019     bpf_seq_write(seq, &link_id, sizeof(link_id));
0020     return 0;
0021 }