summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Hao <kexin.hao@windriver.com>2020-07-14 08:53:23 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2020-07-31 22:02:52 +0100
commit716fe312f5edff1b9e9045ea8b3860fa1729a468 (patch)
tree663a032057d3b72bb37bc0bf194b0032afd5553f
parent1a24aed9055ae0af628a4137f1390d013dcb196a (diff)
downloadpoky-716fe312f5edff1b9e9045ea8b3860fa1729a468.tar.gz
wic/filemap: Fall back to standard copy when no way to get the block map
For some filesystems, such as aufs which may be used by docker container, don't support either the SEEK_DATA/HOLE or FIEMAP to get the block map. So add a FileNobmap class to fall back to standard copy when there is no way to get the block map. [Yocto #12988] (From OE-Core rev: 66f9db48bb9d59f08492f0515bc08b6b039aa03f) Signed-off-by: Kevin Hao <kexin.hao@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 7934ed49179242f15b413c0275040a3bb6b68876) Signed-off-by: Steve Sakoman <steve@sakoman.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--scripts/lib/wic/filemap.py28
1 files changed, 27 insertions, 1 deletions
diff --git a/scripts/lib/wic/filemap.py b/scripts/lib/wic/filemap.py
index f8c6e09d01..4d9da28172 100644
--- a/scripts/lib/wic/filemap.py
+++ b/scripts/lib/wic/filemap.py
@@ -469,6 +469,29 @@ class FilemapFiemap(_FilemapBase):
469 % (first_prev, last_prev)) 469 % (first_prev, last_prev))
470 yield (first_prev, last_prev) 470 yield (first_prev, last_prev)
471 471
472class FilemapNobmap(_FilemapBase):
473 """
474 This class is used when both the 'SEEK_DATA/HOLE' and FIEMAP are not
475 supported by the filesystem or kernel.
476 """
477
478 def __init__(self, image, log=None):
479 """Refer the '_FilemapBase' class for the documentation."""
480
481 # Call the base class constructor first
482 _FilemapBase.__init__(self, image, log)
483 self._log.debug("FilemapNobmap: initializing")
484
485 def block_is_mapped(self, block):
486 """Refer the '_FilemapBase' class for the documentation."""
487 return True
488
489 def get_mapped_ranges(self, start, count):
490 """Refer the '_FilemapBase' class for the documentation."""
491 self._log.debug("FilemapNobmap: get_mapped_ranges(%d, %d(%d))"
492 % (start, count, start + count - 1))
493 yield (start, start + count -1)
494
472def filemap(image, log=None): 495def filemap(image, log=None):
473 """ 496 """
474 Create and return an instance of a Filemap class - 'FilemapFiemap' or 497 Create and return an instance of a Filemap class - 'FilemapFiemap' or
@@ -482,7 +505,10 @@ def filemap(image, log=None):
482 try: 505 try:
483 return FilemapFiemap(image, log) 506 return FilemapFiemap(image, log)
484 except ErrorNotSupp: 507 except ErrorNotSupp:
485 return FilemapSeek(image, log) 508 try:
509 return FilemapSeek(image, log)
510 except ErrorNotSupp:
511 return FilemapNobmap(image, log)
486 512
487def sparse_copy(src_fname, dst_fname, skip=0, seek=0, 513def sparse_copy(src_fname, dst_fname, skip=0, seek=0,
488 length=0, api=None): 514 length=0, api=None):