diff mbox series

[bpf-next,7/9] bpf, net: dummy_ops: Constify BPF ops

Message ID 20241127-bpf-const-ops-v1-7-a698b8d58680@weissschuh.net (mailing list archive)
State New
Headers show
Series bpf: Constify BPF ops | expand

Commit Message

Thomas Weißschuh Nov. 27, 2024, 7:15 p.m. UTC
The BPF core now allows the registration of read-only ops tables,
make use of it.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
 net/bpf/bpf_dummy_struct_ops.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/net/bpf/bpf_dummy_struct_ops.c b/net/bpf/bpf_dummy_struct_ops.c
index 3a675227074e546e6a02e80db3841ed72d5bbff8..b0f3d90f153b34d46fbf37964cc3caf4bec9a4af 100644
--- a/net/bpf/bpf_dummy_struct_ops.c
+++ b/net/bpf/bpf_dummy_struct_ops.c
@@ -7,7 +7,7 @@ 
 #include <linux/bpf.h>
 #include <linux/btf.h>
 
-static struct bpf_struct_ops bpf_bpf_dummy_ops;
+static const struct bpf_struct_ops bpf_bpf_dummy_ops;
 
 /* A common type for test_N with return value in bpf_dummy_ops */
 typedef int (*dummy_ops_test_ret_fn)(struct bpf_dummy_ops_state *state, ...);
@@ -297,13 +297,13 @@  static int bpf_dummy_test_sleepable(struct bpf_dummy_ops_state *cb)
 	return 0;
 }
 
-static struct bpf_dummy_ops __bpf_bpf_dummy_ops = {
+static const struct bpf_dummy_ops __bpf_bpf_dummy_ops = {
 	.test_1 = bpf_dummy_ops__test_1,
 	.test_2 = bpf_dummy_test_2,
 	.test_sleepable = bpf_dummy_test_sleepable,
 };
 
-static struct bpf_struct_ops bpf_bpf_dummy_ops = {
+static const struct bpf_struct_ops bpf_bpf_dummy_ops = {
 	.verifier_ops = &bpf_dummy_verifier_ops,
 	.init = bpf_dummy_init,
 	.check_member = bpf_dummy_ops_check_member,