Add FileSystem::Luks2 child class.
This commit is contained in:
parent
8c030baf3e
commit
7aa77f489d
|
@ -17,6 +17,7 @@ set(FS_SRC
|
||||||
fs/jfs.cpp
|
fs/jfs.cpp
|
||||||
fs/linuxswap.cpp
|
fs/linuxswap.cpp
|
||||||
fs/luks.cpp
|
fs/luks.cpp
|
||||||
|
fs/luks2.cpp
|
||||||
fs/lvm2_pv.cpp
|
fs/lvm2_pv.cpp
|
||||||
fs/nilfs2.cpp
|
fs/nilfs2.cpp
|
||||||
fs/ntfs.cpp
|
fs/ntfs.cpp
|
||||||
|
@ -50,6 +51,7 @@ set(FS_LIB_HDRS
|
||||||
fs/jfs.h
|
fs/jfs.h
|
||||||
fs/linuxswap.h
|
fs/linuxswap.h
|
||||||
fs/luks.h
|
fs/luks.h
|
||||||
|
fs/luks2.h
|
||||||
fs/lvm2_pv.h
|
fs/lvm2_pv.h
|
||||||
fs/nilfs2.h
|
fs/nilfs2.h
|
||||||
fs/ntfs.h
|
fs/ntfs.h
|
||||||
|
|
|
@ -66,7 +66,8 @@ const std::array< QColor, FileSystem::__lastType > FileSystem::defaultColorCode
|
||||||
QColor( 160,210,180 ),
|
QColor( 160,210,180 ),
|
||||||
QColor( 255,170,0 ),
|
QColor( 255,170,0 ),
|
||||||
QColor( 170, 120, 255 ),
|
QColor( 170, 120, 255 ),
|
||||||
QColor( 177, 82, 69 )
|
QColor( 177, 82, 69 ),
|
||||||
|
QColor( 170,30,77 )
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -444,6 +445,7 @@ static const KLocalizedString* typeNames()
|
||||||
kxi18nc("@item filesystem name", "f2fs"),
|
kxi18nc("@item filesystem name", "f2fs"),
|
||||||
kxi18nc("@item filesystem name", "udf"),
|
kxi18nc("@item filesystem name", "udf"),
|
||||||
kxi18nc("@item filesystem name", "iso9660"),
|
kxi18nc("@item filesystem name", "iso9660"),
|
||||||
|
kxi18nc("@item filesystem name", "luks2")
|
||||||
};
|
};
|
||||||
|
|
||||||
return s;
|
return s;
|
||||||
|
|
|
@ -87,8 +87,9 @@ public:
|
||||||
F2fs = 25,
|
F2fs = 25,
|
||||||
Udf = 26,
|
Udf = 26,
|
||||||
Iso9660 = 27,
|
Iso9660 = 27,
|
||||||
|
Luks2 = 28,
|
||||||
|
|
||||||
__lastType = 28
|
__lastType = 29
|
||||||
};
|
};
|
||||||
|
|
||||||
/** The type of support for a given FileSystem action */
|
/** The type of support for a given FileSystem action */
|
||||||
|
|
|
@ -35,6 +35,7 @@
|
||||||
#include "fs/jfs.h"
|
#include "fs/jfs.h"
|
||||||
#include "fs/linuxswap.h"
|
#include "fs/linuxswap.h"
|
||||||
#include "fs/luks.h"
|
#include "fs/luks.h"
|
||||||
|
#include "fs/luks2.h"
|
||||||
#include "fs/lvm2_pv.h"
|
#include "fs/lvm2_pv.h"
|
||||||
#include "fs/nilfs2.h"
|
#include "fs/nilfs2.h"
|
||||||
#include "fs/ntfs.h"
|
#include "fs/ntfs.h"
|
||||||
|
@ -75,6 +76,7 @@ void FileSystemFactory::init()
|
||||||
m_FileSystems.insert(FileSystem::Jfs, new FS::jfs(-1, -1, -1, QString()));
|
m_FileSystems.insert(FileSystem::Jfs, new FS::jfs(-1, -1, -1, QString()));
|
||||||
m_FileSystems.insert(FileSystem::LinuxSwap, new FS::linuxswap(-1, -1, -1, QString()));
|
m_FileSystems.insert(FileSystem::LinuxSwap, new FS::linuxswap(-1, -1, -1, QString()));
|
||||||
m_FileSystems.insert(FileSystem::Luks, new FS::luks(-1, -1, -1, QString()));
|
m_FileSystems.insert(FileSystem::Luks, new FS::luks(-1, -1, -1, QString()));
|
||||||
|
m_FileSystems.insert(FileSystem::Luks2, new FS::luks2(-1, -1, -1, QString()));
|
||||||
m_FileSystems.insert(FileSystem::Lvm2_PV, new FS::lvm2_pv(-1, -1, -1, QString()));
|
m_FileSystems.insert(FileSystem::Lvm2_PV, new FS::lvm2_pv(-1, -1, -1, QString()));
|
||||||
m_FileSystems.insert(FileSystem::Nilfs2, new FS::nilfs2(-1, -1, -1, QString()));
|
m_FileSystems.insert(FileSystem::Nilfs2, new FS::nilfs2(-1, -1, -1, QString()));
|
||||||
m_FileSystems.insert(FileSystem::Ntfs, new FS::ntfs(-1, -1, -1, QString()));
|
m_FileSystems.insert(FileSystem::Ntfs, new FS::ntfs(-1, -1, -1, QString()));
|
||||||
|
@ -123,6 +125,7 @@ FileSystem* FileSystemFactory::create(FileSystem::Type t, qint64 firstsector, qi
|
||||||
case FileSystem::Jfs: fs = new FS::jfs(firstsector, lastsector, sectorsused, label); break;
|
case FileSystem::Jfs: fs = new FS::jfs(firstsector, lastsector, sectorsused, label); break;
|
||||||
case FileSystem::LinuxSwap: fs = new FS::linuxswap(firstsector, lastsector, sectorsused, label); break;
|
case FileSystem::LinuxSwap: fs = new FS::linuxswap(firstsector, lastsector, sectorsused, label); break;
|
||||||
case FileSystem::Luks: fs = new FS::luks(firstsector, lastsector, sectorsused, label); break;
|
case FileSystem::Luks: fs = new FS::luks(firstsector, lastsector, sectorsused, label); break;
|
||||||
|
case FileSystem::Luks2: fs = new FS::luks2(firstsector, lastsector, sectorsused, label); break;
|
||||||
case FileSystem::Lvm2_PV: fs = new FS::lvm2_pv(firstsector, lastsector, sectorsused, label); break;
|
case FileSystem::Lvm2_PV: fs = new FS::lvm2_pv(firstsector, lastsector, sectorsused, label); break;
|
||||||
case FileSystem::Nilfs2: fs = new FS::nilfs2(firstsector, lastsector, sectorsused, label); break;
|
case FileSystem::Nilfs2: fs = new FS::nilfs2(firstsector, lastsector, sectorsused, label); break;
|
||||||
case FileSystem::Ntfs: fs = new FS::ntfs(firstsector, lastsector, sectorsused, label); break;
|
case FileSystem::Ntfs: fs = new FS::ntfs(firstsector, lastsector, sectorsused, label); break;
|
||||||
|
@ -138,10 +141,11 @@ FileSystem* FileSystemFactory::create(FileSystem::Type t, qint64 firstsector, qi
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fs != nullptr)
|
if (fs != nullptr) {
|
||||||
fs->setUUID(uuid);
|
fs->setUUID(uuid);
|
||||||
|
fs->setSectorSize(sectorSize);
|
||||||
|
}
|
||||||
|
|
||||||
fs->setSectorSize(sectorSize);
|
|
||||||
return fs;
|
return fs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,8 +61,9 @@ FileSystem::CommandSupportType luks::m_GetUUID = FileSystem::cmdSupportNone;
|
||||||
luks::luks(qint64 firstsector,
|
luks::luks(qint64 firstsector,
|
||||||
qint64 lastsector,
|
qint64 lastsector,
|
||||||
qint64 sectorsused,
|
qint64 sectorsused,
|
||||||
const QString& label)
|
const QString& label,
|
||||||
: FileSystem(firstsector, lastsector, sectorsused, label, FileSystem::Luks)
|
FileSystem::Type t)
|
||||||
|
: FileSystem(firstsector, lastsector, sectorsused, label, t)
|
||||||
, m_innerFs(nullptr)
|
, m_innerFs(nullptr)
|
||||||
, m_isCryptOpen(false)
|
, m_isCryptOpen(false)
|
||||||
, m_cryptsetupFound(m_Create != cmdSupportNone)
|
, m_cryptsetupFound(m_Create != cmdSupportNone)
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
#include "fs/filesystem.h"
|
#include "fs/filesystem.h"
|
||||||
|
|
||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
#include <QPointer>
|
#include <QWidget>
|
||||||
|
|
||||||
class Report;
|
class Report;
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ namespace FS
|
||||||
class LIBKPMCORE_EXPORT luks : public FileSystem
|
class LIBKPMCORE_EXPORT luks : public FileSystem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
luks(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label);
|
luks(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label, FileSystem::Type t = FileSystem::Luks);
|
||||||
~luks() override;
|
~luks() override;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -199,7 +199,7 @@ public:
|
||||||
static CommandSupportType m_UpdateUUID;
|
static CommandSupportType m_UpdateUUID;
|
||||||
static CommandSupportType m_GetUUID;
|
static CommandSupportType m_GetUUID;
|
||||||
|
|
||||||
private:
|
protected:
|
||||||
mutable FileSystem* m_innerFs;
|
mutable FileSystem* m_innerFs;
|
||||||
|
|
||||||
mutable bool m_isCryptOpen;
|
mutable bool m_isCryptOpen;
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
|
|
||||||
#include "fs/filesystemfactory.h"
|
#include "fs/filesystemfactory.h"
|
||||||
#include "fs/luks.h"
|
#include "fs/luks.h"
|
||||||
|
#include "fs/luks2.h"
|
||||||
|
|
||||||
#include "util/globallog.h"
|
#include "util/globallog.h"
|
||||||
#include "util/externalcommand.h"
|
#include "util/externalcommand.h"
|
||||||
|
@ -232,7 +233,7 @@ void SfdiskBackend::scanDevicePartitions(Device& d, const QJsonArray& jsonPartit
|
||||||
QString mountPoint;
|
QString mountPoint;
|
||||||
bool mounted;
|
bool mounted;
|
||||||
// sfdisk does not handle LUKS partitions
|
// sfdisk does not handle LUKS partitions
|
||||||
if (fs->type() == FileSystem::Luks) {
|
if (fs->type() == FileSystem::Luks || fs->type() == FileSystem::Luks2) {
|
||||||
r |= PartitionRole::Luks;
|
r |= PartitionRole::Luks;
|
||||||
FS::luks* luksFs = static_cast<FS::luks*>(fs);
|
FS::luks* luksFs = static_cast<FS::luks*>(fs);
|
||||||
luksFs->initLUKS();
|
luksFs->initLUKS();
|
||||||
|
@ -339,7 +340,7 @@ FileSystem::Type SfdiskBackend::detectFileSystem(const QString& partitionPath)
|
||||||
if (version == QStringLiteral("1"))
|
if (version == QStringLiteral("1"))
|
||||||
rval = FileSystem::Luks;
|
rval = FileSystem::Luks;
|
||||||
else if (version == QStringLiteral("2")) {
|
else if (version == QStringLiteral("2")) {
|
||||||
rval = FileSystem::Luks;
|
rval = FileSystem::Luks2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (s == QStringLiteral("exfat")) rval = FileSystem::Exfat;
|
else if (s == QStringLiteral("exfat")) rval = FileSystem::Exfat;
|
||||||
|
|
Loading…
Reference in New Issue