part_block: fix handling of chained EBR's

Fixes #3223.
This commit is contained in:
Josef Söntgen 2019-03-10 14:36:07 +01:00 committed by Christian Helmuth
parent 1c2dabc6d7
commit cb2ebd0bf7
2 changed files with 13 additions and 1 deletions

View File

@ -5,6 +5,7 @@
<events>
<timeout meaning="failed" sec="60" />
<log meaning="succeeded">
Tests finished successfully!*
Tests finished successfully!*
Tests finished successfully!
</log>
@ -51,6 +52,7 @@
<report partitions="yes"/>
<policy label_prefix="test-part1" partition="6"/>
<policy label_prefix="test-part2" partition="1"/>
<policy label_prefix="test-part3" partition="9"/>
</config>
</start>
<start name="report_rom">
@ -75,5 +77,12 @@
<any-service> <child name="part_block" /> <parent/> <any-child/> </any-service>
</route>
</start>
<start name="test-part3">
<binary name="test-block-client"/>
<resource name="RAM" quantum="5M" />
<route>
<any-service> <child name="part_block" /> <parent/> <any-child/> </any-service>
</route>
</start>
</config>
</runtime>

View File

@ -84,6 +84,7 @@ struct Mbr_partition_table : public Block::Partition_table
{
Partition_record *r = record;
unsigned lba = r->_lba;
unsigned last_lba = 0;
/* first logical partition number */
int nr = 5;
@ -106,7 +107,9 @@ struct Mbr_partition_table : public Block::Partition_table
* (relative form this EBR)
*/
r = &(ebr->_records[1]);
lba += ebr->_records[1]._lba;
lba += ebr->_records[1]._lba - last_lba;
last_lba = ebr->_records[1]._lba;
} while (r->valid());
}