Change API class names from BmapCreator/BmapFlasher to BmapCreate/BmapFlash.
I plan to get rid of 'bmap-creator' and 'bmap-flasher' and instead, have
a single 'bmap' tool with sub-commands: bmap create and bmap flash.
Change-Id: I5b6fbb0b75954fc27ce39ad5e4317f4957461595
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
output = setup_output_stream(args.output)
try:
- creator = BmapCreator.BmapCreator(args.image, output)
+ creator = BmapCreate.BmapCreate(args.image, output)
creator.generate(not args.no_checksum)
- except BmapCreator.Error as err:
+ except BmapCreate.Error as err:
log.error(str(err))
raise SystemExit(1)
# The first positional argument - image file
text = "the image file to flash. Supported formats: uncompressed, " + \
- ", ".join(BmapFlasher.supported_image_formats)
+ ", ".join(BmapFlash.supported_image_formats)
parser.add_argument("image", help = text)
# The second positional argument - block device node
log = setup_logger(logging.INFO)
try:
- flasher = BmapFlasher.BmapFlasher(args.image, args.bdev, args.bmap)
- except BmapFlasher.Error as err:
+ flasher = BmapFlash.BmapFlash(args.image, args.bdev, args.bmap)
+ except BmapFlash.Error as err:
log.error(str(err))
raise SystemExit(1)
try:
try:
flasher.write(False, not args.no_verify)
- except BmapFlasher.Error as err:
+ except BmapFlash.Error as err:
log.error(str(err))
raise SystemExit(1)
log.info("synchronizing block device '%s'" % args.bdev)
try:
flasher.sync()
- except BmapFlasher.Error as err:
+ except BmapFlash.Error as err:
log.error(str(err))
raise SystemExit(1)
except KeyboardInterrupt:
"""
This module implements the block map (AKA bmap) generating functionality and
-provides corresponding API (in a form of the BmapCreator class).
+provides corresponding API (in a form of the BmapCreate class).
The idea is that while images files may generally be very large (e.g., 4GiB),
they may nevertheless contain only little real data, e.g., 512MiB. This data
bmap_version = "1.2"
class Error(Exception):
- """ A class for exceptions of BmapCreator. We currently support only one
+ """ A class for exceptions of BmapCreate. We currently support only one
type of exceptions, and we basically throw human-readable problem
description in case of errors. """
def __str__(self):
return self.strerror
-class BmapCreator:
+class BmapCreate:
""" This class the bmap creation functionality. To generate a bmap for an
image (which is supposedly a sparse file) you should first create an
- instance of 'BmapCreator' and provide:
+ instance of 'BmapCreate' and provide:
* full path to the image to create bmap for
* a logger object to output the generated bmap to
"""
This module implements flashing with block map (AKA bmap) and provides flashing
-API (in form of the 'BmapFlasher' class).
+API (in form of the 'BmapFlash' class).
The bmap contains list of blocks which have to be read from the image file and
then written to the block device. The rest of the blocks are not required to be
supported_bmap_version = 1
class Error(Exception):
- """ A class for exceptions of BmapFlasher. We currently support only one
+ """ A class for exceptions of BmapFlash. We currently support only one
type of exceptions, and we basically throw human-readable problem
description in case of errors. """
pass
-class BmapFlasher:
+class BmapFlash:
""" This class implemends all the bmap flashing functionality. To flash an
image to a block device you should create an instance of this class and
provide the following:
image. Compression type is defined by the image file extention.
Supported types are listed by 'supported_image_formats'.
- Once an instance of 'BmapFlasher' is created, all the 'bmap_*'
+ Once an instance of 'BmapFlash' is created, all the 'bmap_*'
attributes are initialized and available. They are read from the bmap.
However, in case of bmap-less flashing, some of them (all the image
size-related) are available only after writing the image, but not after
creating the instance. The reason for this is that when bmap is absent,
- 'BmapFlasher' uses sensible fall-back values for 'bmap_*' attributes
+ 'BmapFlash' uses sensible fall-back values for 'bmap_*' attributes
assuming the entire image is "mapped". And if the image is compressed,
we cannot easily get the image size unless we decompress it, which is
too time-consuming to do in '__init__()'. However, after the 'write()'
"""
This module contains various helper functions which are shared between
-BmapFlasher and BmapCreator or which are useful for users of bmaptools.
+BmapFlash and BmapCreate or which are useful for users of bmaptools.
"""
def human_size(size):