From 6d8b8510067727e0745cfe9e3a6c0dd9da5ed344 Mon Sep 17 00:00:00 2001 From: Mitchel Humpherys <mitchelh@codeaurora.org> Date: Wed, 24 Jun 2015 17:24:13 -0700 Subject: [PATCH] lrdp-v2: Move users of RamDump.version to RamDump.kernel_version We have the full-parsed kernel version available in RamDump.kernel_version now. There's no need for everyone to parse the string version individually now. Convert existing users over. Change-Id: I9ae182be2c638711dfd76c8949197bb86b75b2a1 --- linux-ramdump-parser-v2/dmesglib.py | 12 +++++------- linux-ramdump-parser-v2/parsers/vmalloc.py | 6 +++--- linux-ramdump-parser-v2/parsers/workqueue.py | 4 +--- 3 files changed, 9 insertions(+), 13 deletions(-) diff --git a/linux-ramdump-parser-v2/dmesglib.py b/linux-ramdump-parser-v2/dmesglib.py index 2375f59..8275b31 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/vmalloc.py b/linux-ramdump-parser-v2/parsers/vmalloc.py index 54ff28e..062b740 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 dcecd42..5df616d 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): -- GitLab