summaryrefslogtreecommitdiffstats
path: root/scripts/lib/wic
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:29 +0100
commit59e0600427a7cb72146be1e3f8d7b4f977f4c848 (patch)
treed59d9c3abb138b3bd2af406cab708c104dfeeea6 /scripts/lib/wic
parent1344400f1a9ad24c7ec43e1b2f8190c48ba59ebb (diff)
downloadpoky-59e0600427a7cb72146be1e3f8d7b4f977f4c848.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. (From OE-Core rev: 08e2f4e59816c5757686255b267b08cbc46fbd95) 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')
-rw-r--r--scripts/lib/wic/filemap.py15
-rw-r--r--scripts/lib/wic/plugins/imager/direct.py2
2 files changed, 13 insertions, 4 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):
530 except ErrorNotSupp: 530 except ErrorNotSupp:
531 return FilemapSeek(image, log) 531 return FilemapSeek(image, log)
532 532
533def sparse_copy(src_fname, dst_fname, offset=0, skip=0, 533def sparse_copy(src_fname, dst_fname, skip=0, seek=0,
534 length=0, api=None): 534 length=0, api=None):
535 """Efficiently copy sparse file to or into another file.""" 535 """
536 Efficiently copy sparse file to or into another file.
537
538 src_fname: path to source file
539 dst_fname: path to destination file
540 skip: skip N bytes at thestart of src
541 seek: seek N bytes from the start of dst
542 length: read N bytes from src and write them to dst
543 api: FilemapFiemap or FilemapSeek object
544 """
536 if not api: 545 if not api:
537 api = filemap 546 api = filemap
538 fmap = api(src_fname) 547 fmap = api(src_fname)
@@ -554,7 +563,7 @@ def sparse_copy(src_fname, dst_fname, offset=0, skip=0,
554 start = skip 563 start = skip
555 564
556 fmap._f_image.seek(start, os.SEEK_SET) 565 fmap._f_image.seek(start, os.SEEK_SET)
557 dst_file.seek(offset + start - skip, os.SEEK_SET) 566 dst_file.seek(seek + start - skip, os.SEEK_SET)
558 567
559 chunk_size = 1024 * 1024 568 chunk_size = 1024 * 1024
560 to_read = end - start 569 to_read = end - start
diff --git a/scripts/lib/wic/plugins/imager/direct.py b/scripts/lib/wic/plugins/imager/direct.py
index f2e6127331..3cdedd1579 100644
--- a/scripts/lib/wic/plugins/imager/direct.py
+++ b/scripts/lib/wic/plugins/imager/direct.py
@@ -550,7 +550,7 @@ class PartitionedImage():
550 source = part.source_file 550 source = part.source_file
551 if source: 551 if source:
552 # install source_file contents into a partition 552 # install source_file contents into a partition
553 sparse_copy(source, self.path, part.start * self.sector_size) 553 sparse_copy(source, self.path, seek=part.start * self.sector_size)
554 554
555 logger.debug("Installed %s in partition %d, sectors %d-%d, " 555 logger.debug("Installed %s in partition %d, sectors %d-%d, "
556 "size %d sectors", source, part.num, part.start, 556 "size %d sectors", source, part.num, part.start,