rasdaemon: ras-mc-ctl: Fix script to parse dimm sizes

Started by Naveen Krishna Chatradhi on Aug 10, 2021

Subsystems (1)

Maintainers (1)

DORMANTno replies

open the first message on its own page

Message details and related content
From: Muralidhara M K <redacted>

This patch removes trailing spaces at the end of a line from
file location and fixes --layout option to parse dimm nodes
to get the size from ras-mc-ctl.

Issue is reported https://github.com/mchehab/rasdaemon/issues/43
Where '> ras-mc-ctl --layout' reports all 0s

With this change the layout prints the correct dimm sizes
sudo ras-mc-ctl --layout
          +-----------------------------------------------+
          |                      mc0                      |
          |  csrow0   |  csrow1   |  csrow2   |  csrow3   |
----------+-----------------------------------------------+
...
channel7: |  16384 MB  |     0 MB  |     0 MB  |     0 MB |
channel6: |  16384 MB  |     0 MB  |     0 MB  |     0 MB |
...
----------+-----------------------------------------------+

Signed-off-by: Muralidhara M K <redacted>
Signed-off-by: Naveen Krishna Chatradhi <redacted>
---
 util/ras-mc-ctl.in | 2 ++
 1 file changed, 2 insertions(+)
diff --git a/util/ras-mc-ctl.in b/util/ras-mc-ctl.in
index 1e3aeb7..b22dd60 100755
--- a/util/ras-mc-ctl.in
+++ b/util/ras-mc-ctl.in
@@ -246,6 +246,7 @@ sub parse_dimm_nodes
     if (($file =~ /max_location$/)) {
         open IN, $file;
         my $location = <IN>;
+        $location =~ s/\s+$//;
         close IN;
         my @temp = split(/ /, $location);
 
@@ -288,6 +289,7 @@ sub parse_dimm_nodes
 
         open IN, $file;
         my $location = <IN>;
+        $location =~ s/\s+$//;
         close IN;
 
         my @pos;
-- 
2.26.2
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help