krishnanadh / rpms / rasdaemon

Forked from rpms/rasdaemon a year ago
Clone

Blame SOURCES/0017-ras-mc-ctl-Fix-the-DIMM-layout-display.patch

97e186
From b8bb2ed4a751516d32373e478e5c9ea9f16b524d Mon Sep 17 00:00:00 2001
97e186
From: Mauro Carvalho Chehab <m.chehab@samsung.com>
97e186
Date: Thu, 15 Aug 2013 17:13:43 -0300
97e186
Subject: [PATCH 17/32] ras-mc-ctl: Fix the DIMM layout display
97e186
97e186
The items weren't being presented at the right order. Fix it.
97e186
97e186
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
97e186
---
97e186
 util/ras-mc-ctl.in |   26 ++++++++++++++++++++------
97e186
 1 files changed, 20 insertions(+), 6 deletions(-)
97e186
97e186
diff --git a/util/ras-mc-ctl.in b/util/ras-mc-ctl.in
97e186
index a7137be..196a643 100755
97e186
--- a/util/ras-mc-ctl.in
97e186
+++ b/util/ras-mc-ctl.in
97e186
@@ -673,15 +673,15 @@ sub register_dimm_labels
97e186
     return 1;
97e186
 }
97e186
 
97e186
-sub dimm_display_layer($@);
97e186
+sub dimm_display_layer_rev($@);
97e186
 
97e186
-sub dimm_display_layer($@)
97e186
+sub dimm_display_layer_rev($@)
97e186
 {
97e186
     my $layer = shift;
97e186
     my @pos = @_;
97e186
 
97e186
-    $layer--;
97e186
-    if ($layer < 0) {
97e186
+    $layer++;
97e186
+    if ($layer >= scalar(@pos) - 1) {
97e186
         my $str_loc = join(':', @pos);
97e186
         my $size = $dimm_size{$str_loc};
97e186
         if (!$size) {
97e186
@@ -695,12 +695,26 @@ sub dimm_display_layer($@)
97e186
     my $s;
97e186
     for (my $i = 0; $i <= $max_pos[$layer]; $i++) {
97e186
         $pos[$layer] = $i;
97e186
-        $s .= dimm_display_layer($layer, @pos);
97e186
+        $s .= dimm_display_layer_rev($layer, @pos);
97e186
     }
97e186
 
97e186
     return $s;
97e186
 }
97e186
 
97e186
+sub dimm_display_layer(@)
97e186
+{
97e186
+    my @pos = @_;
97e186
+
97e186
+    my $s;
97e186
+    for (my $i = 0; $i <= $max_pos[0]; $i++) {
97e186
+        $pos[0] = $i;
97e186
+        $s .= dimm_display_layer_rev(0, @pos);
97e186
+    }
97e186
+
97e186
+    return $s;
97e186
+}
97e186
+
97e186
+
97e186
 sub dimm_display_layer_header($$)
97e186
 {
97e186
     my $n_items = 1;
97e186
@@ -753,7 +767,7 @@ sub dimm_display_mem()
97e186
         my $p1 = length($s) - 1;
97e186
 
97e186
         $pos[scalar(@pos) - 1] = $d;
97e186
-        $s .= dimm_display_layer(scalar(@pos) - 1, @pos);
97e186
+        $s .= dimm_display_layer(@pos);
97e186
         $len += length($s);
97e186
 
97e186
         $sep = "-" x $p1;
97e186
-- 
97e186
1.7.1
97e186