Make sectorAlignment a static setting in PartitionAlignment.
Also yank out cylinder alignment from sectorAlignment.
This commit is contained in:
parent
0a4ac3065b
commit
f343f4c3b2
|
@ -29,6 +29,8 @@
|
|||
|
||||
#include <config.h>
|
||||
|
||||
int PartitionAlignment::s_sectorAlignment = 2048;
|
||||
|
||||
qint64 PartitionAlignment::firstDelta(const Device& d, const Partition& p, qint64 s)
|
||||
{
|
||||
if (d.partitionTable()->type() == PartitionTable::msdos) {
|
||||
|
@ -93,7 +95,12 @@ bool PartitionAlignment::isAligned(const Device& d, const Partition& p, qint64 n
|
|||
*/
|
||||
qint64 PartitionAlignment::sectorAlignment(const Device& d)
|
||||
{
|
||||
return d.partitionTable()->type() == PartitionTable::msdos ? d.cylinderSize() : Config::sectorAlignment();
|
||||
return s_sectorAlignment;
|
||||
}
|
||||
|
||||
void PartitionAlignment::setSectorAlignment(int sectorAlignment)
|
||||
{
|
||||
s_sectorAlignment = sectorAlignment;
|
||||
}
|
||||
|
||||
qint64 PartitionAlignment::alignedFirstSector(const Device& d, const Partition& p, qint64 s, qint64 min_first, qint64 max_first, qint64 min_length, qint64 max_length)
|
||||
|
|
|
@ -32,6 +32,7 @@ private:
|
|||
PartitionAlignment();
|
||||
|
||||
public:
|
||||
|
||||
static bool isAligned(const Device& d, const Partition& p, bool quiet = false);
|
||||
static bool isAligned(const Device& d, const Partition& p, qint64 newFirst, qint64 newLast, bool quiet);
|
||||
|
||||
|
@ -41,11 +42,22 @@ public:
|
|||
|
||||
static qint64 sectorAlignment(const Device& d);
|
||||
|
||||
/** Sets the sector alignment multiplier for ALL devices henceforth except
|
||||
* for devices that have a disklabel which aligns to cylinder boundaries.
|
||||
* The default is 2048.
|
||||
* This should probably be only set once on startup if necessary and not
|
||||
* changed afterwards.
|
||||
*/
|
||||
static void setSectorAlignment( int sectorAlignment );
|
||||
|
||||
static qint64 firstDelta(const Device& d, const Partition& p, qint64 s);
|
||||
|
||||
static qint64 lastDelta(const Device& d, const Partition& p, qint64 s);
|
||||
|
||||
static bool isLengthAligned(const Device& d, const Partition& p);
|
||||
|
||||
private:
|
||||
static int s_sectorAlignment;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue