Fixed bug in processing 'skip' parameter:
don't read input file if end of bmap block is less than skip
Simplified logic of positioning to the start of data inside a
partially skipped bmap block.
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
start = first * fmap.block_size
end = (last + 1) * fmap.block_size
+ if skip >= end:
+ continue
+
if start < skip < end:
- fmap._f_image.seek(skip, os.SEEK_SET)
- else:
- fmap._f_image.seek(start, os.SEEK_SET)
- dst_file.seek(offset + start, os.SEEK_SET)
+ start = skip
+
+ fmap._f_image.seek(start, os.SEEK_SET)
+ dst_file.seek(offset + start - skip, os.SEEK_SET)
chunk_size = 1024 * 1024
to_read = end - start