From 0452ee03049857f7854736916acef050d5684133 Mon Sep 17 00:00:00 2001 From: Artem Bityutskiy Date: Thu, 15 Nov 2012 11:00:34 +0200 Subject: [PATCH] BmapCreate: generate more readable bmap When the blocks rage consists of a single block (say 18282), write it in form of <>18282 instead of less readable <>18282-18282 form. 'bmaptool copy' supports both. Change-Id: I96cd97b1913227de878004fc29eb65b76f11058e Signed-off-by: Artem Bityutskiy --- TODO | 5 +---- bmaptools/BmapCreate.py | 9 +++++++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/TODO b/TODO index ef6aa87..873c48e 100644 --- a/TODO +++ b/TODO @@ -2,8 +2,5 @@ better. Currently we are calling it for each block. 2. In the block device optimization code - remember the original settings and reconstruct them after writing. -3. In 'bmaptool create' when the blocks rage consists of a single block (say - 18282), write it in form of <>18282 instead of less readable - <>18282-18282 form. 'bmaptool copy' supports both already. -4. The block device optimizations will not work if it was /dev/sdc1 instead of +3. The block device optimizations will not work if it was /dev/sdc1 instead of /dev/sdc - fix this. diff --git a/bmaptools/BmapCreate.py b/bmaptools/BmapCreate.py index 89c4e34..127036e 100644 --- a/bmaptools/BmapCreate.py +++ b/bmaptools/BmapCreate.py @@ -331,8 +331,13 @@ class BmapCreate: sha1 = " sha1=\"%s\"" % sha1 else: sha1 = "" - self._output.info(" %s-%s " \ - % (sha1, first, last)) + + if first != last: + self._output.info(" %s-%s " \ + % (sha1, first, last)) + else: + self._output.info(" %s " \ + % (sha1, first)) self.bmap_mapped_size = self.bmap_mapped_cnt * self.bmap_block_size self.bmap_mapped_size_human = human_size(self.bmap_mapped_size) -- 2.7.4