Git-Url: http://git.frugalware.org/gitweb/gitweb.cgi?p=fwsetup-ng.git;a=commitdiff;h=0f7ebc94bc77628de2153d502b9f6b9c45fe5503
commit 0f7ebc94bc77628de2153d502b9f6b9c45fe5503 Author: James Buren <[email protected]> Date: Sun Aug 26 18:04:10 2012 -0500 fix some bugs in newPartition() diff --git a/Device.cc b/Device.cc index 0601000..d2f4e07 100644 --- a/Device.cc +++ b/Device.cc @@ -174,7 +174,7 @@ bool Device::read(const string &path) if(!table->read(path)) { delete table; - + table = new GptPartitionTable(); if(!table->read(path)) @@ -246,13 +246,13 @@ Partition *Device::newPartition(unsigned long long size) // Check for a sane state. if(!_initialized || size == 0 || _table == 0) return 0; - - sectors = sectorsToSize(size); + + sectors = sizeToSectors(size); label = _table->getLabelType(); last = _table->getTableSize(); - + // Initial checks for resource limits. if(sectors > _sectors || (label == "dos" && (last+1) > 60) || (label == "gpt" && (last+1) > 128)) return 0; @@ -265,7 +265,7 @@ Partition *Device::newPartition(unsigned long long size) part->setStart(_alignment); - part->setEnd(_alignment + size); + part->setEnd(_alignment + sectors); } else { @@ -275,7 +275,7 @@ Partition *Device::newPartition(unsigned long long size) part->setStart(lastpart->getEnd() + 1); - part->setEnd(lastpart->getEnd() + 1 + size); + part->setEnd(lastpart->getEnd() + 1 + sectors); } part->setStart(alignUp(part->getStart())); @@ -284,6 +284,10 @@ Partition *Device::newPartition(unsigned long long size) part->setSectors(part->getEnd() - part->getStart() + 1); + part->setActive(false); + + part->setPurpose("data"); + if(part->getSectors() > (_sectors - part->getStart())) { delete part; _______________________________________________ Frugalware-git mailing list [email protected] http://frugalware.org/mailman/listinfo/frugalware-git
