* Only renamed a few variables to fit our style guide.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27613 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus
2008-09-18 09:14:50 +00:00
parent 21b592c551
commit 5eb27029ee
@@ -131,35 +131,36 @@ sector_align_up(off_t offset)
static bool static bool
validate_resize(partition_data *partition, off_t *size) validate_resize(partition_data *partition, off_t *size)
{ {
off_t new_size = *size; off_t newSize = *size;
// size remains the same? // size remains the same?
if (new_size == partition->size) if (newSize == partition->size)
return true; return true;
if (new_size < 0) if (newSize < 0)
new_size = 0; newSize = 0;
else else
new_size = sector_align(new_size); newSize = sector_align(newSize);
// grow partition? // grow partition?
if (new_size > partition->size) { if (newSize > partition->size) {
*size = new_size; *size = newSize;
return true; return true;
} }
// shrink partition // shrink partition
// no child has to be over the new size of the parent partition // no child has to be over the new size of the parent partition
// TODO: shouldn't be just: off_t current_end = new_size; ??? probably not // TODO: shouldn't be just: off_t currentEnd = newSize; ??? probably not
off_t current_end = partition->offset + new_size; // If child->offset is relative to parent, then yes!
off_t currentEnd = partition->offset + newSize;
for (int32 i = 0; i < partition->child_count; i++) { for (int32 i = 0; i < partition->child_count; i++) {
partition_data *child = get_child_partition(partition->id, i); partition_data *child = get_child_partition(partition->id, i);
if (child && child->offset + child->size > current_end) if (child && child->offset + child->size > currentEnd)
current_end = child->offset + child->size; currentEnd = child->offset + child->size;
} }
new_size = current_end - partition->offset; newSize = currentEnd - partition->offset;
// make the size a multiple of the block size (greater one) // make the size a multiple of the block size (greater one)
new_size = sector_align_up(new_size); newSize = sector_align_up(newSize);
*size = new_size; *size = newSize;
return true; return true;
} }