Merge pull request #787 from stikonas/master

kpmcore now requires passing sector size to FileSystem.
This commit is contained in:
Adriaan de Groot 2017-09-06 07:54:06 -04:00 committed by GitHub
commit cc26fc085a
3 changed files with 23 additions and 3 deletions

View File

@ -8,6 +8,10 @@ find_package( KF5 REQUIRED CoreAddons )
# These are needed because KPMcore links publicly against ConfigCore, I18n, IconThemes, KIOCore and Service # 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( 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_package( KPMcore 3.0.3 REQUIRED )
find_library( atasmart_LIB atasmart ) find_library( atasmart_LIB atasmart )
find_library( blkid_LIB blkid ) find_library( blkid_LIB blkid )

View File

@ -23,6 +23,7 @@
#include "core/PartitionIterator.h" #include "core/PartitionIterator.h"
// KPMcore // KPMcore
#include <kpmcore/core/device.h>
#include <kpmcore/core/partition.h> #include <kpmcore/core/partition.h>
#include <kpmcore/fs/filesystemfactory.h> #include <kpmcore/fs/filesystemfactory.h>
#include <kpmcore/backend/corebackendmanager.h> #include <kpmcore/backend/corebackendmanager.h>
@ -114,7 +115,11 @@ createNewPartition( PartitionNode* parent,
qint64 lastSector, qint64 lastSector,
PartitionTable::Flags flags ) 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( return new Partition(
parent, parent,
device, device,
@ -147,7 +152,11 @@ createNewEncryptedPartition( PartitionNode* parent,
FS::luks* fs = dynamic_cast< FS::luks* >( FS::luks* fs = dynamic_cast< FS::luks* >(
FileSystemFactory::create( FileSystem::Luks, FileSystemFactory::create( FileSystem::Luks,
firstSector, firstSector,
lastSector ) ); lastSector
#ifdef WITH_KPMCORE22
,device.logicalSize()
#endif
) );
if ( !fs ) if ( !fs )
{ {
qDebug() << "ERROR: cannot create LUKS filesystem. Giving up."; qDebug() << "ERROR: cannot create LUKS filesystem. Giving up.";
@ -177,6 +186,9 @@ clonePartition( Device* device, Partition* partition )
partition->fileSystem().type(), partition->fileSystem().type(),
partition->firstSector(), partition->firstSector(),
partition->lastSector() partition->lastSector()
#ifdef WITH_KPMCORE22
,device->logicalSize()
#endif
); );
return new Partition( partition->parent(), return new Partition( partition->parent(),
*device, *device,

View File

@ -217,7 +217,11 @@ PartitionJobTests::newCreatePartitionJob( Partition* freeSpacePartition, Partiti
lastSector = firstSector + size / m_device->logicalSize(); lastSector = firstSector + size / m_device->logicalSize();
else else
lastSector = freeSpacePartition->lastSector(); 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( Partition* partition = new Partition(
freeSpacePartition->parent(), freeSpacePartition->parent(),