Update some comments after understanding things better. Some things which got
me confused were perfectly correct. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27626 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -508,17 +508,19 @@ PrimaryPartition::LogicalPartitionAt(int32 index) const
|
|||||||
void
|
void
|
||||||
PrimaryPartition::AddLogicalPartition(LogicalPartition *partition)
|
PrimaryPartition::AddLogicalPartition(LogicalPartition *partition)
|
||||||
{
|
{
|
||||||
if (partition) {
|
if (!partition)
|
||||||
partition->SetPrimaryPartition(this);
|
return;
|
||||||
partition->SetPrevious(fTail);
|
|
||||||
if (fTail) {
|
partition->SetPrimaryPartition(this);
|
||||||
fTail->SetNext(partition);
|
partition->SetPrevious(fTail);
|
||||||
fTail = partition;
|
if (fTail) {
|
||||||
} else
|
fTail->SetNext(partition);
|
||||||
fHead = fTail = partition;
|
fTail = partition;
|
||||||
partition->SetNext(NULL);
|
} else
|
||||||
fLogicalPartitionCount++;
|
fHead = fTail = partition;
|
||||||
}
|
partition->SetNext(NULL);
|
||||||
|
|
||||||
|
fLogicalPartitionCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// RemoveLogicalPartition
|
// RemoveLogicalPartition
|
||||||
@@ -538,6 +540,7 @@ PrimaryPartition::RemoveLogicalPartition(LogicalPartition *partition)
|
|||||||
next->SetPrevious(prev);
|
next->SetPrevious(prev);
|
||||||
else
|
else
|
||||||
fTail = prev;
|
fTail = prev;
|
||||||
|
|
||||||
fLogicalPartitionCount--;
|
fLogicalPartitionCount--;
|
||||||
|
|
||||||
partition->SetNext(NULL);
|
partition->SetNext(NULL);
|
||||||
|
|||||||
@@ -168,7 +168,13 @@ PartitionMapParser::_ParseExtended(PrimaryPartition *primary, off_t offset)
|
|||||||
|
|
||||||
// Examine the table, there is exactly one extended and one
|
// Examine the table, there is exactly one extended and one
|
||||||
// non-extended logical partition. All four table entries are
|
// non-extended logical partition. All four table entries are
|
||||||
// examined though.
|
// examined though. If there is no inner extended partition,
|
||||||
|
// the end of the linked list is reached.
|
||||||
|
// The first PTS describing both an "inner extended" parition and a
|
||||||
|
// "data" partition (non extended and not empty) is the start sector
|
||||||
|
// of the primary extended partition. The next PTS in the linked list
|
||||||
|
// is the start sector of the inner extended partition described in
|
||||||
|
// this PTS.
|
||||||
LogicalPartition extended;
|
LogicalPartition extended;
|
||||||
LogicalPartition nonExtended;
|
LogicalPartition nonExtended;
|
||||||
for (int32 i = 0; error == B_OK && i < 4; i++) {
|
for (int32 i = 0; error == B_OK && i < 4; i++) {
|
||||||
@@ -224,7 +230,7 @@ PartitionMapParser::_ParseExtended(PrimaryPartition *primary, off_t offset)
|
|||||||
error = B_NO_MEMORY;
|
error = B_NO_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
// prepare to parse next extended partition
|
// prepare to parse next extended/non-extended partition pair
|
||||||
if (error == B_OK && !extended.IsEmpty())
|
if (error == B_OK && !extended.IsEmpty())
|
||||||
offset = extended.Offset();
|
offset = extended.Offset();
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -226,23 +226,38 @@ PartitionMapWriter::_WriteExtended(partition_table_sector *pts,
|
|||||||
return B_BAD_DATA;
|
return B_BAD_DATA;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NOTE: The OS/2 boot manager needs the first entry to describe the
|
||||||
|
// data partition, while the second entry should describe the "inner
|
||||||
|
// extended" partition.
|
||||||
|
|
||||||
// write the table
|
// write the table
|
||||||
partition_descriptor* descriptor = &(pts->table[0]);
|
partition_descriptor* descriptor = &(pts->table[0]);
|
||||||
partition->GetPartitionDescriptor(descriptor, partition->PTSOffset());
|
partition->GetPartitionDescriptor(descriptor, partition->PTSOffset());
|
||||||
// location is relative to this partitions PTS offset
|
// location is relative to this partitions PTS offset
|
||||||
|
|
||||||
// setting offset and size of the next partition in the linked list
|
// Set offset and size of the next partition in the linked list.
|
||||||
|
// This is done via a so called "inner extended" partition which is
|
||||||
|
// only used to point to the next PTS location (start sector of the
|
||||||
|
// inner extended partition).
|
||||||
descriptor = &(pts->table[1]);
|
descriptor = &(pts->table[1]);
|
||||||
LogicalPartition extended;
|
LogicalPartition extended;
|
||||||
if (next) {
|
if (next) {
|
||||||
extended.SetPTSOffset(partition->PTSOffset());
|
extended.SetPTSOffset(partition->PTSOffset());
|
||||||
extended.SetOffset(next->PTSOffset());
|
extended.SetOffset(next->PTSOffset());
|
||||||
extended.SetSize(next->Size() + next->Offset() - next->PTSOffset());
|
|
||||||
// TODO: The size calculation looks suspicious.
|
// Strictly speaking, the size is not relevant and just needs to
|
||||||
// Isn't next->Offset() relative to primary extended patition while
|
// be non-zero. But some operating systems check the size of
|
||||||
// next->PTSOffset() is not?
|
// inner extended partitions and it needs to include the next data
|
||||||
|
// partition. Therefor the size is the size of the next data partition
|
||||||
|
// plus the offset between the next PTS and the data partition start
|
||||||
|
// offset. This assumes of course that the start offset is behind
|
||||||
|
// the PTS offset, which is actually not dictated by a minimal
|
||||||
|
// specification.
|
||||||
|
extended.SetSize(next->Size() + (next->Offset() - next->PTSOffset()));
|
||||||
|
|
||||||
|
// Use the same extended partition type as the primary extended
|
||||||
|
// partition.
|
||||||
extended.SetType(partition->GetPrimaryPartition()->Type());
|
extended.SetType(partition->GetPrimaryPartition()->Type());
|
||||||
// TODO: Weird.
|
|
||||||
|
|
||||||
extended.GetPartitionDescriptor(descriptor, 0);
|
extended.GetPartitionDescriptor(descriptor, 0);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user