Simplified a bit the extended partition parsing loop, no functional changes

intended. I am wondering though about the offset that is passed to the
logical partitions. If I am not confused, later partitions still use the
primary partition's offset as base offset, so I am wondering if more than
two non-extended logical partitions would work.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27614 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus
2008-09-18 09:19:20 +00:00
parent 5eb27029ee
commit daa191ec7c
@@ -166,14 +166,17 @@ PartitionMapParser::_ParseExtended(PrimaryPartition *primary, off_t offset)
break; break;
} }
// examine the table // Examine the table, there is exactly one extended and one
// non-extended logical partition. All four table entries are
// examined though.
LogicalPartition extended; LogicalPartition extended;
LogicalPartition nonExtended; LogicalPartition nonExtended;
if (error == B_OK) {
for (int32 i = 0; error == B_OK && i < 4; i++) { for (int32 i = 0; error == B_OK && i < 4; i++) {
const partition_descriptor *descriptor = &fPTS->table[i]; const partition_descriptor *descriptor = &fPTS->table[i];
if (descriptor->is_empty())
continue;
LogicalPartition *partition = NULL; LogicalPartition *partition = NULL;
if (!descriptor->is_empty()) {
if (descriptor->is_extended()) { if (descriptor->is_extended()) {
if (extended.IsEmpty()) { if (extended.IsEmpty()) {
extended.SetTo(descriptor, offset, primary); extended.SetTo(descriptor, offset, primary);
@@ -195,13 +198,14 @@ PartitionMapParser::_ParseExtended(PrimaryPartition *primary, off_t offset)
"non-extended partition allowed\n")); "non-extended partition allowed\n"));
} }
} }
if (partition == NULL)
break;
#ifdef _BOOT_MODE #ifdef _BOOT_MODE
// work-around potential BIOS problems // work-around potential BIOS problems
if (partition)
partition->AdjustSize(fSessionSize); partition->AdjustSize(fSessionSize);
#endif #endif
// check the partition's location // check the partition's location
if (partition && !partition->CheckLocation(fSessionSize)) { if (!partition->CheckLocation(fSessionSize)) {
error = B_BAD_DATA; error = B_BAD_DATA;
TRACE(("intel: _ParseExtended(): Invalid partition " TRACE(("intel: _ParseExtended(): Invalid partition "
"location: pts: %lld, offset: %lld, size: %lld\n", "location: pts: %lld, offset: %lld, size: %lld\n",
@@ -209,8 +213,6 @@ PartitionMapParser::_ParseExtended(PrimaryPartition *primary, off_t offset)
partition->Size())); partition->Size()));
} }
} }
}
}
// add non-extended partition to list // add non-extended partition to list
if (error == B_OK && !nonExtended.IsEmpty()) { if (error == B_OK && !nonExtended.IsEmpty()) {