thin_metadata_size: Fix long names of units

Both implementations of thin_metadata_size believe units are defined
like this:

    1024 == kilobyte == k
    1000 == kibibyte == K

and so on.  Fix the 1000/1024 confusion, while continuing to follow the
LVM convention of using lowercase letters for binary units, so that we
have:

    1024 == kibibyte == k
    1000 == kilobyte == K
This commit is contained in:
Benjamin Gilbert
2014-05-17 03:48:13 -04:00
parent e7e3e93ec6
commit 2679e7f088
3 changed files with 20 additions and 20 deletions

View File

@@ -22,10 +22,10 @@ def init_units
units[:bytes_per_sector] = 512
units[:chars] = "bskKmMgGtTpPeEzZyY"
units[:strings] = [ 'bytes', 'sectors',
'kilobytes', 'kibibytes', 'megabytes', 'mebibytes',
'gigabytes', 'gibibytes', 'terabytes', 'tebibytes',
'petabytes', 'pebibytes', 'exabytes', 'ebibytes',
'zetabytes', 'zebibytes', 'yottabytes', 'yobibytes' ]
'kibibytes', 'kilobytes', 'mebibytes', 'megabytes',
'gibibytes', 'gigabytes', 'tebibytes', 'terabytes',
'pebibytes', 'petabytes', 'ebibytes', 'exabytes',
'zebibytes', 'zetabytes', 'yobibytes', 'yottabytes' ]
units[:factors] = [ 1, units[:bytes_per_sector] ]
1.step(8) { |e| units[:factors] += [ 1024**e, 1000**e ] }
units