API Changes, logicalSectorSize -> logicalSize, totalSectors -> totalLogical.

This commit is contained in:
Chantara Tith 2016-08-31 10:30:45 +07:00 committed by Philip
parent 8882a477be
commit ff86874d66
6 changed files with 15 additions and 15 deletions

View File

@ -128,11 +128,11 @@ doAutopartition( PartitionCoreModule* core, Device* dev, const QString& luksPass
empty_space_size = 1;
}
qint64 firstFreeSector = empty_space_size MiB / dev->logicalSectorSize() + 1;
qint64 firstFreeSector = empty_space_size MiB / dev->logicalSize() + 1;
if ( isEfi )
{
qint64 lastSector = firstFreeSector + ( uefisys_part_size MiB / dev->logicalSectorSize() );
qint64 lastSector = firstFreeSector + ( uefisys_part_size MiB / dev->logicalSize() );
core->createPartitionTable( dev, PartitionTable::gpt );
Partition* efiPartition = KPMHelpers::createNewPartition(
dev->partitionTable(),
@ -157,7 +157,7 @@ doAutopartition( PartitionCoreModule* core, Device* dev, const QString& luksPass
}
bool shouldCreateSwap = false;
qint64 availableSpaceB = ( dev->totalSectors() - firstFreeSector ) * dev->logicalSectorSize();
qint64 availableSpaceB = ( dev->totalLogical() - firstFreeSector ) * dev->logicalSize();
qint64 suggestedSwapSizeB = swapSuggestion( availableSpaceB );
qint64 requiredSpaceB =
( Calamares::JobQueue::instance()->
@ -168,10 +168,10 @@ doAutopartition( PartitionCoreModule* core, Device* dev, const QString& luksPass
// If there is enough room for ESP + root + swap, create swap, otherwise don't.
shouldCreateSwap = availableSpaceB > requiredSpaceB;
qint64 lastSectorForRoot = dev->totalSectors() - 1; //last sector of the device
qint64 lastSectorForRoot = dev->totalLogical() - 1; //last sector of the device
if ( shouldCreateSwap )
{
lastSectorForRoot -= suggestedSwapSizeB / dev->logicalSectorSize() + 1;
lastSectorForRoot -= suggestedSwapSizeB / dev->logicalSize() + 1;
}
Partition* rootPartition = nullptr;
@ -213,7 +213,7 @@ doAutopartition( PartitionCoreModule* core, Device* dev, const QString& luksPass
PartitionRole( PartitionRole::Primary ),
FileSystem::LinuxSwap,
lastSectorForRoot + 1,
dev->totalSectors() - 1
dev->totalLogical() - 1
);
}
else
@ -224,7 +224,7 @@ doAutopartition( PartitionCoreModule* core, Device* dev, const QString& luksPass
PartitionRole( PartitionRole::Primary ),
FileSystem::LinuxSwap,
lastSectorForRoot + 1,
dev->totalSectors() - 1,
dev->totalLogical() - 1,
luksPassphrase
);
}

View File

@ -148,7 +148,7 @@ PartitionModel::data( const QModelIndex& index, int role ) const
return PartitionInfo::mountPoint( partition );
if ( col == SizeColumn )
{
qint64 size = ( partition->lastSector() - partition->firstSector() + 1 ) * m_device->logicalSectorSize();
qint64 size = ( partition->lastSector() - partition->firstSector() + 1 ) * m_device->logicalSize();
return KFormat().formatByteSize( size );
}
cDebug() << "Unknown column" << col;
@ -175,12 +175,12 @@ PartitionModel::data( const QModelIndex& index, int role ) const
}
}
QString prettyFileSystem = KPMHelpers::prettyNameForFileSystemType( partition->fileSystem().type() );
qint64 size = ( partition->lastSector() - partition->firstSector() + 1 ) * m_device->logicalSectorSize();
qint64 size = ( partition->lastSector() - partition->firstSector() + 1 ) * m_device->logicalSize();
QString prettySize = KFormat().formatByteSize( size );
return QVariant(name + " " + prettyFileSystem + " " + prettySize);
}
case SizeRole:
return ( partition->lastSector() - partition->firstSector() + 1 ) * m_device->logicalSectorSize();
return ( partition->lastSector() - partition->firstSector() + 1 ) * m_device->logicalSize();
case IsFreeSpaceRole:
return KPMHelpers::isPartitionFreeSpace( partition );

View File

@ -594,7 +594,7 @@ ChoicePage::doAlongsideApply()
qint64 oldLastSector = candidate->lastSector();
qint64 newLastSector = firstSector +
m_afterPartitionSplitterWidget->splitPartitionSize() /
dev->logicalSectorSize();
dev->logicalSize();
m_core->resizePartition( dev, candidate, firstSector, newLastSector );
Partition* newPartition = nullptr;

View File

@ -47,7 +47,7 @@ QStringList
buildUnknownDisklabelTexts( Device* dev )
{
QStringList texts = { QObject::tr( "Unpartitioned space or unknown partition table" ),
KFormat().formatByteSize( dev->totalSectors() * dev->logicalSectorSize() ) };
KFormat().formatByteSize( dev->totalLogical() * dev->logicalSize() ) };
return texts;
}

View File

@ -135,7 +135,7 @@ PartitionSizeController::updatePartResizerWidget()
return;
m_updating = true;
qint64 sectorSize = qint64( m_spinBox->value() ) * 1024 * 1024 / m_device->logicalSectorSize();
qint64 sectorSize = qint64( m_spinBox->value() ) * 1024 * 1024 / m_device->logicalSize();
qint64 firstSector = m_partition->firstSector();
qint64 lastSector = firstSector + sectorSize - 1;
@ -185,7 +185,7 @@ PartitionSizeController::doUpdateSpinBox()
{
if ( !m_spinBox )
return;
qint64 mbSize = m_partition->length() * m_device->logicalSectorSize() / 1024 / 1024;
qint64 mbSize = m_partition->length() * m_device->logicalSize() / 1024 / 1024;
m_spinBox->setValue( mbSize );
if ( m_currentSpinBoxValue != -1 && //if it's not the first time we're setting it
m_currentSpinBoxValue != mbSize ) //and the operation changes the SB value

View File

@ -93,7 +93,7 @@ public:
break;
case FileSystem::cmdSupportFileSystem:
{
qint64 byteLength = m_device->logicalSectorSize() * m_length;
qint64 byteLength = m_device->logicalSize() * m_length;
bool ok = fs.resize( report, m_partition->partitionPath(), byteLength );
if ( !ok )
return Calamares::JobResult::error(