diff --git a/linux-ramdump-parser-v2/parsers/lpm.py b/linux-ramdump-parser-v2/parsers/lpm.py index 5eb94cf28ae7612b8d249a5d83c618fa9988dcbf..e02b13872313e61501099a4a6e3126d58d6b3fc9 100644 --- a/linux-ramdump-parser-v2/parsers/lpm.py +++ b/linux-ramdump-parser-v2/parsers/lpm.py @@ -1,4 +1,4 @@ -# Copyright (c) 2015, The Linux Foundation. All rights reserved. +# Copyright (c) 2015-2016, The Linux Foundation. All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 and @@ -117,10 +117,17 @@ class lpm(RamParser): offset = self.ramdump.field_offset('struct lpm_cluster', 'child_cpus') node = self.ramdump.read_int(lpm_cluster + offset) self.output.append("{:20}:{}({})\n".format("child_cpus", hex(node).rstrip("L"), bin(node).lstrip("0b"))) - - offset = self.ramdump.field_offset('struct lpm_cluster', 'num_childs_in_sync') + if (self.ramdump.kernel_version >= (3, 18, 0) or + self.ramdump.kernel_version < (3, 14, 0) ): + offset = self.ramdump.field_offset( + 'struct lpm_cluster', 'num_children_in_sync') + else: + offset = self.ramdump.field_offset( + 'struct lpm_cluster', 'num_childs_in_sync') node = self.ramdump.read_int(lpm_cluster + offset) - self.output.append("{:20}:{}({})\n".format("num_childs_in_sync", hex(node).rstrip("L"), bin(node).lstrip("0b"))) + self.output.append("{:20}:{}({})\n".format( + "num_children_in_sync", hex(node).rstrip("L"), + bin(node).lstrip("0b"))) self.output.append("\n") def lpm_walker(self, lpm_cluster):