summaryrefslogtreecommitdiffstats
path: root/scripts/lib/wic/filemap.py
diff options
context:
space:
mode:
authorEd Bartosh <ed.bartosh@linux.intel.com>2017-06-13 14:22:03 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-06-14 10:18:21 +0100
commit08e2f4e59816c5757686255b267b08cbc46fbd95 (patch)
treec047227126c3bfac3393a67ab4eebdcd03b55ea1 /scripts/lib/wic/filemap.py
parent05badb6427442388b9bea04c8b184a2ce92362ec (diff)
downloadopenembedded-core-08e2f4e59816c5757686255b267b08cbc46fbd95.tar.gz
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. Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib/wic/filemap.py')
-rw-r--r--scripts/lib/wic/filemap.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/scripts/lib/wic/filemap.py b/scripts/lib/wic/filemap.py
index 8fe302ab49..8719f443c5 100644
--- a/scripts/lib/wic/filemap.py
+++ b/scripts/lib/wic/filemap.py
@@ -530,9 +530,18 @@ def filemap(image, log=None):
except ErrorNotSupp:
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):
- """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:
api = filemap
fmap = api(src_fname)
@@ -554,7 +563,7 @@ def sparse_copy(src_fname, dst_fname, offset=0, skip=0,
start = skip
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
to_read = end - start