mirror of
https://git.yoctoproject.org/poky
synced 2026-09-19 09:49:33 +02:00
filemap: change signature of sparse_copy function
Renamed parameter offset->skip to match names of dd parameters. Changed affected sparse_copy calls. Added explanation of the parameters to docstring. (From OE-Core rev: 08e2f4e59816c5757686255b267b08cbc46fbd95) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
1344400f1a
commit
59e0600427
@@ -530,9 +530,18 @@ def filemap(image, log=None):
|
|||||||
except ErrorNotSupp:
|
except ErrorNotSupp:
|
||||||
return FilemapSeek(image, log)
|
return FilemapSeek(image, log)
|
||||||
|
|
||||||
def sparse_copy(src_fname, dst_fname, offset=0, skip=0,
|
def sparse_copy(src_fname, dst_fname, skip=0, seek=0,
|
||||||
length=0, api=None):
|
length=0, api=None):
|
||||||
"""Efficiently copy sparse file to or into another file."""
|
"""
|
||||||
|
Efficiently copy sparse file to or into another file.
|
||||||
|
|
||||||
|
src_fname: path to source file
|
||||||
|
dst_fname: path to destination file
|
||||||
|
skip: skip N bytes at thestart of src
|
||||||
|
seek: seek N bytes from the start of dst
|
||||||
|
length: read N bytes from src and write them to dst
|
||||||
|
api: FilemapFiemap or FilemapSeek object
|
||||||
|
"""
|
||||||
if not api:
|
if not api:
|
||||||
api = filemap
|
api = filemap
|
||||||
fmap = api(src_fname)
|
fmap = api(src_fname)
|
||||||
@@ -554,7 +563,7 @@ def sparse_copy(src_fname, dst_fname, offset=0, skip=0,
|
|||||||
start = skip
|
start = skip
|
||||||
|
|
||||||
fmap._f_image.seek(start, os.SEEK_SET)
|
fmap._f_image.seek(start, os.SEEK_SET)
|
||||||
dst_file.seek(offset + start - skip, os.SEEK_SET)
|
dst_file.seek(seek + start - skip, os.SEEK_SET)
|
||||||
|
|
||||||
chunk_size = 1024 * 1024
|
chunk_size = 1024 * 1024
|
||||||
to_read = end - start
|
to_read = end - start
|
||||||
|
|||||||
@@ -550,7 +550,7 @@ class PartitionedImage():
|
|||||||
source = part.source_file
|
source = part.source_file
|
||||||
if source:
|
if source:
|
||||||
# install source_file contents into a partition
|
# install source_file contents into a partition
|
||||||
sparse_copy(source, self.path, part.start * self.sector_size)
|
sparse_copy(source, self.path, seek=part.start * self.sector_size)
|
||||||
|
|
||||||
logger.debug("Installed %s in partition %d, sectors %d-%d, "
|
logger.debug("Installed %s in partition %d, sectors %d-%d, "
|
||||||
"size %d sectors", source, part.num, part.start,
|
"size %d sectors", source, part.num, part.start,
|
||||||
|
|||||||
Reference in New Issue
Block a user