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

From: Thomas Weißschuh
Date: Wed Nov 27 2024 - 14:23:13 EST


The BPF core now allows the registration of read-only ops tables,
make use of it.

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

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,

--
2.47.1