mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-07-16 15:39:42 -04:00
bpf: pass bpf_struct_ops_link to callbacks in bpf_struct_ops.
Pass an additional pointer of bpf_struct_ops_link to callback function reg, unreg, and update provided by subsystems defined in bpf_struct_ops. A bpf_struct_ops_map can be registered for multiple links. Passing a pointer of bpf_struct_ops_link helps subsystems to distinguish them. This pointer will be used in the later patches to let the subsystem initiate a detachment on a link that was registered to it previously. Signed-off-by: Kui-Feng Lee <thinker.li@gmail.com> Link: https://lore.kernel.org/r/20240530065946.979330-2-thinker.li@gmail.com Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
This commit is contained in:
committed by
Martin KaFai Lau
parent
46253c4ae9
commit
73287fe228
@@ -22,12 +22,12 @@ static int dummy_init_member(const struct btf_type *t,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int dummy_reg(void *kdata)
|
||||
static int dummy_reg(void *kdata, struct bpf_link *link)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void dummy_unreg(void *kdata)
|
||||
static void dummy_unreg(void *kdata, struct bpf_link *link)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -820,7 +820,7 @@ static const struct bpf_verifier_ops bpf_testmod_verifier_ops = {
|
||||
.is_valid_access = bpf_testmod_ops_is_valid_access,
|
||||
};
|
||||
|
||||
static int bpf_dummy_reg(void *kdata)
|
||||
static int bpf_dummy_reg(void *kdata, struct bpf_link *link)
|
||||
{
|
||||
struct bpf_testmod_ops *ops = kdata;
|
||||
|
||||
@@ -835,7 +835,7 @@ static int bpf_dummy_reg(void *kdata)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void bpf_dummy_unreg(void *kdata)
|
||||
static void bpf_dummy_unreg(void *kdata, struct bpf_link *link)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -871,7 +871,7 @@ struct bpf_struct_ops bpf_bpf_testmod_ops = {
|
||||
.owner = THIS_MODULE,
|
||||
};
|
||||
|
||||
static int bpf_dummy_reg2(void *kdata)
|
||||
static int bpf_dummy_reg2(void *kdata, struct bpf_link *link)
|
||||
{
|
||||
struct bpf_testmod_ops2 *ops = kdata;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user