From 252006ea259cf0297b324ac60c1608f4b40ecbe2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrius=20=C5=A0tikonas?= Date: Sun, 3 Sep 2017 20:45:24 +0100 Subject: [PATCH] kpmcore now requires passing sector size to FileSystem. --- src/modules/partition/CMakeLists.txt | 4 ++++ src/modules/partition/core/KPMHelpers.cpp | 16 ++++++++++++++-- .../partition/tests/PartitionJobTests.cpp | 6 +++++- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/src/modules/partition/CMakeLists.txt b/src/modules/partition/CMakeLists.txt index 5f64b6530..0291c46e4 100644 --- a/src/modules/partition/CMakeLists.txt +++ b/src/modules/partition/CMakeLists.txt @@ -8,6 +8,10 @@ find_package( KF5 REQUIRED CoreAddons ) # These are needed because KPMcore links publicly against ConfigCore, I18n, IconThemes, KIOCore and Service find_package( KF5 REQUIRED Config I18n IconThemes KIO Service ) +find_package( KPMcore 3.1.50 ) +if ( ${KPMcore_FOUND} ) + add_definitions(-DWITH_KPMCORE22) +endif() find_package( KPMcore 3.0.3 REQUIRED ) find_library( atasmart_LIB atasmart ) find_library( blkid_LIB blkid ) diff --git a/src/modules/partition/core/KPMHelpers.cpp b/src/modules/partition/core/KPMHelpers.cpp index fc93b6bd7..6ed167eee 100644 --- a/src/modules/partition/core/KPMHelpers.cpp +++ b/src/modules/partition/core/KPMHelpers.cpp @@ -23,6 +23,7 @@ #include "core/PartitionIterator.h" // KPMcore +#include #include #include #include @@ -114,7 +115,11 @@ createNewPartition( PartitionNode* parent, qint64 lastSector, PartitionTable::Flags flags ) { - FileSystem* fs = FileSystemFactory::create( fsType, firstSector, lastSector ); + FileSystem* fs = FileSystemFactory::create( fsType, firstSector, lastSector +#ifdef WITH_KPMCORE22 + ,device.logicalSize() +#endif + ); return new Partition( parent, device, @@ -147,7 +152,11 @@ createNewEncryptedPartition( PartitionNode* parent, FS::luks* fs = dynamic_cast< FS::luks* >( FileSystemFactory::create( FileSystem::Luks, firstSector, - lastSector ) ); + lastSector +#ifdef WITH_KPMCORE22 + ,device.logicalSize() +#endif + ) ); if ( !fs ) { qDebug() << "ERROR: cannot create LUKS filesystem. Giving up."; @@ -177,6 +186,9 @@ clonePartition( Device* device, Partition* partition ) partition->fileSystem().type(), partition->firstSector(), partition->lastSector() +#ifdef WITH_KPMCORE22 + ,device->logicalSize() +#endif ); return new Partition( partition->parent(), *device, diff --git a/src/modules/partition/tests/PartitionJobTests.cpp b/src/modules/partition/tests/PartitionJobTests.cpp index 5a09bbab5..fe869232b 100644 --- a/src/modules/partition/tests/PartitionJobTests.cpp +++ b/src/modules/partition/tests/PartitionJobTests.cpp @@ -217,7 +217,11 @@ PartitionJobTests::newCreatePartitionJob( Partition* freeSpacePartition, Partiti lastSector = firstSector + size / m_device->logicalSize(); else lastSector = freeSpacePartition->lastSector(); - FileSystem* fs = FileSystemFactory::create( type, firstSector, lastSector ); + FileSystem* fs = FileSystemFactory::create( type, firstSector, lastSector +#ifdef WITH_KPMCORE22 + ,m_device->logicalSize() +#endif + ); Partition* partition = new Partition( freeSpacePartition->parent(),