diff --git a/AUTHORS b/AUTHORS index a1c1bae5b..36ffdcdab 100644 --- a/AUTHORS +++ b/AUTHORS @@ -11,6 +11,7 @@ Andrius Štikonas Bernhard Landauer Bezzy1999 bill-auger +Caio Jordão Carvalho crispg72 demmm Gabriel Craciunescu diff --git a/src/modules/partition/core/PartitionCoreModule.cpp b/src/modules/partition/core/PartitionCoreModule.cpp index d3a7cfb11..f183d6c40 100644 --- a/src/modules/partition/core/PartitionCoreModule.cpp +++ b/src/modules/partition/core/PartitionCoreModule.cpp @@ -55,6 +55,7 @@ #include #include #include +#include #include #include #include @@ -550,26 +551,22 @@ PartitionCoreModule::lvmPVs() const bool PartitionCoreModule::hasVGwithThisName( const QString& name ) const { - for ( DeviceInfo* d : m_deviceInfos ) - if ( dynamic_cast(d->device.data()) && - d->device.data()->name() == name) - return true; + auto condition = [ name ]( DeviceInfo* d ) { + return dynamic_cast(d->device.data()) && d->device.data()->name() == name; + }; - return false; + return std::find_if( m_deviceInfos.begin(), m_deviceInfos.end(), condition ) != m_deviceInfos.end(); } bool PartitionCoreModule::isInVG( const Partition *partition ) const { - for ( DeviceInfo* d : m_deviceInfos ) - { - LvmDevice* vg = dynamic_cast( d->device.data() ); + auto condition = [ partition ]( DeviceInfo* d ) { + LvmDevice* vg = dynamic_cast( d->device.data()); + return vg && vg->physicalVolumes().contains( partition ); + }; - if ( vg && vg->physicalVolumes().contains( partition )) - return true; - } - - return false; + return std::find_if( m_deviceInfos.begin(), m_deviceInfos.end(), condition ) != m_deviceInfos.end(); } void @@ -686,12 +683,13 @@ PartitionCoreModule::scanForLVMPVs() } } - // Update LVM::pvList - LvmDevice::scanSystemLVM( physicalDevices ); - #ifdef WITH_KPMCOREGT33 + VolumeManagerDevice::scanDevices( physicalDevices ); + for ( auto p : LVM::pvList::list() ) #else + LvmDevice::scanSystemLVM( physicalDevices ); + for ( auto p : LVM::pvList ) #endif {