round displayed hd sizes down to the nearest MiB
do not know if this makes a real difference but no real cost to being defensive
This commit is contained in:
parent
af67c7074c
commit
d1c431af01
|
@ -169,7 +169,7 @@ class Disk:
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def size(self):
|
def size(self):
|
||||||
return self._info.size - (2<<20) # The first and last megabyte of the disk are not usable.
|
return align_down(self._info.size) - (2<<20) # The first and last megabyte of the disk are not usable.
|
||||||
|
|
||||||
def desc(self):
|
def desc(self):
|
||||||
return "local disk"
|
return "local disk"
|
||||||
|
@ -256,6 +256,9 @@ class Mount:
|
||||||
def align_up(size, block_size=1 << 20):
|
def align_up(size, block_size=1 << 20):
|
||||||
return (size + block_size - 1) & ~(block_size - 1)
|
return (size + block_size - 1) & ~(block_size - 1)
|
||||||
|
|
||||||
|
def align_down(size, block_size=1 << 20):
|
||||||
|
return size & ~(block_size - 1)
|
||||||
|
|
||||||
|
|
||||||
class FilesystemModel(object):
|
class FilesystemModel(object):
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue