mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-23 09:51:57 -05:00
LibPartition: Fix end block off by one error
Previously, end block was inconsistent. GUIDPartitionTable treated end block as an inclusive bound, while MBRPartitionTable and EBRPartitionTable treated end block as an exclusive bound. Now all three treat end block as an inclusive upper bound.
This commit is contained in:
parent
fb4221ad52
commit
2f8c20816e
3 changed files with 3 additions and 6 deletions
|
@ -42,9 +42,6 @@ GUI::Variant PartitionModel::data(GUI::ModelIndex const& index, GUI::ModelRole r
|
|||
case Column::StartBlock:
|
||||
return partition.start_block();
|
||||
case Column::EndBlock:
|
||||
// FIXME: Either MBR end block is off by one (if supposed to be exclusive bound)
|
||||
// or GPT end block is off by one (if supposed to be inclusive bound).
|
||||
// This is an issue in LibPartition.
|
||||
return partition.end_block();
|
||||
default:
|
||||
VERIFY_NOT_REACHED();
|
||||
|
|
|
@ -77,7 +77,7 @@ EBRPartitionTable::EBRPartitionTable(NonnullRefPtr<Core::File> device)
|
|||
if (entry.offset == 0x00) {
|
||||
continue;
|
||||
}
|
||||
MUST(m_partitions.try_empend(entry.offset, (entry.offset + entry.length), entry.type));
|
||||
MUST(m_partitions.try_empend(entry.offset, (entry.offset + entry.length) - 1, entry.type));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -82,7 +82,7 @@ MBRPartitionTable::MBRPartitionTable(NonnullRefPtr<Core::File> device_file, u32
|
|||
if (entry.offset == 0x00) {
|
||||
continue;
|
||||
}
|
||||
MUST(m_partitions.try_empend(entry.offset, (entry.offset + entry.length), entry.type));
|
||||
MUST(m_partitions.try_empend(entry.offset, (entry.offset + entry.length) - 1, entry.type));
|
||||
}
|
||||
m_valid = true;
|
||||
}
|
||||
|
@ -106,7 +106,7 @@ MBRPartitionTable::MBRPartitionTable(NonnullRefPtr<Core::File> device_file)
|
|||
if (entry.offset == 0x00) {
|
||||
continue;
|
||||
}
|
||||
MUST(m_partitions.try_empend(entry.offset, (entry.offset + entry.length), entry.type));
|
||||
MUST(m_partitions.try_empend(entry.offset, (entry.offset + entry.length) - 1, entry.type));
|
||||
}
|
||||
m_valid = true;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue