rv/monitors: Move monitor structure in rodata
authorAlessandro Carminati <acarmina@redhat.com>
Tue, 22 Nov 2022 17:36:48 +0000 (18:36 +0100)
committerSteven Rostedt (Google) <rostedt@goodmis.org>
Tue, 20 Dec 2022 16:46:40 +0000 (11:46 -0500)
It makes sense to move the important monitor structure into rodata to
prevent accidental structure modification.

Link: https://lkml.kernel.org/r/20221122173648.4732-1-acarmina@redhat.com
Signed-off-by: Alessandro Carminati <acarmina@redhat.com>
Acked-by: Daniel Bristot de Oliveira <bristot@kernel.org>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
kernel/trace/rv/monitors/wip/wip.h
kernel/trace/rv/monitors/wwnr/wwnr.h
tools/verification/dot2/dot2c.py

index dacc37b62a2c5d675fef631a92f626189d5e95d9..2e373f2c65ed74c8639f9d703b7c1d40c78ffd9f 100644 (file)
@@ -27,7 +27,7 @@ struct automaton_wip {
        bool final_states[state_max_wip];
 };
 
-static struct automaton_wip automaton_wip = {
+static const struct automaton_wip automaton_wip = {
        .state_names = {
                "preemptive",
                "non_preemptive"
index 118e576b91b4b1414d39522eb0d8307032379e67..d0d9c4b8121b5162e92725017dd39d1f8a76c7ce 100644 (file)
@@ -27,7 +27,7 @@ struct automaton_wwnr {
        bool final_states[state_max_wwnr];
 };
 
-static struct automaton_wwnr automaton_wwnr = {
+static const struct automaton_wwnr automaton_wwnr = {
        .state_names = {
                "not_running",
                "running"
index be8a364a469b98bf30e39fc96839e0fb8eefc127..87d8a1e1470c6b9f7956deed99dfe68cbc4cf89f 100644 (file)
@@ -111,7 +111,7 @@ class Dot2c(Automata):
 
     def format_aut_init_header(self):
         buff = []
-        buff.append("static struct %s %s = {" % (self.struct_automaton_def, self.var_automaton_def))
+        buff.append("static const struct %s %s = {" % (self.struct_automaton_def, self.var_automaton_def))
         return buff
 
     def __get_string_vector_per_line_content(self, buff):