syscall.c (50c6afabfd2ae91a4ff0e2feb14fe702b0688ec5) syscall.c (9f88361273082825d9f0d13a543d49f9fa0d44a8)
1// SPDX-License-Identifier: GPL-2.0-only
2/* Copyright (c) 2011-2014 PLUMgrid, http://plumgrid.com
3 */
4#include <linux/bpf.h>
5#include <linux/bpf-cgroup.h>
6#include <linux/bpf_trace.h>
7#include <linux/bpf_lirc.h>
8#include <linux/bpf_verifier.h>

--- 4666 unchanged lines hidden (view full) ---

4675 link = ERR_PTR(-EAGAIN);
4676 } else {
4677 link = ERR_PTR(-ENOENT);
4678 }
4679 spin_unlock_bh(&link_idr_lock);
4680 return link;
4681}
4682
1// SPDX-License-Identifier: GPL-2.0-only
2/* Copyright (c) 2011-2014 PLUMgrid, http://plumgrid.com
3 */
4#include <linux/bpf.h>
5#include <linux/bpf-cgroup.h>
6#include <linux/bpf_trace.h>
7#include <linux/bpf_lirc.h>
8#include <linux/bpf_verifier.h>

--- 4666 unchanged lines hidden (view full) ---

4675 link = ERR_PTR(-EAGAIN);
4676 } else {
4677 link = ERR_PTR(-ENOENT);
4678 }
4679 spin_unlock_bh(&link_idr_lock);
4680 return link;
4681}
4682
4683struct bpf_link *bpf_link_get_curr_or_next(u32 *id)
4684{
4685 struct bpf_link *link;
4686
4687 spin_lock_bh(&link_idr_lock);
4688again:
4689 link = idr_get_next(&link_idr, id);
4690 if (link) {
4691 link = bpf_link_inc_not_zero(link);
4692 if (IS_ERR(link)) {
4693 (*id)++;
4694 goto again;
4695 }
4696 }
4697 spin_unlock_bh(&link_idr_lock);
4698
4699 return link;
4700}
4701
4683#define BPF_LINK_GET_FD_BY_ID_LAST_FIELD link_id
4684
4685static int bpf_link_get_fd_by_id(const union bpf_attr *attr)
4686{
4687 struct bpf_link *link;
4688 u32 id = attr->link_id;
4689 int fd;
4690

--- 533 unchanged lines hidden ---
4702#define BPF_LINK_GET_FD_BY_ID_LAST_FIELD link_id
4703
4704static int bpf_link_get_fd_by_id(const union bpf_attr *attr)
4705{
4706 struct bpf_link *link;
4707 u32 id = attr->link_id;
4708 int fd;
4709

--- 533 unchanged lines hidden ---