include/linux/bpf-cgroup.h
Source file repositories/reference/linux-study-clean/include/linux/bpf-cgroup.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/bpf-cgroup.h- Extension
.h- Size
- 18500 bytes
- Lines
- 517
- Domain
- Core OS
- Bucket
- Core Kernel Interface
- Inferred role
- Core OS: implementation source
- Status
- source implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/bpf.hlinux/bpf-cgroup-defs.hlinux/errno.hlinux/jump_label.hlinux/percpu.hlinux/rbtree.hnet/sock.huapi/linux/bpf.h
Detected Declarations
struct sockstruct sockaddrstruct cgroupstruct sk_buffstruct bpf_mapstruct bpf_progstruct bpf_sock_ops_kernstruct bpf_cgroup_storagestruct ctl_tablestruct ctl_table_headerstruct task_structstruct bpf_cgroup_storage_mapstruct bpf_storage_bufferstruct bpf_cgroup_storagestruct bpf_cgroup_linkstruct bpf_prog_listfunction to_cgroup_bpf_attach_typefunction cgroup_storage_typefunction cgroup_bpf_sock_enabledfunction cgroup_bpf_lifetime_notifier_initfunction cgroup_bpf_prog_attachfunction cgroup_bpf_prog_detachfunction cgroup_bpf_link_attachfunction cgroup_bpf_prog_queryfunction cgroup_common_func_protofunction bpf_cgroup_storage_assignfunction bpf_cgroup_storage_freefunction bpf_percpu_cgroup_storage_update
Annotated Snippet
struct bpf_storage_buffer {
struct rcu_head rcu;
char data[];
};
struct bpf_cgroup_storage {
union {
struct bpf_storage_buffer *buf;
void __percpu *percpu_buf;
};
struct bpf_cgroup_storage_map *map;
struct bpf_cgroup_storage_key key;
struct list_head list_map;
struct list_head list_cg;
struct rb_node node;
struct rcu_head rcu;
};
struct bpf_cgroup_link {
struct bpf_link link;
struct cgroup *cgroup;
};
struct bpf_prog_list {
struct hlist_node node;
struct bpf_prog *prog;
struct bpf_cgroup_link *link;
struct bpf_cgroup_storage *storage[MAX_BPF_CGROUP_STORAGE_TYPE];
u32 flags;
};
void __init cgroup_bpf_lifetime_notifier_init(void);
int __cgroup_bpf_run_filter_skb(struct sock *sk,
struct sk_buff *skb,
enum cgroup_bpf_attach_type atype);
int __cgroup_bpf_run_filter_sk(struct sock *sk,
enum cgroup_bpf_attach_type atype);
int __cgroup_bpf_run_filter_sock_addr(struct sock *sk,
struct sockaddr_unsized *uaddr,
int *uaddrlen,
enum cgroup_bpf_attach_type atype,
void *t_ctx,
u32 *flags);
int __cgroup_bpf_run_filter_sock_ops(struct sock *sk,
struct bpf_sock_ops_kern *sock_ops,
enum cgroup_bpf_attach_type atype);
int __cgroup_bpf_check_dev_permission(short dev_type, u32 major, u32 minor,
short access, enum cgroup_bpf_attach_type atype);
int __cgroup_bpf_run_filter_sysctl(struct ctl_table_header *head,
const struct ctl_table *table, int write,
char **buf, size_t *pcount, loff_t *ppos,
enum cgroup_bpf_attach_type atype);
int __cgroup_bpf_run_filter_setsockopt(struct sock *sock, int *level,
int *optname, sockptr_t optval,
int *optlen, char **kernel_optval);
int __cgroup_bpf_run_filter_getsockopt(struct sock *sk, int level,
int optname, sockptr_t optval,
sockptr_t optlen, int max_optlen,
int retval);
int __cgroup_bpf_run_filter_getsockopt_kern(struct sock *sk, int level,
int optname, void *optval,
int *optlen, int retval);
static inline enum bpf_cgroup_storage_type cgroup_storage_type(
struct bpf_map *map)
{
if (map->map_type == BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE)
return BPF_CGROUP_STORAGE_PERCPU;
return BPF_CGROUP_STORAGE_SHARED;
}
struct bpf_cgroup_storage *
cgroup_storage_lookup(struct bpf_cgroup_storage_map *map,
void *key, bool locked);
struct bpf_cgroup_storage *bpf_cgroup_storage_alloc(struct bpf_prog *prog,
enum bpf_cgroup_storage_type stype);
void bpf_cgroup_storage_free(struct bpf_cgroup_storage *storage);
void bpf_cgroup_storage_link(struct bpf_cgroup_storage *storage,
struct cgroup *cgroup,
enum bpf_attach_type type);
Annotation
- Immediate include surface: `linux/bpf.h`, `linux/bpf-cgroup-defs.h`, `linux/errno.h`, `linux/jump_label.h`, `linux/percpu.h`, `linux/rbtree.h`, `net/sock.h`, `uapi/linux/bpf.h`.
- Detected declarations: `struct sock`, `struct sockaddr`, `struct cgroup`, `struct sk_buff`, `struct bpf_map`, `struct bpf_prog`, `struct bpf_sock_ops_kern`, `struct bpf_cgroup_storage`, `struct ctl_table`, `struct ctl_table_header`.
- Atlas domain: Core OS / Core Kernel Interface.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.