rename Device::sectorSize() to Device::logicalSectorSize()

svn path=/trunk/extragear/sysadmin/partitionmanager/; revision=1135506
This commit is contained in:
Volker Lanz 2010-06-07 13:10:55 +00:00
parent 0d9f974c79
commit 2b50c60469
9 changed files with 13 additions and 13 deletions

View File

@ -63,7 +63,7 @@ bool CopySourceDevice::open()
*/
qint32 CopySourceDevice::sectorSize() const
{
return device().sectorSize();
return device().logicalSectorSize();
}
/** Returns the length of this CopySource

View File

@ -58,7 +58,7 @@ bool CopyTargetDevice::open()
/** @return the Device's sector size */
qint32 CopyTargetDevice::sectorSize() const
{
return device().sectorSize();
return device().logicalSectorSize();
}
/** Writes the given number of sectors to the Device.

View File

@ -56,7 +56,7 @@ class LIBPARTITIONMANAGERPRIVATE_EXPORT Device : public QObject
public:
bool operator==(const Device& other) const;
bool operator!=(const Device& other) const;
const QString& name() const { return m_Name; } /**< @return the Device's name, usually some manufacturer string */
const QString& deviceNode() const { return m_DeviceNode; } /**< @return the Device's node, for example "/dev/sda" */
PartitionTable* partitionTable() { return m_PartitionTable; } /**< @return the Device's PartitionTable */
@ -64,9 +64,9 @@ class LIBPARTITIONMANAGERPRIVATE_EXPORT Device : public QObject
qint32 heads() const { return m_Heads; } /**< @return the number of heads on the Device in CHS notation */
qint32 cylinders() const { return m_Cylinders; } /**< @return the number of cylinders on the Device in CHS notation */
qint32 sectorsPerTrack() const { return m_SectorsPerTrack; } /**< @return the number of sectors on the Device in CHS notation */
qint32 sectorSize() const { return m_SectorSize; } /**< @return the sector size the Device claims to use */
qint32 logicalSectorSize() const { return m_SectorSize; } /**< @return the logical sector size the Device uses */
qint64 totalSectors() const { return static_cast<qint64>(heads()) * cylinders() * sectorsPerTrack(); } /**< @return the total number of sectors on the device */
qint64 capacity() const { return totalSectors() * sectorSize(); } /**< @return the Device's capacity in bytes */
qint64 capacity() const { return totalSectors() * logicalSectorSize(); } /**< @return the Device's capacity in bytes */
qint64 cylinderSize() const { return static_cast<qint64>(heads()) * sectorsPerTrack(); } /**< @return the size of a cylinder on this Device in sectors */
void setIconName(const QString& name) { m_IconName = name; }

View File

@ -62,7 +62,7 @@ Partition::Partition(PartitionNode* parent, const Device& device, const Partitio
m_AvailableFlags(availableFlags),
m_ActiveFlags(activeFlags),
m_IsMounted(mounted),
m_SectorSize(device.sectorSize()),
m_SectorSize(device.logicalSectorSize()),
m_State(state)
{
Q_ASSERT(m_Parent);

View File

@ -105,7 +105,7 @@ void DevicePropsDialog::setupDialog()
dialogWidget().cylinderSize().setText(i18ncp("@label", "1 Sector", "%1 Sectors", device().cylinderSize()));
dialogWidget().primariesMax().setText(maxPrimaries);
dialogWidget().sectorSize().setText(Capacity(device().sectorSize()).toString(Capacity::Byte, Capacity::AppendUnit));
dialogWidget().sectorSize().setText(Capacity(device().logicalSectorSize()).toString(Capacity::Byte, Capacity::AppendUnit));
dialogWidget().totalSectors().setText(KGlobal::locale()->formatNumber(device().totalSectors(), 0));
dialogWidget().type().setText(type);

View File

@ -151,7 +151,7 @@ void InfoPane::showDevice(Qt::DockWidgetArea area, const Device& d)
createLabels(i18nc("@label device", "Heads:"), QString::number(d.heads()), cols(area), x, y);
createLabels(i18nc("@label device", "Cylinders:"), KGlobal::locale()->formatNumber(d.cylinders(), 0), cols(area), x, y);
createLabels(i18nc("@label device", "Sectors:"), KGlobal::locale()->formatNumber(d.sectorsPerTrack(), 0), cols(area), x, y);
createLabels(i18nc("@label device", "Logical sector size:"), Capacity(d.sectorSize()).toString(Capacity::Byte, Capacity::AppendUnit), cols(area), x, y);
createLabels(i18nc("@label device", "Logical sector size:"), Capacity(d.logicalSectorSize()).toString(Capacity::Byte, Capacity::AppendUnit), cols(area), x, y);
createLabels(i18nc("@label device", "Cylinder size:"), i18ncp("@label", "1 Sector", "%1 Sectors", d.cylinderSize()), cols(area), x, y);
createLabels(i18nc("@label device", "Primaries/Max:"), maxPrimaries, cols(area), x, y);
}

View File

@ -59,7 +59,7 @@ bool BackupFileSystemJob::run(Report& parent)
else if (sourcePartition().fileSystem().supportBackup() == FileSystem::cmdSupportCore)
{
CopySourceDevice copySource(sourceDevice(), sourcePartition().fileSystem().firstSector(), sourcePartition().fileSystem().lastSector());
CopyTargetFile copyTarget(fileName(), sourceDevice().sectorSize());
CopyTargetFile copyTarget(fileName(), sourceDevice().logicalSectorSize());
if (!copySource.open())
report->line() << i18nc("@info/plain", "Could not open file system on source partition <filename>%1</filename> for backup.", sourcePartition().deviceNode());

View File

@ -200,10 +200,10 @@ QString ResizeOperation::description() const
// Each of these needs a different description. And for reasons of i18n, we cannot
// just concatenate strings together...
const QString moveDelta = Capacity(qAbs(newFirstSector() - origFirstSector()) * targetDevice().sectorSize()).toString();
const QString moveDelta = Capacity(qAbs(newFirstSector() - origFirstSector()) * targetDevice().logicalSectorSize()).toString();
const QString origCapacity = Capacity(origLength() * targetDevice().sectorSize()).toString();
const QString newCapacity = Capacity(newLength() * targetDevice().sectorSize()).toString();
const QString origCapacity = Capacity(origLength() * targetDevice().logicalSectorSize()).toString();
const QString newCapacity = Capacity(newLength() * targetDevice().logicalSectorSize()).toString();
switch(resizeAction())
{

View File

@ -228,7 +228,7 @@ Partition* RestoreOperation::createRestorePartition(const Device& device, Partit
if (!fileInfo.exists())
return NULL;
const qint64 end = start + fileInfo.size() / device.sectorSize() - 1;
const qint64 end = start + fileInfo.size() / device.logicalSectorSize() - 1;
Partition* p = new Partition(&parent, device, PartitionRole(r), FileSystemFactory::create(FileSystem::Unknown, start, end), start, end, -1);
p->setState(Partition::StateRestore);