make sectorAlignment a static method of PartitionTable; we're going to need it

in the part resizer widget

svn path=/trunk/extragear/sysadmin/partitionmanager/; revision=1103700
This commit is contained in:
Volker Lanz 2010-03-15 18:31:54 +00:00
parent 0b456bcfcc
commit 957a084149
2 changed files with 5 additions and 5 deletions

View File

@ -211,7 +211,7 @@ QStringList PartitionTable::flagNames(Flags flags)
/** @return the sector size to align the partition start and end to /** @return the sector size to align the partition start and end to
*/ */
static qint64 sectorAlignment(const Device& d) qint64 PartitionTable::sectorAlignment(const Device& d)
{ {
return d.partitionTable()->type() == PartitionTable::msdos ? d.cylinderSize() : Config::sectorAlignment(); return d.partitionTable()->type() == PartitionTable::msdos ? d.cylinderSize() : Config::sectorAlignment();
} }
@ -466,17 +466,17 @@ Partition* createUnallocated(const Device& device, PartitionNode& parent, qint64
// Leave a track (cylinder aligned) or sector alignment sectors (sector based) free at the // Leave a track (cylinder aligned) or sector alignment sectors (sector based) free at the
// start for a new partition's metadata // start for a new partition's metadata
start += device.partitionTable()->type() == PartitionTable::msdos ? device.sectorsPerTrack() : sectorAlignment(device); start += device.partitionTable()->type() == PartitionTable::msdos ? device.sectorsPerTrack() : PartitionTable::sectorAlignment(device);
// .. and also at the end for the metadata for a partition to follow us, if we're not // .. and also at the end for the metadata for a partition to follow us, if we're not
// at the end of the extended partition // at the end of the extended partition
if (end < extended->lastSector()) if (end < extended->lastSector())
end -= device.partitionTable()->type() == PartitionTable::msdos ? device.sectorsPerTrack() : sectorAlignment(device); end -= device.partitionTable()->type() == PartitionTable::msdos ? device.sectorsPerTrack() : PartitionTable::sectorAlignment(device);
r |= PartitionRole::Logical; r |= PartitionRole::Logical;
} }
if (end - start + 1 < sectorAlignment(device)) if (end - start + 1 < PartitionTable::sectorAlignment(device))
return NULL; return NULL;
return new Partition(&parent, device, PartitionRole(r), FileSystemFactory::create(FileSystem::Unknown, start, end), start, end, -1); return new Partition(&parent, device, PartitionRole(r), FileSystemFactory::create(FileSystem::Unknown, start, end), start, end, -1);

View File

@ -146,7 +146,7 @@ class LIBPARTITIONMANAGERPRIVATE_EXPORT PartitionTable : public PartitionNode
static qint64 maxPrimariesForTableType(TableType l); static qint64 maxPrimariesForTableType(TableType l);
static bool tableTypeSupportsExtended(TableType l); static bool tableTypeSupportsExtended(TableType l);
static bool tableTypeIsReadOnly(TableType l); static bool tableTypeIsReadOnly(TableType l);
static qint64 sectorAlignment(const Device& d);
protected: protected:
void setMaxPrimaries(qint32 n) { m_MaxPrimaries = n; } void setMaxPrimaries(qint32 n) { m_MaxPrimaries = n; }