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:
@@ -166,49 +166,51 @@ 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())
|
||||||
LogicalPartition *partition = NULL;
|
continue;
|
||||||
if (!descriptor->is_empty()) {
|
|
||||||
if (descriptor->is_extended()) {
|
LogicalPartition *partition = NULL;
|
||||||
if (extended.IsEmpty()) {
|
if (descriptor->is_extended()) {
|
||||||
extended.SetTo(descriptor, offset, primary);
|
if (extended.IsEmpty()) {
|
||||||
partition = &extended;
|
extended.SetTo(descriptor, offset, primary);
|
||||||
} else {
|
partition = &extended;
|
||||||
// only one extended partition allowed
|
} else {
|
||||||
error = B_BAD_DATA;
|
// only one extended partition allowed
|
||||||
TRACE(("intel: _ParseExtended(): "
|
error = B_BAD_DATA;
|
||||||
"only one extended partition allowed\n"));
|
TRACE(("intel: _ParseExtended(): "
|
||||||
}
|
"only one extended partition allowed\n"));
|
||||||
} else {
|
|
||||||
if (nonExtended.IsEmpty()) {
|
|
||||||
nonExtended.SetTo(descriptor, offset, primary);
|
|
||||||
partition = &nonExtended;
|
|
||||||
} else {
|
|
||||||
// only one non-extended partition allowed
|
|
||||||
error = B_BAD_DATA;
|
|
||||||
TRACE(("intel: _ParseExtended(): only one "
|
|
||||||
"non-extended partition allowed\n"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#ifdef _BOOT_MODE
|
|
||||||
// work-around potential BIOS problems
|
|
||||||
if (partition)
|
|
||||||
partition->AdjustSize(fSessionSize);
|
|
||||||
#endif
|
|
||||||
// check the partition's location
|
|
||||||
if (partition && !partition->CheckLocation(fSessionSize)) {
|
|
||||||
error = B_BAD_DATA;
|
|
||||||
TRACE(("intel: _ParseExtended(): Invalid partition "
|
|
||||||
"location: pts: %lld, offset: %lld, size: %lld\n",
|
|
||||||
partition->PTSOffset(), partition->Offset(),
|
|
||||||
partition->Size()));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
if (nonExtended.IsEmpty()) {
|
||||||
|
nonExtended.SetTo(descriptor, offset, primary);
|
||||||
|
partition = &nonExtended;
|
||||||
|
} else {
|
||||||
|
// only one non-extended partition allowed
|
||||||
|
error = B_BAD_DATA;
|
||||||
|
TRACE(("intel: _ParseExtended(): only one "
|
||||||
|
"non-extended partition allowed\n"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (partition == NULL)
|
||||||
|
break;
|
||||||
|
#ifdef _BOOT_MODE
|
||||||
|
// work-around potential BIOS problems
|
||||||
|
partition->AdjustSize(fSessionSize);
|
||||||
|
#endif
|
||||||
|
// check the partition's location
|
||||||
|
if (!partition->CheckLocation(fSessionSize)) {
|
||||||
|
error = B_BAD_DATA;
|
||||||
|
TRACE(("intel: _ParseExtended(): Invalid partition "
|
||||||
|
"location: pts: %lld, offset: %lld, size: %lld\n",
|
||||||
|
partition->PTSOffset(), partition->Offset(),
|
||||||
|
partition->Size()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user