From f572681684ba0bf02ffeaf5408ccdd550b55a248 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrius=20=C5=A0tikonas?= Date: Sun, 15 Jul 2018 00:28:38 +0100 Subject: [PATCH] Partially revert 252b1086606e57626a75544dda557e960ba79b53. That commit broke LVM support. --- src/core/lvmdevice.cpp | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/src/core/lvmdevice.cpp b/src/core/lvmdevice.cpp index 7842777..96957be 100644 --- a/src/core/lvmdevice.cpp +++ b/src/core/lvmdevice.cpp @@ -90,18 +90,18 @@ LvmDevice::~LvmDevice() void LvmDevice::initPartitions() { qint64 firstUsable = 0; - qint64 lastusable = totalPE() - 1; - PartitionTable* pTable = new PartitionTable(PartitionTable::vmd, firstUsable, lastusable); + qint64 lastUsable = totalPE() - 1; + PartitionTable* pTable = new PartitionTable(PartitionTable::vmd, firstUsable, lastUsable); for (const auto &p : scanPartitions(pTable)) { LVSizeMap()->insert(p->partitionPath(), p->length()); pTable->append(p); } - if (!pTable) + if (pTable) pTable->updateUnallocated(*this); else - pTable = new PartitionTable(PartitionTable::vmd, firstUsable, lastusable); + pTable = new PartitionTable(PartitionTable::vmd, firstUsable, lastUsable); setPartitionTable(pTable); } @@ -109,8 +109,6 @@ void LvmDevice::initPartitions() /** * Scan LVM LV Partitions * - * This deletes pTable when LVM scanning error is encountered - * * @param pTable Virtual PartitionTable of LVM device * @return an initialized Partition(LV) list */ @@ -119,13 +117,7 @@ const QList LvmDevice::scanPartitions(PartitionTable* pTable) const QList pList; for (const auto &lvPath : partitionNodes()) { Partition *p = scanPartition(lvPath, pTable); - if (p) - pList.append(p); - else { - pList.clear(); - delete pTable; - break; - } + pList.append(p); } return pList; } @@ -149,9 +141,6 @@ Partition* LvmDevice::scanPartition(const QString& lvPath, PartitionTable* pTabl activateLV(lvPath); qint64 lvSize = getTotalLE(lvPath); - if (lvSize == -1) - return nullptr; - qint64 startSector = mappedSector(lvPath, 0); qint64 endSector = startSector + lvSize - 1;