[bmap-tools] [PATCH 03/14] Filemap: simplify the FIEMAP failure error path

Artem Bityutskiy dedekind1 at gmail.com
Tue Jan 21 12:34:24 EST 2014


From: Artem Bityutskiy <artem.bityutskiy at intel.com>

Simplify the FIEMAP ioctl error handling by removing the 'looks like your
kernel does not support FIEMAP' note. I've recently got a bug report from the
field where people hit this error, and that line not was not actually appended
to the error message because the error code was something like ENOTSUPP. And
the error was anyway very clear and readable.

So let's just remove that part and simplify the code.

Change-Id: Ib098c814d70980bdcb60402eafd213c08f8c9dbd
Signed-off-by: Artem Bityutskiy <artem.bityutskiy at intel.com>
---
 bmaptools/Filemap.py | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/bmaptools/Filemap.py b/bmaptools/Filemap.py
index 4dcb0cb..6375a5e 100644
--- a/bmaptools/Filemap.py
+++ b/bmaptools/Filemap.py
@@ -158,13 +158,10 @@ class Fiemap:
         try:
             fcntl.ioctl(self._f_image, _FIEMAP_IOCTL, self._buf, 1)
         except IOError as err:
-            error_msg = "the FIEMAP ioctl failed for '%s': %s" \
-                        % (self._image_path, err)
-            if err.errno == os.errno.EPERM or err.errno == os.errno.EACCES:
-                # The FIEMAP ioctl was added in kernel version 2.6.28 in 2008
-                error_msg += " (looks like your kernel does not support FIEMAP)"
-
-            raise Error(error_msg)
+            # Note, the FIEMAP ioctl is supported by the Linux kernel starting
+            # from version 2.6.28 (year 2008).
+            raise Error("the FIEMAP ioctl failed for '%s': %s"
+                        % (self._image_path, err))
 
         return struct.unpack(_FIEMAP_FORMAT, self._buf[:_FIEMAP_SIZE])
 
-- 
1.8.3.1




More information about the Bmap-tools mailing list