Git-Url: http://git.frugalware.org/gitweb/gitweb.cgi?p=fwsetup-ng.git;a=commitdiff;h=f9c741c3e880ba960580476a1f42961fd5e9468c
commit f9c741c3e880ba960580476a1f42961fd5e9468c Author: James Buren <[email protected]> Date: Sun Aug 26 16:26:21 2012 -0500 now, align new partitions on 1 MiB boundaries and check if there's space for them. diff --git a/Device.cc b/Device.cc index a103f9c..7fca621 100644 --- a/Device.cc +++ b/Device.cc @@ -255,9 +255,7 @@ Partition *Device::newPartition(unsigned long long size) part->setStart(_alignment); - part->setEnd(_alignment + size - 1); - - part->setSectors(size); + part->setEnd(_alignment + size); } else { @@ -268,8 +266,19 @@ Partition *Device::newPartition(unsigned long long size) part->setStart(lastpart->getEnd() + 1); part->setEnd(lastpart->getEnd() + 1 + size); - - part->setSectors(size); + } + + part->setStart(alignUp(part->getStart())); + + part->setEnd(alignUp(part->getEnd()) - 1); + + part->setSectors(part->getEnd() - part->getStart() + 1); + + if(part->getSectors() > (_sectors - part->getStart())) + { + delete part; + + return 0; } return part; _______________________________________________ Frugalware-git mailing list [email protected] http://frugalware.org/mailman/listinfo/frugalware-git
