gpt: the disk system now correctly maintains free space.
* Ie. the BPartitioningInfo should now be correctly filled.
This commit is contained in:
@@ -102,12 +102,19 @@ GPTPartitionHandle::GetPartitioningInfo(BPartitioningInfo* info)
|
|||||||
{
|
{
|
||||||
// init to the full size (minus the first sector)
|
// init to the full size (minus the first sector)
|
||||||
off_t size = Partition()->ContentSize();
|
off_t size = Partition()->ContentSize();
|
||||||
status_t error = info->SetTo(Partition()->BlockSize(),
|
status_t status = info->SetTo(Partition()->BlockSize(),
|
||||||
size - Partition()->BlockSize());
|
size - Partition()->BlockSize());
|
||||||
if (error != B_OK)
|
if (status != B_OK)
|
||||||
return error;
|
return status;
|
||||||
|
|
||||||
// TODO: exclude the space of the existing partitions
|
// Exclude the space of the existing partitions
|
||||||
|
size_t count = Partition()->CountChildren();
|
||||||
|
for (size_t index = 0; index < count; index++) {
|
||||||
|
BMutablePartition* child = Partition()->ChildAt(index);
|
||||||
|
status = info->ExcludeOccupiedSpace(child->Offset(), child->Size());
|
||||||
|
if (status != B_OK)
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user