On Mon, Mar 2, 2020 at 6:50 PM Alexei Starovoitov <alexei.starovoitov@xxxxxxxxx> wrote: > > On Fri, Feb 28, 2020 at 02:39:46PM -0800, Andrii Nakryiko wrote: > > > > +int bpf_link_new_fd(struct bpf_link *link) > > +{ > > + return anon_inode_getfd("bpf-link", &bpf_link_fops, link, O_CLOEXEC); > > +} > ... > > - 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); > ... > > - 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.