gpt: the disk system now correctly maintains free space.

* Ie. the BPartitioningInfo should now be correctly filled.
This commit is contained in:
Axel Dörfler
2013-01-24 01:15:26 +01:00
parent f142407b03
commit e26ef5524c
@@ -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;
} }