Skip to contentSkip to conversation

rv/dot2c: Make automaton definition static

PATCH In review Daniel Bristot de Oliveira 2 participants 6 messages Aug 23, 2022 – Oct 20, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 rv/dot2c: Make automaton definition static

Monitor's automata definition is only used locally, so make dot2c generate a static definition.

Cc Steven Rostedt <[email protected]>
Fixes e3c9fc78f096 ("tools/rv: Add dot2c")
---
 tools/verification/dot2/dot2c.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/verification/dot2/dot2c.py +1 -1
index fa73353f7e56..be8a364a469b 100644
@@ -111,7 +111,7 @@ class Dot2c(Automata):
 
     def format_aut_init_header(self):
         buff = []
-        buff.append("struct %s %s = {" % (self.struct_automaton_def, self.var_automaton_def))
+        buff.append("static struct %s %s = {" % (self.struct_automaton_def, self.var_automaton_def))
         return buff
 
     def __get_string_vector_per_line_content(self, buff):
Signature · 1 line
2.35.1
#1 lore raw

PATCH 2/2 rv/monitors: Make monitor's automata definition static

Monitor's automata definition is only used locally, so make them static for all existing monitors.

Cc Steven Rostedt <[email protected]>
Fixes ccc319dcb450 ("rv/monitor: Add the wwnr monitor")
Fixes 8812d21219b9 ("rv/monitor: Add the wip monitor skeleton created by dot2k")
---
 kernel/trace/rv/monitors/wip/wip.h   | 2 +-
 kernel/trace/rv/monitors/wwnr/wwnr.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
kernel/trace/rv/monitors/wip/wip.h +1 -1
index c1c47e2305ef..dacc37b62a2c 100644
@@ -27,7 +27,7 @@ struct automaton_wip {
 	bool final_states[state_max_wip];
 };
 
-struct automaton_wip automaton_wip = {
+static struct automaton_wip automaton_wip = {
 	.state_names = {
 		"preemptive",
 		"non_preemptive"
kernel/trace/rv/monitors/wwnr/wwnr.h +1 -1
index d1afe55cdd4c..118e576b91b4 100644
@@ -27,7 +27,7 @@ struct automaton_wwnr {
 	bool final_states[state_max_wwnr];
 };
 
-struct automaton_wwnr automaton_wwnr = {
+static struct automaton_wwnr automaton_wwnr = {
 	.state_names = {
 		"not_running",
 		"running"
Signature · 1 line
2.35.1
maintainer
#2 lore raw
In reply to Daniel Bristot de Oliveira
Quoted 6 lines · On Tue, 23 Aug 2022 17:20:28 +0200 Daniel Bristot de Oliveira…

Monitor's automata definition is only used locally, so make dot2c generate a static definition.

Somehow this fell through the cracks.

Daniel, is there any reason I shouldn't pull this in now?

-- Steve

Quoted 21 lines
Cc Steven Rostedt <[email protected]>
Fixes e3c9fc78f096 ("tools/rv: Add dot2c")
---
 tools/verification/dot2/dot2c.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/verification/dot2/dot2c.py +1 -1
index fa73353f7e56..be8a364a469b 100644
@@ -111,7 +111,7 @@ class Dot2c(Automata):
 
     def format_aut_init_header(self):
         buff = []
-        buff.append("struct %s %s = {" % (self.struct_automaton_def, self.var_automaton_def))
+        buff.append("static struct %s %s = {" % (self.struct_automaton_def, self.var_automaton_def))
         return buff
 
     def __get_string_vector_per_line_content(self, buff):
maintainer
#3 lore raw
Quoted 6 lines · On Tue, 18 Oct 2022 18:25:53 -0400 Steven Rostedt <[email protected]> wrote:
Quoted 3 lines · On Tue, 23 Aug 2022 17:20:28 +0200 Daniel Bristot de Oliveira…

Monitor's automata definition is only used locally, so make dot2c generate a static definition.

Quoted 7 lines
Quoted 3 lines

Somehow this fell through the cracks.

Daniel, is there any reason I shouldn't pull this in now?

I think when I applied:

https://patchwork.kernel.org/project/linux-trace-devel/patch/a50e27c3738d6ef809f4201857229fed64799234.1661266564.git.bristot@kernel.org/

I mistook that to be a new version of this patch.

-- Steve

#4 lore raw
In reply to Steven Rostedt
Quoted 6 lines · Steven Rostedt
Quoted 3 lines · On Tue, 23 Aug 2022 17:20:28 +0200 Daniel Bristot de Oliveira…

Monitor's automata definition is only used locally, so make dot2c generate a static definition.

Quoted 6 lines
Quoted 3 lines

Somehow this fell through the cracks.

Daniel, is there any reason I shouldn't pull this in now?

Oops... yes, it can be pulled.

-- Daniel

maintainer
#5 lore raw
Quoted 7 lines · On Wed, 19 Oct 2022 15:15:54 +0200 Daniel Bristot de Oliveira…
Quoted 6 lines · Steven Rostedt
Quoted 3 lines · On Tue, 23 Aug 2022 17:20:28 +0200 Daniel Bristot de Oliveira…

Monitor's automata definition is only used locally, so make dot2c generate a static definition.

Quoted 9 lines
Quoted 6 lines
Quoted 3 lines

Somehow this fell through the cracks.

Daniel, is there any reason I shouldn't pull this in now?

Oops... yes, it can be pulled.

OK, I'm going to push this up as tools/urgent and send a pull request to Linus.

-- Steve