diff --git a/linux-ramdump-parser-v2/iommulib.py b/linux-ramdump-parser-v2/iommulib.py index f7f80796242e3c52643485dc55669ba41708ecc7..44934ad27025ab43cea4cef515130ee9181a1814 100644 --- a/linux-ramdump-parser-v2/iommulib.py +++ b/linux-ramdump-parser-v2/iommulib.py @@ -104,7 +104,7 @@ class IommuLib(object): list_walker = llist.ListWalker( self.ramdump, list_attached, self.ramdump.field_offset('struct msm_iommu_ctx_drvdata', 'attached_elm')) - list_walker.walk(list_attached, self._iommu_list_func, extra=ctx_list) + list_walker.walk(list_attached, self._iommu_list_func, ctx_list) domain_list.append( Domain(domain_num, pg_table, redirect, ctx_list, client_name)) diff --git a/linux-ramdump-parser-v2/linux_list.py b/linux-ramdump-parser-v2/linux_list.py index cdcfca542f53550ed2729ee73d26d5d6b34a5e63..e1637bed6268c136dbc2b1e0a38669ef605c31c0 100644 --- a/linux-ramdump-parser-v2/linux_list.py +++ b/linux-ramdump-parser-v2/linux_list.py @@ -32,13 +32,19 @@ class ListWalker(object): self.last_node = node_addr self.seen_nodes = [] - def walk(self, node_addr, func, extra=None): + def walk(self, node_addr, func, *args): + """Walk the linked list starting at `node_addr', calling `func' on + each node. `func' will be passed the current node and *args, + if given. + + """ while True: if node_addr == 0: break - func(node_addr - self.list_elem_offset, extra) + funcargs = [node_addr - self.list_elem_offset] + list(args) + func(*funcargs) next_node_addr = node_addr + self.ram_dump.field_offset('struct list_head', 'next') next_node = self.ram_dump.read_word(next_node_addr)