thin_metadata_size: fix units
This commit is contained in:
parent
63c140d26e
commit
2631d377b5
@ -98,8 +98,8 @@ def single_mapping(from, to = 4711)
|
|||||||
" <single_mapping time=\"0\" origin_block=\"#{from}\" data_block=\"#{to}\"/>\n"
|
" <single_mapping time=\"0\" origin_block=\"#{from}\" data_block=\"#{to}\"/>\n"
|
||||||
end
|
end
|
||||||
|
|
||||||
def range_mapping(mapping, length)
|
def range_mapping(from, to, length)
|
||||||
" <range_mapping time=\"0\" origin_begin=\"#{mapping}\" data_begin=.\"1169\" length=\"#{lenght}\"/>\n"
|
" <range_mapping time=\"0\" origin_begin=\"#{from}\" data_begin=.\"#{to]\" length=\"#{length}\"/>\n"
|
||||||
end
|
end
|
||||||
|
|
||||||
def xml_metadata(opts, units)
|
def xml_metadata(opts, units)
|
||||||
@ -108,10 +108,15 @@ def xml_metadata(opts, units)
|
|||||||
puts begin_superblock(opts[:blocksize], blocks)
|
puts begin_superblock(opts[:blocksize], blocks)
|
||||||
0.step(opts[:thins] - 1) do |devid|
|
0.step(opts[:thins] - 1) do |devid|
|
||||||
puts begin_device(devid, opts[:thinsize])
|
puts begin_device(devid, opts[:thinsize])
|
||||||
|
if opts[:range]
|
||||||
|
puts range_mapping(from, to, blocks)
|
||||||
|
to += blocks
|
||||||
|
else
|
||||||
0.step(blocks - 1) do |from|
|
0.step(blocks - 1) do |from|
|
||||||
puts single_mapping(from, to)
|
puts single_mapping(from, to)
|
||||||
to += 1
|
to += 1
|
||||||
end
|
end
|
||||||
|
end
|
||||||
puts end_device
|
puts end_device
|
||||||
end
|
end
|
||||||
puts end_superblock
|
puts end_superblock
|
||||||
|
@ -27,7 +27,7 @@ def init_units
|
|||||||
'petabytes', 'pebibytes', 'exabytes', 'ebibytes',
|
'petabytes', 'pebibytes', 'exabytes', 'ebibytes',
|
||||||
'zetabytes', 'zebibytes', 'yottabytes', 'yobibytes' ]
|
'zetabytes', 'zebibytes', 'yottabytes', 'yobibytes' ]
|
||||||
units[:factors] = [ 1, units[:bytes_per_sector] ]
|
units[:factors] = [ 1, units[:bytes_per_sector] ]
|
||||||
1.step(8) { |e| units[:factors] += [ 1024**e, 1000**e ] }
|
1.step(8) { |e| units[:factors] += [ 1000**e, 1024**e ] }
|
||||||
units
|
units
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user