Fiemap: amend things about the default buffer size
authorArtem Bityutskiy <artem.bityutskiy@intel.com>
Wed, 28 Nov 2012 09:35:24 +0000 (11:35 +0200)
committerArtem Bityutskiy <artem.bityutskiy@intel.com>
Wed, 28 Nov 2012 15:11:11 +0000 (17:11 +0200)
Introduce a constant for the default buffer size.
Change the constructor interface - now None 'buf_size' means the default
buffer size, which is a nicer interface.

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

index f0f55fa..8144903 100644 (file)
@@ -29,6 +29,8 @@ _FIEMAP_IOCTL = 0xC020660B
 
 # Minimum buffer which is required for 'class Fiemap' to operate
 MIN_BUFFER_SIZE = _FIEMAP_SIZE + _FIEMAP_EXTENT_SIZE
+# The default buffer size for 'class Fiemap'
+DEFAULT_BUFFER_SIZE = 256 * 1024
 
 class Error(Exception):
     """ A class for exceptions generated by this module. We currently support
@@ -51,7 +53,7 @@ class Fiemap:
 
         self._f_image_needs_close = True
 
-    def __init__(self, image, buf_size = 256 * 1024):
+    def __init__(self, image, buf_size = DEFAULT_BUFFER_SIZE):
         """ Initialize a class instance. The 'image' argument is full path to
         the file to operate on, or a file object to operate on.