diff --git a/linux-ramdump-parser-v2/dmesglib.py b/linux-ramdump-parser-v2/dmesglib.py index 2375f59f4f2d6145de43ad1b99b08400990be673..8275b31a6952e5e61b24bf997d2652ceb048afca 100644 --- a/linux-ramdump-parser-v2/dmesglib.py +++ b/linux-ramdump-parser-v2/dmesglib.py @@ -1,4 +1,4 @@ -# Copyright (c) 2014, The Linux Foundation. All rights reserved. +# Copyright (c) 2014-2015, 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 @@ -132,10 +132,8 @@ class DmesgLib(object): curr_idx = self.verify_log(curr_idx, logbuf_addr, last_idx) def extract_dmesg(self): - match = re.search('(\d+)\.(\d+)\.(\d+)', self.ramdump.version) - if match is not None: - major, minor, patch = map(int, match.groups()) - if (major, minor) >= (3, 7): - self.extract_dmesg_binary() - return + major, minor, patch = self.ramdump.kernel_version + if (major, minor) >= (3, 7): + self.extract_dmesg_binary() + return self.extract_dmesg_flat() diff --git a/linux-ramdump-parser-v2/parsers/irqstate.py b/linux-ramdump-parser-v2/parsers/irqstate.py index fb94c9a69a42f97548be1d507e186125d088aa7b..ec428646a0797c9a0229a6a926a1e5762d245063 100755 --- a/linux-ramdump-parser-v2/parsers/irqstate.py +++ b/linux-ramdump-parser-v2/parsers/irqstate.py @@ -74,7 +74,7 @@ class IrqParse(RamParser): def radix_tree_lookup_element(self, ram_dump, root_addr, index): rnode_offset = ram_dump.field_offset('struct radix_tree_root', 'rnode') - if (ram_dump.major[0], ram_dump.major[1]) >= (3, 18): + if (ram_dump.kernel_version[0], ram_dump.kernel_version[1]) >= (3, 18): rnode_height_offset = ram_dump.field_offset( 'struct radix_tree_node', 'path') else: @@ -98,7 +98,7 @@ class IrqParse(RamParser): node_addr = ram_dump.read_word(root_addr + rnode_offset) & 0xfffffffffffffffe height = ram_dump.read_int(node_addr + rnode_height_offset) - if (ram_dump.major[0], ram_dump.major[1]) >= (3, 18): + if (ram_dump.kernel_version[0], ram_dump.kernel_version[1]) >= (3, 18): height = height & radix_tree_height_mask if height > len(height_to_maxindex): diff --git a/linux-ramdump-parser-v2/parsers/vmalloc.py b/linux-ramdump-parser-v2/parsers/vmalloc.py index 54ff28e589b7a87ab14d12d002db18276ce93b0c..062b7406333939a66249b4211ca8ea834269b234 100644 --- a/linux-ramdump-parser-v2/parsers/vmalloc.py +++ b/linux-ramdump-parser-v2/parsers/vmalloc.py @@ -1,4 +1,4 @@ -# Copyright (c) 2012-2014, The Linux Foundation. All rights reserved. +# Copyright (c) 2012-2015, 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 @@ -120,8 +120,8 @@ class Vmalloc(RamParser): def parse(self): out_path = self.ramdump.outdir - ver = self.ramdump.version - if re.search('3\.10\.\d', ver) is not None: + major, minor, patch = self.ramdump.kernel_version + if (major, minor) == (3, 10): self.print_vmalloc_info_3_10(out_path) else: self.print_vmalloc_info(out_path) diff --git a/linux-ramdump-parser-v2/parsers/workqueue.py b/linux-ramdump-parser-v2/parsers/workqueue.py index dcecd4297b8c7141da5456d3f92fb84dea0e5774..5df616d28c099852c8b807d7dfa9dec76d25b911 100644 --- a/linux-ramdump-parser-v2/parsers/workqueue.py +++ b/linux-ramdump-parser-v2/parsers/workqueue.py @@ -440,9 +440,7 @@ class Workqueues(RamParser): pending_list.walk(self.ramdump.read_word(worklist_addr), self.pending_list_walk) def parse(self): - ver = self.ramdump.version - match = re.search('(\d+)\.(\d+)\.(\d+)', ver) - major, minor, patch = map(int, match.groups()) + major, minor, patch = self.ramdump.kernel_version if (major, minor) == (3, 0): print_workqueue_state_3_0(self.ramdump) elif (major, minor) == (3, 4): diff --git a/linux-ramdump-parser-v2/ramdump.py b/linux-ramdump-parser-v2/ramdump.py index ac48542aef16db7be665c4ddde1e1f83126a28b1..8c77aba53fef2ec17a8264642c40c6126ec9cb93 100644 --- a/linux-ramdump-parser-v2/ramdump.py +++ b/linux-ramdump-parser-v2/ramdump.py @@ -466,7 +466,7 @@ class RamDump(): self.ipc_log_debug = options.ipc_debug self.ipc_log_help = options.ipc_help self.use_stdout = options.stdout - self.major = [0, 0, 0] + self.kernel_version = [0, 0, 0] if options.ram_addr is not None: # TODO sanity check to make sure the memory regions don't overlap for file_path, start, end in options.ram_addr: @@ -634,7 +634,7 @@ class RamDump(): self.version = v.group(1) match = re.search('(\d+)\.(\d+)\.(\d+)', self.version) if match is not None: - self.major[0], self.major[1], self.major[2] = map(int, match.groups()) + self.kernel_version = map(int, match.groups()) else: print_out_str('!!! Could not extract version info! {0}'.format(self.version))