public inbox for openembedded-core@lists.openembedded.org
 help / color / mirror / Atom feed
From: Ed Bartosh <ed.bartosh@linux.intel.com>
To: openembedded-core@lists.openembedded.org
Subject: [PATCH 14/25] filemap: change signature of sparse_copy function
Date: Thu,  8 Jun 2017 19:12:56 +0300	[thread overview]
Message-ID: <d184472029d734d831703b3e2b88f5a98f93c41b.1496938139.git.ed.bartosh@linux.intel.com> (raw)
In-Reply-To: <cover.1496938139.git.ed.bartosh@linux.intel.com>

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>
---
 scripts/lib/wic/filemap.py               | 15 ++++++++++++---
 scripts/lib/wic/plugins/imager/direct.py |  2 +-
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/scripts/lib/wic/filemap.py b/scripts/lib/wic/filemap.py
index 8fe302a..8719f44 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
diff --git a/scripts/lib/wic/plugins/imager/direct.py b/scripts/lib/wic/plugins/imager/direct.py
index f2e6127..3cdedd1 100644
--- a/scripts/lib/wic/plugins/imager/direct.py
+++ b/scripts/lib/wic/plugins/imager/direct.py
@@ -550,7 +550,7 @@ class PartitionedImage():
             source = part.source_file
             if source:
                 # 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, "
                              "size %d sectors", source, part.num, part.start,
-- 
2.1.4



  parent reply	other threads:[~2017-06-08 16:16 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-08 16:12 [PATCH 00/25] #11283 wic ls & cp & rm Ed Bartosh
2017-06-08 16:12 ` [PATCH 01/25] filemap: fix skip logic Ed Bartosh
2017-06-08 16:12 ` [PATCH 02/25] filemap: add parameter 'length' to sparse_copy Ed Bartosh
2017-06-08 16:12 ` [PATCH 03/25] bootimg-pcbios: make boot image file unique Ed Bartosh
2017-06-08 16:12 ` [PATCH 04/25] wic: add wic_init_parser_ls Ed Bartosh
2017-06-08 16:12 ` [PATCH 05/25] wic: add help and usage content for 'wic ls' Ed Bartosh
2017-06-08 16:12 ` [PATCH 06/25] wic: add 'wic ls' command Ed Bartosh
2017-06-08 16:12 ` [PATCH 07/25] engine: implement listing wic images Ed Bartosh
2017-06-08 16:12 ` [PATCH 08/25] selftest: add new test case test_wic_ls Ed Bartosh
2017-06-08 16:12 ` [PATCH 09/25] wic: add wic_init_parser_cp Ed Bartosh
2017-06-08 16:12 ` [PATCH 10/25] wic: add help and usage content for 'wic cp' Ed Bartosh
2017-06-08 16:12 ` [PATCH 11/25] wic: add 'wic cp' command Ed Bartosh
2017-06-08 16:12 ` [PATCH 12/25] wic: add Disk._prop helper Ed Bartosh
2017-06-08 16:12 ` [PATCH 13/25] wic: add mcopy property Ed Bartosh
2017-06-08 16:12 ` Ed Bartosh [this message]
2017-06-08 16:12 ` [PATCH 15/25] filemap: check if dest is written for every block Ed Bartosh
2017-06-08 16:12 ` [PATCH 16/25] filemap: calculate dst size correctly Ed Bartosh
2017-06-08 16:12 ` [PATCH 17/25] wic: add Disk._put_part_image method Ed Bartosh
2017-06-08 16:13 ` [PATCH 18/25] wic: fully implement 'wic cp' Ed Bartosh
2017-06-08 16:13 ` [PATCH 19/25] selftest: add test_wic_cp test case Ed Bartosh
2017-06-08 16:13 ` [PATCH 20/25] wic: add wic_init_parser_rm Ed Bartosh
2017-06-08 16:13 ` [PATCH 21/25] wic: add help and usage content for 'wic rm' Ed Bartosh
2017-06-08 16:13 ` [PATCH 22/25] wic: add 'wic rm' command Ed Bartosh
2017-06-08 16:13 ` [PATCH 23/25] wic: implement removing files Ed Bartosh
2017-06-08 16:13 ` [PATCH 24/25] wic: implement removing directories Ed Bartosh
2017-06-08 16:13 ` [PATCH 25/25] selftest: add test_wic_rm test case Ed Bartosh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d184472029d734d831703b3e2b88f5a98f93c41b.1496938139.git.ed.bartosh@linux.intel.com \
    --to=ed.bartosh@linux.intel.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox