Skip to content

Commit

Permalink
gpt: the disk system now correctly maintains free space.
Browse files Browse the repository at this point in the history
* Ie. the BPartitioningInfo should now be correctly filled.
  • Loading branch information
axeld committed Jan 24, 2013
1 parent f142407 commit e26ef55
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/add-ons/disk_systems/gpt/GPTPartitionHandle.cpp
Expand Up @@ -102,12 +102,19 @@ GPTPartitionHandle::GetPartitioningInfo(BPartitioningInfo* info)
{
// init to the full size (minus the first sector)
off_t size = Partition()->ContentSize();
status_t error = info->SetTo(Partition()->BlockSize(),
status_t status = info->SetTo(Partition()->BlockSize(),
size - Partition()->BlockSize());
if (error != B_OK)
return error;

// TODO: exclude the space of the existing partitions
if (status != B_OK)
return status;

// 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;
}
Expand Down

0 comments on commit e26ef55

Please sign in to comment.