Make initLUKS function non-static.

This commit is contained in:
Andrius Štikonas 2016-11-30 17:18:51 +00:00
parent 52b356e45f
commit 2e960d5c00
4 changed files with 15 additions and 15 deletions

View File

@ -131,8 +131,10 @@ Partition* LvmDevice::scanPartition(const QString& lvPath, PartitionTable* pTabl
// Handle LUKS partition // Handle LUKS partition
if (fs->type() == FileSystem::Luks) { if (fs->type() == FileSystem::Luks) {
r |= PartitionRole::Luks; r |= PartitionRole::Luks;
FS::luks::initLUKS(fs); FS::luks* luksFs = static_cast<FS::luks*>(fs);
QString mapperNode = static_cast<FS::luks*>(fs)->mapperName(); luksFs->initLUKS();
QString mapperNode = luksFs->mapperName();
mountPoint = FileSystem::detectMountPoint(fs, mapperNode); mountPoint = FileSystem::detectMountPoint(fs, mapperNode);
mounted = FileSystem::detectMountStatus(fs, mapperNode); mounted = FileSystem::detectMountStatus(fs, mapperNode);
} else { } else {

View File

@ -642,17 +642,14 @@ bool luks::canEncryptType(FileSystem::Type type)
} }
} }
void luks::initLUKS(FileSystem* fs) void luks::initLUKS()
{ {
if (fs->type() == FileSystem::Luks) { QString mapperNode = mapperName();
FS::luks* luksFS = static_cast<FS::luks*>(fs); bool isCryptOpen = !mapperNode.isEmpty();
QString mapperNode = luksFS->mapperName(); setCryptOpen(isCryptOpen);
bool isCryptOpen = !mapperNode.isEmpty(); if (isCryptOpen) {
luksFS->setCryptOpen(isCryptOpen); loadInnerFileSystem(mapperNode);
if (isCryptOpen) { setMounted(detectMountStatus(innerFS(), mapperNode));
luksFS->loadInnerFileSystem(mapperNode);
luksFS->setMounted(detectMountStatus(luksFS->innerFS(), mapperNode));
}
} }
} }

View File

@ -181,7 +181,7 @@ public:
qint64 payloadOffset() const { return m_PayloadOffset; } qint64 payloadOffset() const { return m_PayloadOffset; }
static bool canEncryptType(FileSystem::Type type); static bool canEncryptType(FileSystem::Type type);
static void initLUKS(FileSystem* fs); void initLUKS();
protected: protected:
virtual QString readOuterUUID(const QString& deviceNode) const; virtual QString readOuterUUID(const QString& deviceNode) const;

View File

@ -340,8 +340,9 @@ void LibPartedBackend::scanDevicePartitions(Device& d, PedDisk* pedDisk)
// libparted does not handle LUKS partitions // libparted does not handle LUKS partitions
if (fs->type() == FileSystem::Luks) { if (fs->type() == FileSystem::Luks) {
r |= PartitionRole::Luks; r |= PartitionRole::Luks;
FS::luks::initLUKS(fs); FS::luks* luksFs = static_cast<FS::luks*>(fs);
QString mapperNode = static_cast<FS::luks*>(fs)->mapperName(); luksFs->initLUKS();
QString mapperNode = luksFs->mapperName();
mountPoint = FileSystem::detectMountPoint(fs, mapperNode); mountPoint = FileSystem::detectMountPoint(fs, mapperNode);
mounted = FileSystem::detectMountStatus(fs, mapperNode); mounted = FileSystem::detectMountStatus(fs, mapperNode);
} else { } else {