From 69536b112972bea1cc15cbf516d732e7c72d3aeb Mon Sep 17 00:00:00 2001 From: Chantara Tith Date: Thu, 11 Aug 2016 21:51:52 +0700 Subject: [PATCH] Remove unused parameters from LvmDevice. --- src/core/lvmdevice.cpp | 15 +++++---------- src/core/lvmdevice.h | 10 +++++----- src/jobs/deactivatelogicalvolumejob.cpp | 2 +- src/jobs/movephysicalvolumejob.cpp | 2 +- src/jobs/setpartgeometryjob.cpp | 3 +-- 5 files changed, 13 insertions(+), 19 deletions(-) diff --git a/src/core/lvmdevice.cpp b/src/core/lvmdevice.cpp index b9502ce..80628f9 100644 --- a/src/core/lvmdevice.cpp +++ b/src/core/lvmdevice.cpp @@ -370,9 +370,8 @@ bool LvmDevice::createLV(Report& report, LvmDevice& dev, Partition& part, const return (cmd.run(-1) && cmd.exitCode() == 0); } -bool LvmDevice::createLVSnapshot(Report& report, LvmDevice& dev, Partition& lvpart, const QString& name, const qint64 extents) +bool LvmDevice::createLVSnapshot(Report& report, Partition& lvpart, const QString& name, const qint64 extents) { - Q_UNUSED(dev); QString numExtents = (extents > 0) ? QString::number(extents) : QString::number(lvpart.length()); ExternalCommand cmd(report, QStringLiteral("lvm"), @@ -387,9 +386,8 @@ bool LvmDevice::createLVSnapshot(Report& report, LvmDevice& dev, Partition& lvpa return (cmd.run(-1) && cmd.exitCode() == 0); } -bool LvmDevice::resizeLV(Report& report, LvmDevice& dev, Partition& part) +bool LvmDevice::resizeLV(Report& report, Partition& part) { - Q_UNUSED(dev); //TODO: thorough tests and add warning that it could currupt the user data. ExternalCommand cmd(report, QStringLiteral("lvm"), { QStringLiteral("lvresize"), @@ -423,9 +421,8 @@ bool LvmDevice::insertPV(Report& report, LvmDevice& dev, const QString& pvPath) return (cmd.run(-1) && cmd.exitCode() == 0); } -bool LvmDevice::movePV(Report& report, LvmDevice& dev, const QString& pvPath, const QStringList& destinations) +bool LvmDevice::movePV(Report& report, const QString& pvPath, const QStringList& destinations) { - Q_UNUSED(dev); if (FS::lvm2_pv::getAllocatedPE(pvPath) <= 0) { return true; @@ -475,9 +472,8 @@ bool LvmDevice::deactivateVG(Report& report, const LvmDevice& dev) return deactivate.run(-1) && deactivate.exitCode() == 0; } -bool LvmDevice::deactivateLV(Report& report, const LvmDevice& dev, const Partition& part) +bool LvmDevice::deactivateLV(Report& report, const Partition& part) { - Q_UNUSED(dev); ExternalCommand deactivate(report, QStringLiteral("lvm"), { QStringLiteral("lvchange"), QStringLiteral("--activate"), QStringLiteral("n"), @@ -494,9 +490,8 @@ bool LvmDevice::activateVG(Report& report, const LvmDevice& dev) return deactivate.run(-1) && deactivate.exitCode() == 0; } -bool LvmDevice::activateLV(Report& report, LvmDevice& dev, Partition& part) +bool LvmDevice::activateLV(Report& report, Partition& part) { - Q_UNUSED(dev); ExternalCommand deactivate(report, QStringLiteral("lvm"), { QStringLiteral("lvchange"), QStringLiteral("--activate"), QStringLiteral("y"), diff --git a/src/core/lvmdevice.h b/src/core/lvmdevice.h index 5d4114d..9788393 100644 --- a/src/core/lvmdevice.h +++ b/src/core/lvmdevice.h @@ -73,14 +73,14 @@ public: static bool removeLV(Report& report, LvmDevice& dev, Partition& part); static bool createLV(Report& report, LvmDevice& dev, Partition& part, const QString& lvname); - static bool createLVSnapshot(Report& report, LvmDevice& dev, Partition& lvpart, const QString& name, const qint64 extents = 0); - static bool resizeLV(Report& report, LvmDevice& dev, Partition& part); - static bool deactivateLV(Report& report, const LvmDevice& dev, const Partition& part); - static bool activateLV(Report& report, LvmDevice& dev, Partition& part); + static bool createLVSnapshot(Report& report, Partition& lvpart, const QString& name, const qint64 extents = 0); + static bool resizeLV(Report& report, Partition& part); + static bool deactivateLV(Report& report, const Partition& part); + static bool activateLV(Report& report, Partition& part); static bool removePV(Report& report, LvmDevice& dev, const QString& pvPath); static bool insertPV(Report& report, LvmDevice& dev, const QString& pvPath); - static bool movePV(Report& report, LvmDevice& dev, const QString& pvPath, const QStringList& destinations = QStringList()); + static bool movePV(Report& report, const QString& pvPath, const QStringList& destinations = QStringList()); static bool removeVG(Report& report, LvmDevice& dev); static bool createVG(Report& report, const QString vgname, const QStringList pvlist, const qint32 peSize = 4); // peSize in megabytes diff --git a/src/jobs/deactivatelogicalvolumejob.cpp b/src/jobs/deactivatelogicalvolumejob.cpp index 72f659c..e53d412 100644 --- a/src/jobs/deactivatelogicalvolumejob.cpp +++ b/src/jobs/deactivatelogicalvolumejob.cpp @@ -43,7 +43,7 @@ bool DeactivateLogicalVolumeJob::run(Report& parent) if (device().type() == Device::LVM_Device) { for (const auto &p : device().partitionTable()->children()) { if (!p->roles().has(PartitionRole::Unallocated)) { - if (!LvmDevice::deactivateLV(*report, dynamic_cast(device()), *p)) { + if (!LvmDevice::deactivateLV(*report, *p)) { rval = false; } } diff --git a/src/jobs/movephysicalvolumejob.cpp b/src/jobs/movephysicalvolumejob.cpp index 65fe47b..ac296c0 100644 --- a/src/jobs/movephysicalvolumejob.cpp +++ b/src/jobs/movephysicalvolumejob.cpp @@ -46,7 +46,7 @@ bool MovePhysicalVolumeJob::run(Report& parent) } for (const auto &partPath : partList()) { - rval = LvmDevice::movePV(*report, device(), partPath, destinations); + rval = LvmDevice::movePV(*report, partPath, destinations); if (rval == false) { break; } diff --git a/src/jobs/setpartgeometryjob.cpp b/src/jobs/setpartgeometryjob.cpp index 6de3c62..efcf3f5 100644 --- a/src/jobs/setpartgeometryjob.cpp +++ b/src/jobs/setpartgeometryjob.cpp @@ -78,12 +78,11 @@ bool SetPartGeometryJob::run(Report& parent) } else report->line() << xi18nc("@info:progress", "Could not open device %1 while trying to resize/move partition %2.", device().deviceNode(), partition().deviceNode()); } else if (device().type() == Device::LVM_Device) { - LvmDevice& dev = dynamic_cast(device()); partition().setFirstSector(newStart()); partition().setLastSector(newStart() + newLength() - 1); - rval = LvmDevice::resizeLV(*report, dev, partition()); + rval = LvmDevice::resizeLV(*report, partition()); } jobFinished(*report, rval);