diff --git a/src/core/lvmdevice.cpp b/src/core/lvmdevice.cpp index 1ae5f31..4852dec 100644 --- a/src/core/lvmdevice.cpp +++ b/src/core/lvmdevice.cpp @@ -130,7 +130,7 @@ Partition* LvmDevice::scanPartition(const QString& lvPath, PartitionTable* pTabl // Handle LUKS partition if (fs->type() == FileSystem::Luks) { r |= PartitionRole::Luks; - initLuks(fs, this); + FS::luks::initLUKS(fs); QString mapperNode = static_cast(fs)->mapperName(); mountPoint = FileSystem::detectMountPoint(fs, mapperNode); mounted = FileSystem::detectMountStatus(fs, mapperNode); diff --git a/src/fs/luks.cpp b/src/fs/luks.cpp index 2da62d1..c244296 100644 --- a/src/fs/luks.cpp +++ b/src/fs/luks.cpp @@ -21,8 +21,9 @@ #include "fs/filesystemfactory.h" -#include "util/capacity.h" #include "util/externalcommand.h" +#include "util/capacity.h" +#include "util/helpers.h" #include "util/report.h" #include @@ -616,4 +617,18 @@ bool luks::canEncryptType(FileSystem::Type type) } } +void luks::initLUKS(FileSystem* fs) +{ + if (fs->type() == FileSystem::Luks) { + FS::luks* luksFS = static_cast(fs); + QString mapperNode = luksFS->mapperName(); + bool isCryptOpen = !mapperNode.isEmpty(); + luksFS->setCryptOpen(isCryptOpen); + if (isCryptOpen) { + luksFS->loadInnerFileSystem(mapperNode); + luksFS->setMounted(::isMounted(mapperNode)); //isMounted from helpers.h + } + } +} + } diff --git a/src/fs/luks.h b/src/fs/luks.h index 73b380b..3c65ec3 100644 --- a/src/fs/luks.h +++ b/src/fs/luks.h @@ -163,6 +163,7 @@ public: qint64 payloadOffset() const { return m_PayloadOffset; }; static bool canEncryptType(FileSystem::Type type); + static void initLUKS(FileSystem* fs); protected: virtual QString readOuterUUID(const QString& deviceNode) const; diff --git a/src/plugins/libparted/libpartedbackend.cpp b/src/plugins/libparted/libpartedbackend.cpp index e73bfaa..3b36af0 100644 --- a/src/plugins/libparted/libpartedbackend.cpp +++ b/src/plugins/libparted/libpartedbackend.cpp @@ -240,7 +240,7 @@ Device* LibPartedBackend::scanDevice(const QString& deviceNode) // libparted does not handle LUKS partitions if (fs->type() == FileSystem::Luks) { r |= PartitionRole::Luks; - initLuks(fs, d); + FS::luks::initLUKS(fs); QString mapperNode = static_cast(fs)->mapperName(); mountPoint = FileSystem::detectMountPoint(fs, mapperNode); mounted = FileSystem::detectMountStatus(fs, mapperNode); diff --git a/src/util/helpers.cpp b/src/util/helpers.cpp index 1fac96d..d175edb 100644 --- a/src/util/helpers.cpp +++ b/src/util/helpers.cpp @@ -19,8 +19,6 @@ #include "util/helpers.h" #include "util/externalcommand.h" #include "util/globallog.h" -#include "fs/luks.h" -#include "core/device.h" #include "ops/operation.h" @@ -86,21 +84,6 @@ bool isMounted(const QString& deviceNode) return false; } -void initLuks(FileSystem* fs, const Device* dev) -{ - if (fs->type() == FileSystem::Luks) { - FS::luks* luksFS = static_cast(fs); - QString mapperNode = luksFS->mapperName(); - bool isCryptOpen = !mapperNode.isEmpty(); - luksFS->setCryptOpen(isCryptOpen); - luksFS->setLogicalSectorSize(dev->logicalSize()); - if (isCryptOpen) { - luksFS->loadInnerFileSystem(mapperNode); - } - luksFS->setMounted(isMounted(mapperNode)); - } -} - KAboutData aboutKPMcore() { KAboutData aboutData( QStringLiteral("kpmcore"), diff --git a/src/util/helpers.h b/src/util/helpers.h index b4b2769..39b95e8 100644 --- a/src/util/helpers.h +++ b/src/util/helpers.h @@ -39,8 +39,6 @@ LIBKPMCORE_EXPORT bool checkAccessibleDevices(); LIBKPMCORE_EXPORT bool isMounted(const QString& deviceNode); -LIBKPMCORE_EXPORT void initLuks(FileSystem* fs, const Device* dev); - LIBKPMCORE_EXPORT KAboutData aboutKPMcore(); #endif