Skip to contentSkip to conversation

tool: ignore file header on lockdebug

PATCH New Alexander Aring 1 participant 1 message Apr 5, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tool: ignore file header on lockdebug

Since kernel commit 5beebc1dda47 ("dlm: update format header reflect current format") the headline of some debugfs entries was updated to the current format so it is possible to lookup what - what is instead of looking up the source code. As side effect there is now an ugly:

print_rsb error rv 2 line "rsb ptr nodeid first_lkid flags !root_list_empty !recover_list_empty recover_locks_count len

in front of every lockdebug dump as dlm_tool parse everything (including the file header). Afterwards the dump proceeds. This patch will ignore the first line of lockdebug in dlm_tool that is not required for lockdebug pretty printout.

---
 dlm_tool/main.c | 5 +++++
 1 file changed, 5 insertions(+)
dlm_tool/main.c +5 -0
index 2e6810d6..5878ebc5 100644
@@ -1085,6 +1085,10 @@ static void do_lockdebug(char *name)
 	memset(&summary, 0, sizeof(struct summary));
 	memset(&info, 0, sizeof(struct rinfo));
 
+	/* skip file header */
+	if (!fgets(line, LOCK_LINE_MAX, file))
+		goto done;
+
 	while (fgets(line, LOCK_LINE_MAX, file)) {
 
 		if (old)
@@ -1114,6 +1118,7 @@ static void do_lockdebug(char *name)
  raw:
 		printf("%s", line);
 	}
+ done:
 	count_rinfo(&summary, &info);
 	clear_rinfo(&info);
 	printf("\n");
Signature · 1 line
2.43.0