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

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