def readnode(self, lnum, offs):
"""
read a node from a lnum + offset.
"""
ch = UbiFsCommonHeader()
hdrdata = self.vol.read(lnum, offs, ch.hdrsize)
ch.parse(hdrdata)
ch.lnum = lnum
ch.offs = offs
node = ch.getnode()
nodedata = self.vol.read(lnum, offs + ch.hdrsize, ch.len - ch.hdrsize)
if crc32(hdrdata[8:] + nodedata) != ch.crc:
print(ch, node)
print(" %s + %s = %08x -> want = %08x" % ( b2a_hex(hdrdata), b2a_hex(nodedata), crc32(hdrdata[8:] + nodedata), ch.crc))
raise Exception("invalid node crc")
node.parse(nodedata)
return node
评论列表
文章目录