linux/net/bpf/bpf_dummy_struct_ops.c

// SPDX-License-Identifier: GPL-2.0
/*
 * Copyright (C) 2021. Huawei Technologies Co., Ltd
 */
#include <linux/kernel.h>
#include <linux/bpf_verifier.h>
#include <linux/bpf.h>
#include <linux/btf.h>

static struct bpf_struct_ops bpf_bpf_dummy_ops;

/* A common type for test_N with return value in bpf_dummy_ops */
dummy_ops_test_ret_fn;

static int dummy_ops_test_ret_function(struct bpf_dummy_ops_state *state, ...)
{}

struct bpf_dummy_ops_test_args {};

static struct btf *bpf_dummy_ops_btf;

static struct bpf_dummy_ops_test_args *
dummy_ops_init_args(const union bpf_attr *kattr, unsigned int nr)
{}

static int dummy_ops_copy_args(struct bpf_dummy_ops_test_args *args)
{}

static int dummy_ops_call_op(void *image, struct bpf_dummy_ops_test_args *args)
{}

static const struct bpf_ctx_arg_aux *find_ctx_arg_info(struct bpf_prog_aux *aux, int offset)
{}

/* There is only one check at the moment:
 * - zero should not be passed for pointer parameters not marked as nullable.
 */
static int check_test_run_args(struct bpf_prog *prog, struct bpf_dummy_ops_test_args *args)
{}

extern const struct bpf_link_ops bpf_struct_ops_link_lops;

int bpf_struct_ops_test_run(struct bpf_prog *prog, const union bpf_attr *kattr,
			    union bpf_attr __user *uattr)
{}

static int bpf_dummy_init(struct btf *btf)
{}

static bool bpf_dummy_ops_is_valid_access(int off, int size,
					  enum bpf_access_type type,
					  const struct bpf_prog *prog,
					  struct bpf_insn_access_aux *info)
{}

static int bpf_dummy_ops_check_member(const struct btf_type *t,
				      const struct btf_member *member,
				      const struct bpf_prog *prog)
{}

static int bpf_dummy_ops_btf_struct_access(struct bpf_verifier_log *log,
					   const struct bpf_reg_state *reg,
					   int off, int size)
{}

static const struct bpf_verifier_ops bpf_dummy_verifier_ops =;

static int bpf_dummy_init_member(const struct btf_type *t,
				 const struct btf_member *member,
				 void *kdata, const void *udata)
{}

static int bpf_dummy_reg(void *kdata, struct bpf_link *link)
{}

static void bpf_dummy_unreg(void *kdata, struct bpf_link *link)
{}

static int bpf_dummy_ops__test_1(struct bpf_dummy_ops_state *cb__nullable)
{}

static int bpf_dummy_test_2(struct bpf_dummy_ops_state *cb, int a1, unsigned short a2,
			    char a3, unsigned long a4)
{}

static int bpf_dummy_test_sleepable(struct bpf_dummy_ops_state *cb)
{}

static struct bpf_dummy_ops __bpf_bpf_dummy_ops =;

static struct bpf_struct_ops bpf_bpf_dummy_ops =;

static int __init bpf_dummy_struct_ops_init(void)
{}
late_initcall(bpf_dummy_struct_ops_init);