Filemap: implement ugly heuristics for SEEK_HOLE
authorArtem Bityutskiy <artem.bityutskiy@intel.com>
Mon, 20 Jan 2014 14:55:49 +0000 (16:55 +0200)
committerArtem Bityutskiy <artem.bityutskiy@intel.com>
Tue, 21 Jan 2014 17:16:20 +0000 (19:16 +0200)
commitbe266a96f89bf9fb901e62ec674aa6c280b70ee0
tree9547fca795d90346c1cb4f9195c1d26f2dade3b7
parent403581a39c017aa936de103c821c18879619b4d0
Filemap: implement ugly heuristics for SEEK_HOLE

Old kernels do not have real SEEK_HOLE support, but instead, provide a stub
implementation which just returns EOF. And there seem to be no easy way to find
out whether the implementation is real or fake. But we need to know this,
because it is crucial for use since we won't get the block map with fake
SEEK_HOLE implementation.

This patch implements an ugly test which appends a hole to the image file,
tests whether SEEK_HOLE is fake or not, and then truncats the image file back
to the original size.

Change-Id: Ib5744d5247aa0cda02517afe7189059cc5efeb9b
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
bmaptools/Filemap.py