diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/lib/wic/filemap.py | 14 | ||||
-rw-r--r-- | scripts/lib/wic/utils/partitionedfs.py | 6 |
2 files changed, 10 insertions, 10 deletions
diff --git a/scripts/lib/wic/filemap.py b/scripts/lib/wic/filemap.py index f8b2ba71bb..2778be5e1b 100644 --- a/scripts/lib/wic/filemap.py +++ b/scripts/lib/wic/filemap.py | |||
@@ -95,7 +95,7 @@ class _FilemapBase(object): | |||
95 | % (self._image_path, err)) | 95 | % (self._image_path, err)) |
96 | 96 | ||
97 | self.blocks_cnt = self.image_size + self.block_size - 1 | 97 | self.blocks_cnt = self.image_size + self.block_size - 1 |
98 | self.blocks_cnt /= self.block_size | 98 | self.blocks_cnt //= self.block_size |
99 | 99 | ||
100 | try: | 100 | try: |
101 | self._f_image.flush() | 101 | self._f_image.flush() |
@@ -254,7 +254,7 @@ class FilemapSeek(_FilemapBase): | |||
254 | if offs == -1: | 254 | if offs == -1: |
255 | result = False | 255 | result = False |
256 | else: | 256 | else: |
257 | result = (offs / self.block_size == block) | 257 | result = (offs // self.block_size == block) |
258 | 258 | ||
259 | self._log.debug("FilemapSeek: block_is_mapped(%d) returns %s" | 259 | self._log.debug("FilemapSeek: block_is_mapped(%d) returns %s" |
260 | % (block, result)) | 260 | % (block, result)) |
@@ -286,8 +286,8 @@ class FilemapSeek(_FilemapBase): | |||
286 | if end > limit: | 286 | if end > limit: |
287 | end = limit | 287 | end = limit |
288 | 288 | ||
289 | start_blk = start / self.block_size | 289 | start_blk = start // self.block_size |
290 | end_blk = end / self.block_size - 1 | 290 | end_blk = end // self.block_size - 1 |
291 | self._log.debug("FilemapSeek: yielding range (%d, %d)" | 291 | self._log.debug("FilemapSeek: yielding range (%d, %d)" |
292 | % (start_blk, end_blk)) | 292 | % (start_blk, end_blk)) |
293 | yield (start_blk, end_blk) | 293 | yield (start_blk, end_blk) |
@@ -351,7 +351,7 @@ class FilemapFiemap(_FilemapBase): | |||
351 | 351 | ||
352 | # Calculate how many 'struct fiemap_extent' elements fit the buffer | 352 | # Calculate how many 'struct fiemap_extent' elements fit the buffer |
353 | self._buf_size -= _FIEMAP_SIZE | 353 | self._buf_size -= _FIEMAP_SIZE |
354 | self._fiemap_extent_cnt = self._buf_size / _FIEMAP_EXTENT_SIZE | 354 | self._fiemap_extent_cnt = self._buf_size // _FIEMAP_EXTENT_SIZE |
355 | assert self._fiemap_extent_cnt > 0 | 355 | assert self._fiemap_extent_cnt > 0 |
356 | self._buf_size = self._fiemap_extent_cnt * _FIEMAP_EXTENT_SIZE | 356 | self._buf_size = self._fiemap_extent_cnt * _FIEMAP_EXTENT_SIZE |
357 | self._buf_size += _FIEMAP_SIZE | 357 | self._buf_size += _FIEMAP_SIZE |
@@ -456,11 +456,11 @@ class FilemapFiemap(_FilemapBase): | |||
456 | # Start of the extent | 456 | # Start of the extent |
457 | extent_start = fiemap_extent[0] | 457 | extent_start = fiemap_extent[0] |
458 | # Starting block number of the extent | 458 | # Starting block number of the extent |
459 | extent_block = extent_start / self.block_size | 459 | extent_block = extent_start // self.block_size |
460 | # Length of the extent | 460 | # Length of the extent |
461 | extent_len = fiemap_extent[2] | 461 | extent_len = fiemap_extent[2] |
462 | # Count of blocks in the extent | 462 | # Count of blocks in the extent |
463 | extent_count = extent_len / self.block_size | 463 | extent_count = extent_len // self.block_size |
464 | 464 | ||
465 | # Extent length and offset have to be block-aligned | 465 | # Extent length and offset have to be block-aligned |
466 | assert extent_start % self.block_size == 0 | 466 | assert extent_start % self.block_size == 0 |
diff --git a/scripts/lib/wic/utils/partitionedfs.py b/scripts/lib/wic/utils/partitionedfs.py index 8f4db4e17d..46b5d345c7 100644 --- a/scripts/lib/wic/utils/partitionedfs.py +++ b/scripts/lib/wic/utils/partitionedfs.py | |||
@@ -95,7 +95,7 @@ class Image(): | |||
95 | ks_pnum = len(self.partitions) | 95 | ks_pnum = len(self.partitions) |
96 | 96 | ||
97 | # Converting kB to sectors for parted | 97 | # Converting kB to sectors for parted |
98 | size = size * 1024 / self.sector_size | 98 | size = size * 1024 // self.sector_size |
99 | 99 | ||
100 | part = {'ks_pnum': ks_pnum, # Partition number in the KS file | 100 | part = {'ks_pnum': ks_pnum, # Partition number in the KS file |
101 | 'size': size, # In sectors | 101 | 'size': size, # In sectors |
@@ -173,12 +173,12 @@ class Image(): | |||
173 | # gaps we could enlargea the previous partition? | 173 | # gaps we could enlargea the previous partition? |
174 | 174 | ||
175 | # Calc how much the alignment is off. | 175 | # Calc how much the alignment is off. |
176 | align_sectors = disk['offset'] % (part['align'] * 1024 / self.sector_size) | 176 | align_sectors = disk['offset'] % (part['align'] * 1024 // self.sector_size) |
177 | 177 | ||
178 | if align_sectors: | 178 | if align_sectors: |
179 | # If partition is not aligned as required, we need | 179 | # If partition is not aligned as required, we need |
180 | # to move forward to the next alignment point | 180 | # to move forward to the next alignment point |
181 | align_sectors = (part['align'] * 1024 / self.sector_size) - align_sectors | 181 | align_sectors = (part['align'] * 1024 // self.sector_size) - align_sectors |
182 | 182 | ||
183 | msger.debug("Realignment for %s%s with %s sectors, original" | 183 | msger.debug("Realignment for %s%s with %s sectors, original" |
184 | " offset %s, target alignment is %sK." % | 184 | " offset %s, target alignment is %sK." % |