From 957a084149be1cce21048517e2b6e31f9421c3ae Mon Sep 17 00:00:00 2001 From: Volker Lanz Date: Mon, 15 Mar 2010 18:31:54 +0000 Subject: [PATCH] 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 --- src/core/partitiontable.cpp | 8 ++++---- src/core/partitiontable.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/core/partitiontable.cpp b/src/core/partitiontable.cpp index 1860a5f..4af1904 100644 --- a/src/core/partitiontable.cpp +++ b/src/core/partitiontable.cpp @@ -211,7 +211,7 @@ QStringList PartitionTable::flagNames(Flags flags) /** @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(); } @@ -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 // 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 // at the end of the extended partition 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; } - if (end - start + 1 < sectorAlignment(device)) + if (end - start + 1 < PartitionTable::sectorAlignment(device)) return NULL; return new Partition(&parent, device, PartitionRole(r), FileSystemFactory::create(FileSystem::Unknown, start, end), start, end, -1); diff --git a/src/core/partitiontable.h b/src/core/partitiontable.h index 54a1148..21845a5 100644 --- a/src/core/partitiontable.h +++ b/src/core/partitiontable.h @@ -146,7 +146,7 @@ class LIBPARTITIONMANAGERPRIVATE_EXPORT PartitionTable : public PartitionNode static qint64 maxPrimariesForTableType(TableType l); static bool tableTypeSupportsExtended(TableType l); static bool tableTypeIsReadOnly(TableType l); - + static qint64 sectorAlignment(const Device& d); protected: void setMaxPrimaries(qint32 n) { m_MaxPrimaries = n; }