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:
parent
5eb27029ee
commit
daa191ec7c
@ -166,49 +166,51 @@ PartitionMapParser::_ParseExtended(PrimaryPartition *primary, off_t offset)
|
||||
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 nonExtended;
|
||||
if (error == B_OK) {
|
||||
for (int32 i = 0; error == B_OK && i < 4; i++) {
|
||||
const partition_descriptor *descriptor = &fPTS->table[i];
|
||||
LogicalPartition *partition = NULL;
|
||||
if (!descriptor->is_empty()) {
|
||||
if (descriptor->is_extended()) {
|
||||
if (extended.IsEmpty()) {
|
||||
extended.SetTo(descriptor, offset, primary);
|
||||
partition = &extended;
|
||||
} else {
|
||||
// only one extended partition allowed
|
||||
error = B_BAD_DATA;
|
||||
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()));
|
||||
}
|
||||
for (int32 i = 0; error == B_OK && i < 4; i++) {
|
||||
const partition_descriptor *descriptor = &fPTS->table[i];
|
||||
if (descriptor->is_empty())
|
||||
continue;
|
||||
|
||||
LogicalPartition *partition = NULL;
|
||||
if (descriptor->is_extended()) {
|
||||
if (extended.IsEmpty()) {
|
||||
extended.SetTo(descriptor, offset, primary);
|
||||
partition = &extended;
|
||||
} else {
|
||||
// only one extended partition allowed
|
||||
error = B_BAD_DATA;
|
||||
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"));
|
||||
}
|
||||
}
|
||||
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()));
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user