Re: [PATCH bpf-next 1/3] bpf: introduce pinnable bpf_link abstraction
From: Andrii Nakryiko <hidden>
Date: 2020-03-03 04:18:15
Also in:
bpf
From: Andrii Nakryiko <hidden>
Date: 2020-03-03 04:18:15
Also in:
bpf
On Mon, Mar 2, 2020 at 6:50 PM Alexei Starovoitov [off-list ref] wrote:
On Fri, Feb 28, 2020 at 02:39:46PM -0800, Andrii Nakryiko wrote:quoted
+int bpf_link_new_fd(struct bpf_link *link) +{ + return anon_inode_getfd("bpf-link", &bpf_link_fops, link, O_CLOEXEC); +}...quoted
- tr_fd = anon_inode_getfd("bpf-tracing-prog", &bpf_tracing_prog_fops, - prog, O_CLOEXEC); + tr_fd = anon_inode_getfd("bpf-tracing-link", &bpf_link_fops, + &link->link, O_CLOEXEC);...quoted
- tp_fd = anon_inode_getfd("bpf-raw-tracepoint", &bpf_raw_tp_fops, raw_tp, - O_CLOEXEC); + tp_fd = anon_inode_getfd("bpf-raw-tp-link", &bpf_link_fops, + &raw_tp->link, O_CLOEXEC);I don't think different names are strong enough reason to open code it. I think bpf_link_new_fd() should be used in all cases.
Oh, this got simplified from initial implementation after few rounds of refactorings and I didn't notice that now I can just use bpf_link_new_fd() here. Will update.