#include <linux/bpf-cgroup.h>
#include <linux/bpf.h>
#include <linux/bpf_local_storage.h>
#include <linux/btf.h>
#include <linux/bug.h>
#include <linux/filter.h>
#include <linux/mm.h>
#include <linux/rbtree.h>
#include <linux/slab.h>
#include <uapi/linux/btf.h>
#include <linux/btf_ids.h>
#ifdef CONFIG_CGROUP_BPF
#include "../cgroup/cgroup-internal.h"
#define LOCAL_STORAGE_CREATE_FLAG_MASK …
struct bpf_cgroup_storage_map { … };
static struct bpf_cgroup_storage_map *map_to_storage(struct bpf_map *map)
{ … }
static bool attach_type_isolated(const struct bpf_map *map)
{ … }
static int bpf_cgroup_storage_key_cmp(const struct bpf_cgroup_storage_map *map,
const void *_key1, const void *_key2)
{ … }
struct bpf_cgroup_storage *
cgroup_storage_lookup(struct bpf_cgroup_storage_map *map,
void *key, bool locked)
{ … }
static int cgroup_storage_insert(struct bpf_cgroup_storage_map *map,
struct bpf_cgroup_storage *storage)
{ … }
static void *cgroup_storage_lookup_elem(struct bpf_map *_map, void *key)
{ … }
static long cgroup_storage_update_elem(struct bpf_map *map, void *key,
void *value, u64 flags)
{ … }
int bpf_percpu_cgroup_storage_copy(struct bpf_map *_map, void *key,
void *value)
{ … }
int bpf_percpu_cgroup_storage_update(struct bpf_map *_map, void *key,
void *value, u64 map_flags)
{ … }
static int cgroup_storage_get_next_key(struct bpf_map *_map, void *key,
void *_next_key)
{ … }
static struct bpf_map *cgroup_storage_map_alloc(union bpf_attr *attr)
{ … }
static void cgroup_storage_map_free(struct bpf_map *_map)
{ … }
static long cgroup_storage_delete_elem(struct bpf_map *map, void *key)
{ … }
static int cgroup_storage_check_btf(const struct bpf_map *map,
const struct btf *btf,
const struct btf_type *key_type,
const struct btf_type *value_type)
{ … }
static void cgroup_storage_seq_show_elem(struct bpf_map *map, void *key,
struct seq_file *m)
{ … }
static u64 cgroup_storage_map_usage(const struct bpf_map *map)
{ … }
BTF_ID_LIST_SINGLE(cgroup_storage_map_btf_ids, struct,
bpf_cgroup_storage_map)
const struct bpf_map_ops cgroup_storage_map_ops = …;
int bpf_cgroup_storage_assign(struct bpf_prog_aux *aux, struct bpf_map *_map)
{ … }
static size_t bpf_cgroup_storage_calculate_size(struct bpf_map *map, u32 *pages)
{ … }
struct bpf_cgroup_storage *bpf_cgroup_storage_alloc(struct bpf_prog *prog,
enum bpf_cgroup_storage_type stype)
{ … }
static void free_shared_cgroup_storage_rcu(struct rcu_head *rcu)
{ … }
static void free_percpu_cgroup_storage_rcu(struct rcu_head *rcu)
{ … }
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)
{ … }
void bpf_cgroup_storage_unlink(struct bpf_cgroup_storage *storage)
{ … }
#endif