From 5d2bb2f8afa7d03009cd5ea95a1a4f20ecab13d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrius=20=C5=A0tikonas?= Date: Thu, 3 Nov 2016 13:26:14 +0000 Subject: [PATCH] Store list of physical volumes in a global variable. --- src/core/devicescanner.cpp | 6 +++--- src/core/operationstack.h | 9 --------- src/fs/lvm2_pv.cpp | 2 ++ src/fs/lvm2_pv.h | 3 +++ 4 files changed, 8 insertions(+), 12 deletions(-) diff --git a/src/core/devicescanner.cpp b/src/core/devicescanner.cpp index c34caf0..dce2d58 100644 --- a/src/core/devicescanner.cpp +++ b/src/core/devicescanner.cpp @@ -66,7 +66,7 @@ void DeviceScanner::scan() const QList deviceList = CoreBackendManager::self()->backend()->scanDevices(); const QList lvmList = LvmDevice::scanSystemLVM(); - operationStack().physicalVolumes() = FS::lvm2_pv::getPVs(deviceList); + LVM::pvList = FS::lvm2_pv::getPVs(deviceList); for (const auto &d : deviceList) operationStack().addDevice(d); @@ -75,12 +75,12 @@ void DeviceScanner::scan() for (const auto &d : lvmList) { operationStack().addDevice(d); - operationStack().physicalVolumes().append(FS::lvm2_pv::getPVinNode(d->partitionTable())); + LVM::pvList.append(FS::lvm2_pv::getPVinNode(d->partitionTable())); } // Store list of physical volumes in LvmDevice for (const auto &d : lvmList) - for (const auto &p : operationStack().physicalVolumes()) + for (const auto &p : LVM::pvList) // FIXME: qAsConst if (p.vgName() == d->name()) d->physicalVolumes().append(p.partition()); } diff --git a/src/core/operationstack.h b/src/core/operationstack.h index 211e404..b6fbfac 100644 --- a/src/core/operationstack.h +++ b/src/core/operationstack.h @@ -19,7 +19,6 @@ #define OPERATIONSTACK__H -#include "fs/lvm2_pv.h" #include "util/libpartitionmanagerexport.h" #include @@ -75,13 +74,6 @@ public: return m_PreviewDevices; /**< @return the list of Devices */ } - QList& physicalVolumes() { - return m_LVMPhysicalVolumes; /**< @return the list of LVM PVs */ - } - const QList& physicalVolumes() const { - return m_LVMPhysicalVolumes; /**< @return the list of LVM PVs */ - } - Operations& operations() { return m_Operations; /**< @return the list of operations */ } @@ -110,7 +102,6 @@ protected: private: Operations m_Operations; mutable Devices m_PreviewDevices; - mutable QList m_LVMPhysicalVolumes; QReadWriteLock m_Lock; }; diff --git a/src/fs/lvm2_pv.cpp b/src/fs/lvm2_pv.cpp index 19fdd28..9e67ec7 100644 --- a/src/fs/lvm2_pv.cpp +++ b/src/fs/lvm2_pv.cpp @@ -289,6 +289,8 @@ QList lvm2_pv::getPVs(const QList& devices) } +QList LVM::pvList; + LvmPV::LvmPV(const QString vgName, const Partition* p, bool isLuks) : m_vgName(vgName) , m_p(p) diff --git a/src/fs/lvm2_pv.h b/src/fs/lvm2_pv.h index 0e62223..ba3ef77 100644 --- a/src/fs/lvm2_pv.h +++ b/src/fs/lvm2_pv.h @@ -57,6 +57,9 @@ private: bool m_isLuks; }; +namespace LVM { + extern LIBKPMCORE_EXPORT QList pvList; +} namespace FS {