Add support for filesystem-specific features
In some cases, it may be necessary to create a filesystem with specific features enabled/disabled. This PR makes it possible to create filesystems this way. It does so by introducing a new m_Features member variable and the createWithFeatures() function to the FileSystem base class. The latter function is implemented for the btrfs, ext2/3/4 and FAT filesystems. Additionnally, the CreateFileSystemJob has been modified to enable creating/formatting filesystems with specific features enabled. Differential Revision: https://phabricator.kde.org/D21903 CCBUG: 342178
This commit is contained in:
parent
50697be784
commit
d24191ebd8
|
@ -11,6 +11,7 @@ set(FS_SRC
|
|||
fs/fat12.cpp
|
||||
fs/fat16.cpp
|
||||
fs/fat32.cpp
|
||||
fs/feature.cpp
|
||||
fs/filesystem.cpp
|
||||
fs/filesystemfactory.cpp
|
||||
fs/hfs.cpp
|
||||
|
@ -50,6 +51,7 @@ set(FS_LIB_HDRS
|
|||
fs/fat12.h
|
||||
fs/fat16.h
|
||||
fs/fat32.h
|
||||
fs/feature.h
|
||||
fs/filesystem.h
|
||||
fs/filesystemfactory.h
|
||||
fs/hfs.h
|
||||
|
|
|
@ -23,8 +23,8 @@ FileSystem::CommandSupportType apfs::m_Move = FileSystem::cmdSupportCore;
|
|||
FileSystem::CommandSupportType apfs::m_Copy = FileSystem::cmdSupportCore;
|
||||
FileSystem::CommandSupportType apfs::m_Backup = FileSystem::cmdSupportCore;
|
||||
|
||||
apfs::apfs(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label) :
|
||||
FileSystem(firstsector, lastsector, sectorsused, label, FileSystem::Type::Apfs)
|
||||
apfs::apfs(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label, const QList<FSFeature>& features) :
|
||||
FileSystem(firstsector, lastsector, sectorsused, label, features, FileSystem::Type::Apfs)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ namespace FS
|
|||
class LIBKPMCORE_EXPORT apfs : public FileSystem
|
||||
{
|
||||
public:
|
||||
apfs(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label);
|
||||
apfs(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label, const QList<FSFeature>& features = {});
|
||||
|
||||
public:
|
||||
CommandSupportType supportMove() const override {
|
||||
|
|
|
@ -23,8 +23,8 @@ FileSystem::CommandSupportType bitlocker::m_Move = FileSystem::cmdSupportCore;
|
|||
FileSystem::CommandSupportType bitlocker::m_Copy = FileSystem::cmdSupportCore;
|
||||
FileSystem::CommandSupportType bitlocker::m_Backup = FileSystem::cmdSupportCore;
|
||||
|
||||
bitlocker::bitlocker(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label) :
|
||||
FileSystem(firstsector, lastsector, sectorsused, label, FileSystem::Type::BitLocker)
|
||||
bitlocker::bitlocker(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label, const QList<FSFeature>& features) :
|
||||
FileSystem(firstsector, lastsector, sectorsused, label, features, FileSystem::Type::BitLocker)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ namespace FS
|
|||
class LIBKPMCORE_EXPORT bitlocker : public FileSystem
|
||||
{
|
||||
public:
|
||||
bitlocker(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label);
|
||||
bitlocker(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label, const QList<FSFeature>& features = {});
|
||||
|
||||
public:
|
||||
CommandSupportType supportMove() const override {
|
||||
|
|
|
@ -43,8 +43,8 @@ FileSystem::CommandSupportType btrfs::m_SetLabel = FileSystem::cmdSupportNone;
|
|||
FileSystem::CommandSupportType btrfs::m_UpdateUUID = FileSystem::cmdSupportNone;
|
||||
FileSystem::CommandSupportType btrfs::m_GetUUID = FileSystem::cmdSupportNone;
|
||||
|
||||
btrfs::btrfs(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label) :
|
||||
FileSystem(firstsector, lastsector, sectorsused, label, FileSystem::Type::Btrfs)
|
||||
btrfs::btrfs(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label, const QList<FSFeature>& features) :
|
||||
FileSystem(firstsector, lastsector, sectorsused, label, features, FileSystem::Type::Btrfs)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -65,6 +65,22 @@ void btrfs::init()
|
|||
m_GetLabel = cmdSupportCore;
|
||||
m_Backup = cmdSupportCore;
|
||||
m_GetUUID = cmdSupportCore;
|
||||
|
||||
if (m_Create == cmdSupportFileSystem) {
|
||||
ExternalCommand cmd(QStringLiteral("mkfs.btrfs"), QStringList() << QStringLiteral("-O") << QStringLiteral("list-all"));
|
||||
if (cmd.run(-1) && cmd.exitCode() == 0) {
|
||||
QStringList lines = cmd.output().split(QStringLiteral("\n"));
|
||||
|
||||
// First line is introductory text, we don't need it
|
||||
lines.removeFirst();
|
||||
|
||||
for (auto l : lines) {
|
||||
if (!l.isEmpty())
|
||||
addAvailableFeature(l.split(QStringLiteral(" ")).first());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
bool btrfs::supportToolFound() const
|
||||
|
@ -128,7 +144,23 @@ bool btrfs::check(Report& report, const QString& deviceNode) const
|
|||
|
||||
bool btrfs::create(Report& report, const QString& deviceNode)
|
||||
{
|
||||
ExternalCommand cmd(report, QStringLiteral("mkfs.btrfs"), { QStringLiteral("--force"), deviceNode });
|
||||
QStringList args = QStringList();
|
||||
|
||||
if (!this->features().isEmpty()) {
|
||||
QStringList feature_list = QStringList();
|
||||
for (auto f : this->features()) {
|
||||
if (f.type() == FSFeature::Type::Bool) {
|
||||
if (f.bValue())
|
||||
feature_list << f.name();
|
||||
else
|
||||
feature_list << (QStringLiteral("^") + f.name());
|
||||
}
|
||||
}
|
||||
args << QStringLiteral("--features") << feature_list.join(QStringLiteral(","));
|
||||
}
|
||||
args << QStringLiteral("--force") << deviceNode;
|
||||
|
||||
ExternalCommand cmd(report, QStringLiteral("mkfs.btrfs"), args);
|
||||
return cmd.run(-1) && cmd.exitCode() == 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ namespace FS
|
|||
class LIBKPMCORE_EXPORT btrfs : public FileSystem
|
||||
{
|
||||
public:
|
||||
btrfs(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label);
|
||||
btrfs(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label, const QList<FSFeature>& features = {});
|
||||
|
||||
public:
|
||||
void init() override;
|
||||
|
@ -61,6 +61,9 @@ public:
|
|||
CommandSupportType supportCreate() const override {
|
||||
return m_Create;
|
||||
}
|
||||
CommandSupportType supportCreateWithFeatures() const override {
|
||||
return m_Create;
|
||||
}
|
||||
CommandSupportType supportGrow() const override {
|
||||
return m_Grow;
|
||||
}
|
||||
|
|
|
@ -38,8 +38,8 @@ FileSystem::CommandSupportType exfat::m_SetLabel = FileSystem::cmdSupportNone;
|
|||
FileSystem::CommandSupportType exfat::m_UpdateUUID = FileSystem::cmdSupportNone;
|
||||
FileSystem::CommandSupportType exfat::m_GetUUID = FileSystem::cmdSupportNone;
|
||||
|
||||
exfat::exfat(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label) :
|
||||
FileSystem(firstsector, lastsector, sectorsused, label, FileSystem::Type::Exfat)
|
||||
exfat::exfat(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label, const QList<FSFeature>& features) :
|
||||
FileSystem(firstsector, lastsector, sectorsused, label, features, FileSystem::Type::Exfat)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ namespace FS
|
|||
class LIBKPMCORE_EXPORT exfat : public FileSystem
|
||||
{
|
||||
public:
|
||||
exfat(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label);
|
||||
exfat(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label, const QList<FSFeature>& features = {});
|
||||
|
||||
public:
|
||||
void init() override;
|
||||
|
|
|
@ -39,8 +39,8 @@ FileSystem::CommandSupportType ext2::m_SetLabel = FileSystem::cmdSupportNone;
|
|||
FileSystem::CommandSupportType ext2::m_UpdateUUID = FileSystem::cmdSupportNone;
|
||||
FileSystem::CommandSupportType ext2::m_GetUUID = FileSystem::cmdSupportNone;
|
||||
|
||||
ext2::ext2(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label, FileSystem::Type t) :
|
||||
FileSystem(firstsector, lastsector, sectorsused, label, t)
|
||||
ext2::ext2(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label, const QList<FSFeature>& features, FileSystem::Type t) :
|
||||
FileSystem(firstsector, lastsector, sectorsused, label, features, t)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -58,6 +58,37 @@ void ext2::init()
|
|||
m_Move = (m_Check != cmdSupportNone) ? cmdSupportCore : cmdSupportNone;
|
||||
m_Backup = cmdSupportCore;
|
||||
m_GetUUID = cmdSupportCore;
|
||||
|
||||
if (m_Create == cmdSupportFileSystem) {
|
||||
addAvailableFeature(QStringLiteral("64bit"));
|
||||
addAvailableFeature(QStringLiteral("bigalloc"));
|
||||
addAvailableFeature(QStringLiteral("casefold"));
|
||||
addAvailableFeature(QStringLiteral("dir_index"));
|
||||
addAvailableFeature(QStringLiteral("dir_nlink"));
|
||||
addAvailableFeature(QStringLiteral("ea_inode"));
|
||||
addAvailableFeature(QStringLiteral("encrypt"));
|
||||
addAvailableFeature(QStringLiteral("ext_attr"));
|
||||
addAvailableFeature(QStringLiteral("extent"));
|
||||
addAvailableFeature(QStringLiteral("extra_isize"));
|
||||
addAvailableFeature(QStringLiteral("filetype"));
|
||||
addAvailableFeature(QStringLiteral("flex_bg"));
|
||||
addAvailableFeature(QStringLiteral("has_journal"));
|
||||
addAvailableFeature(QStringLiteral("huge_file"));
|
||||
addAvailableFeature(QStringLiteral("inline_data"));
|
||||
addAvailableFeature(QStringLiteral("journal_dev"));
|
||||
addAvailableFeature(QStringLiteral("large_dir"));
|
||||
addAvailableFeature(QStringLiteral("large_file"));
|
||||
addAvailableFeature(QStringLiteral("metadata_csum"));
|
||||
addAvailableFeature(QStringLiteral("metadata_csum_seed"));
|
||||
addAvailableFeature(QStringLiteral("meta_bg"));
|
||||
addAvailableFeature(QStringLiteral("mmp"));
|
||||
addAvailableFeature(QStringLiteral("project"));
|
||||
addAvailableFeature(QStringLiteral("quota"));
|
||||
addAvailableFeature(QStringLiteral("resize_inode"));
|
||||
addAvailableFeature(QStringLiteral("sparse_super"));
|
||||
addAvailableFeature(QStringLiteral("sparse_super2"));
|
||||
addAvailableFeature(QStringLiteral("uninit_bg"));
|
||||
}
|
||||
}
|
||||
|
||||
bool ext2::supportToolFound() const
|
||||
|
@ -133,7 +164,23 @@ bool ext2::check(Report& report, const QString& deviceNode) const
|
|||
|
||||
bool ext2::create(Report& report, const QString& deviceNode)
|
||||
{
|
||||
ExternalCommand cmd(report, QStringLiteral("mkfs.ext2"), { QStringLiteral("-qF"), deviceNode });
|
||||
QStringList args = QStringList();
|
||||
|
||||
if (!this->features().isEmpty()) {
|
||||
QStringList feature_list = QStringList();
|
||||
for (auto f : this->features()) {
|
||||
if (f.type() == FSFeature::Type::Bool) {
|
||||
if (f.bValue())
|
||||
feature_list << f.name();
|
||||
else
|
||||
feature_list << (QStringLiteral("^") + f.name());
|
||||
}
|
||||
}
|
||||
args << QStringLiteral("-O") << feature_list.join(QStringLiteral(","));
|
||||
}
|
||||
args << QStringLiteral("-qF") << deviceNode;
|
||||
|
||||
ExternalCommand cmd(report, QStringLiteral("mkfs.ext2"), args);
|
||||
return cmd.run(-1) && cmd.exitCode() == 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ namespace FS
|
|||
class LIBKPMCORE_EXPORT ext2 : public FileSystem
|
||||
{
|
||||
public:
|
||||
ext2(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label, FileSystem::Type t = FileSystem::Type::Ext2);
|
||||
ext2(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label, const QList<FSFeature>& features = {}, FileSystem::Type t = FileSystem::Type::Ext2);
|
||||
|
||||
public:
|
||||
void init() override;
|
||||
|
@ -59,6 +59,9 @@ public:
|
|||
CommandSupportType supportCreate() const override {
|
||||
return m_Create;
|
||||
}
|
||||
CommandSupportType supportCreateWithFeatures() const override {
|
||||
return m_Create;
|
||||
}
|
||||
CommandSupportType supportGrow() const override {
|
||||
return m_Grow;
|
||||
}
|
||||
|
|
|
@ -24,8 +24,8 @@
|
|||
|
||||
namespace FS
|
||||
{
|
||||
ext3::ext3(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label) :
|
||||
ext2(firstsector, lastsector, sectorsused, label, FileSystem::Type::Ext3)
|
||||
ext3::ext3(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label, const QList<FSFeature>& features) :
|
||||
ext2(firstsector, lastsector, sectorsused, label, features, FileSystem::Type::Ext3)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,23 @@ qint64 ext3::maxCapacity() const
|
|||
|
||||
bool ext3::create(Report& report, const QString& deviceNode)
|
||||
{
|
||||
ExternalCommand cmd(report, QStringLiteral("mkfs.ext3"), QStringList() << QStringLiteral("-qF") << deviceNode);
|
||||
QStringList args = QStringList();
|
||||
|
||||
if (!this->features().isEmpty()) {
|
||||
QStringList feature_list = QStringList();
|
||||
for (auto f : this->features()) {
|
||||
if (f.type() == FSFeature::Type::Bool) {
|
||||
if (f.bValue())
|
||||
feature_list << f.name();
|
||||
else
|
||||
feature_list << (QStringLiteral("^") + f.name());
|
||||
}
|
||||
}
|
||||
args << QStringLiteral("-O") << feature_list.join(QStringLiteral(","));
|
||||
}
|
||||
args << QStringLiteral("-qF") << deviceNode;
|
||||
|
||||
ExternalCommand cmd(report, QStringLiteral("mkfs.ext3"), args);
|
||||
return cmd.run(-1) && cmd.exitCode() == 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ namespace FS
|
|||
class LIBKPMCORE_EXPORT ext3 : public ext2
|
||||
{
|
||||
public:
|
||||
ext3(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label);
|
||||
ext3(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label, const QList<FSFeature>& features = {});
|
||||
|
||||
public:
|
||||
bool create(Report& report, const QString& deviceNode) override;
|
||||
|
|
|
@ -24,8 +24,8 @@
|
|||
|
||||
namespace FS
|
||||
{
|
||||
ext4::ext4(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label) :
|
||||
ext2(firstsector, lastsector, sectorsused, label, FileSystem::Type::Ext4)
|
||||
ext4::ext4(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label, const QList<FSFeature>& features) :
|
||||
ext2(firstsector, lastsector, sectorsused, label, features, FileSystem::Type::Ext4)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,23 @@ qint64 ext4::maxCapacity() const
|
|||
|
||||
bool ext4::create(Report& report, const QString& deviceNode)
|
||||
{
|
||||
ExternalCommand cmd(report, QStringLiteral("mkfs.ext4"), QStringList() << QStringLiteral("-qF") << deviceNode);
|
||||
QStringList args = QStringList();
|
||||
|
||||
if (!this->features().isEmpty()) {
|
||||
QStringList feature_list = QStringList();
|
||||
for (auto f : this->features()) {
|
||||
if (f.type() == FSFeature::Type::Bool) {
|
||||
if (f.bValue())
|
||||
feature_list << f.name();
|
||||
else
|
||||
feature_list << (QStringLiteral("^") + f.name());
|
||||
}
|
||||
}
|
||||
args << QStringLiteral("-O") << feature_list.join(QStringLiteral(","));
|
||||
}
|
||||
args << QStringLiteral("-qF") << deviceNode;
|
||||
|
||||
ExternalCommand cmd(report, QStringLiteral("mkfs.ext4"), args);
|
||||
return cmd.run(-1) && cmd.exitCode() == 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ namespace FS
|
|||
class LIBKPMCORE_EXPORT ext4 : public ext2
|
||||
{
|
||||
public:
|
||||
ext4(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label);
|
||||
ext4(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label, const QList<FSFeature>& features = {});
|
||||
|
||||
public:
|
||||
bool create(Report& report, const QString& deviceNode) override;
|
||||
|
|
|
@ -24,8 +24,8 @@ FileSystem::CommandSupportType extended::m_Grow = FileSystem::cmdSupportCore;
|
|||
FileSystem::CommandSupportType extended::m_Shrink = FileSystem::cmdSupportCore;
|
||||
FileSystem::CommandSupportType extended::m_Move = FileSystem::cmdSupportCore;
|
||||
|
||||
extended::extended(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label) :
|
||||
FileSystem(firstsector, lastsector, sectorsused, label, FileSystem::Type::Extended)
|
||||
extended::extended(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label, const QList<FSFeature>& features) :
|
||||
FileSystem(firstsector, lastsector, sectorsused, label, features, FileSystem::Type::Extended)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ namespace FS
|
|||
class LIBKPMCORE_EXPORT extended : public FileSystem
|
||||
{
|
||||
public:
|
||||
extended(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label);
|
||||
extended(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label, const QList<FSFeature>& features = {});
|
||||
|
||||
public:
|
||||
|
||||
|
|
|
@ -45,8 +45,8 @@ FileSystem::CommandSupportType f2fs::m_UpdateUUID = FileSystem::cmdSupportNone;
|
|||
FileSystem::CommandSupportType f2fs::m_GetUUID = FileSystem::cmdSupportNone;
|
||||
bool f2fs::oldVersion = false; // 1.8.x or older
|
||||
|
||||
f2fs::f2fs(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label) :
|
||||
FileSystem(firstsector, lastsector, sectorsused, label, FileSystem::Type::F2fs)
|
||||
f2fs::f2fs(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label, const QList<FSFeature>& features) :
|
||||
FileSystem(firstsector, lastsector, sectorsused, label, features, FileSystem::Type::F2fs)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ namespace FS
|
|||
class LIBKPMCORE_EXPORT f2fs : public FileSystem
|
||||
{
|
||||
public:
|
||||
f2fs(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label);
|
||||
f2fs(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label, const QList<FSFeature>& features = {});
|
||||
|
||||
public:
|
||||
void init() override;
|
||||
|
|
|
@ -29,6 +29,9 @@
|
|||
#include <QString>
|
||||
#include <QStringList>
|
||||
|
||||
#include <QDebug>
|
||||
#include <QtMath>
|
||||
|
||||
#include <ctime>
|
||||
|
||||
namespace FS
|
||||
|
@ -46,8 +49,8 @@ FileSystem::CommandSupportType fat12::m_Backup = FileSystem::cmdSupportNone;
|
|||
FileSystem::CommandSupportType fat12::m_UpdateUUID = FileSystem::cmdSupportNone;
|
||||
FileSystem::CommandSupportType fat12::m_GetUUID = FileSystem::cmdSupportNone;
|
||||
|
||||
fat12::fat12(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label, FileSystem::Type t) :
|
||||
FileSystem(firstsector, lastsector, sectorsused, label, t)
|
||||
fat12::fat12(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label, const QList<FSFeature>& features, FileSystem::Type t) :
|
||||
FileSystem(firstsector, lastsector, sectorsused, label, features, t)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -61,6 +64,11 @@ void fat12::init()
|
|||
m_Backup = cmdSupportCore;
|
||||
m_UpdateUUID = cmdSupportCore;
|
||||
m_GetUUID = cmdSupportCore;
|
||||
|
||||
if (m_Create == cmdSupportFileSystem) {
|
||||
addAvailableFeature(QStringLiteral("sector-size"), FSFeature::Type::Int);
|
||||
addAvailableFeature(QStringLiteral("sectors-per-cluster"), FSFeature::Type::Int);
|
||||
}
|
||||
}
|
||||
|
||||
bool fat12::supportToolFound() const
|
||||
|
@ -151,7 +159,38 @@ bool fat12::check(Report& report, const QString& deviceNode) const
|
|||
|
||||
bool fat12::create(Report& report, const QString& deviceNode)
|
||||
{
|
||||
ExternalCommand cmd(report, QStringLiteral("mkfs.fat"), { QStringLiteral("-F12"), QStringLiteral("-I"), QStringLiteral("-v"), deviceNode });
|
||||
return createWithFatSize(report, deviceNode, 12);
|
||||
}
|
||||
|
||||
bool fat12::createWithFatSize(Report &report, const QString& deviceNode, int fatSize)
|
||||
{
|
||||
QStringList args = QStringList();
|
||||
|
||||
if (fatSize != 12 && fatSize != 16 && fatSize != 32)
|
||||
return false;
|
||||
|
||||
for (auto f : this->features()) {
|
||||
if (f.name() == QStringLiteral("sector-size")) {
|
||||
quint32 sectorSize = f.iValue();
|
||||
|
||||
/* sectorSize has to be a power of 2 between 512 and 32768 */
|
||||
if (sectorSize >= 512 && sectorSize <= 32768 && sectorSize == qNextPowerOfTwo(sectorSize - 1))
|
||||
args << QStringLiteral("-S%1").arg(sectorSize);
|
||||
else
|
||||
qWarning() << QStringLiteral("FAT sector size %1 is invalid, using default").arg(sectorSize);
|
||||
} else if (f.name() == QStringLiteral("sectors-per-cluster")) {
|
||||
quint32 sectorsPerCluster = f.iValue();
|
||||
|
||||
/* sectorsPerCluster has to be a power of 2 between 2 and 128 */
|
||||
if (sectorsPerCluster <= 128 && sectorsPerCluster == qNextPowerOfTwo(sectorsPerCluster - 1))
|
||||
args << QStringLiteral("-s%1").arg(sectorsPerCluster);
|
||||
else
|
||||
qWarning() << QStringLiteral("FAT sector size %1 is invalid, using default").arg(sectorsPerCluster);
|
||||
}
|
||||
}
|
||||
args << QStringLiteral("-F%1").arg(fatSize) << QStringLiteral("-I") << QStringLiteral("-v") << deviceNode;
|
||||
|
||||
ExternalCommand cmd(report, QStringLiteral("mkfs.fat"), args);
|
||||
return cmd.run(-1) && cmd.exitCode() == 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ namespace FS
|
|||
class LIBKPMCORE_EXPORT fat12 : public FileSystem
|
||||
{
|
||||
public:
|
||||
fat12(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label, FileSystem::Type t = FileSystem::Type::Fat12);
|
||||
fat12(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label, const QList<FSFeature>& features = {}, FileSystem::Type t = FileSystem::Type::Fat12);
|
||||
|
||||
public:
|
||||
void init() override;
|
||||
|
@ -92,6 +92,9 @@ public:
|
|||
SupportTool supportToolName() const override;
|
||||
bool supportToolFound() const override;
|
||||
|
||||
protected:
|
||||
bool createWithFatSize(Report &report, const QString& deviceNode, int fatSize);
|
||||
|
||||
public:
|
||||
static CommandSupportType m_GetUsed;
|
||||
static CommandSupportType m_GetLabel;
|
||||
|
|
|
@ -31,13 +31,8 @@
|
|||
|
||||
namespace FS
|
||||
{
|
||||
fat16::fat16(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label) :
|
||||
fat12(firstsector, lastsector, sectorsused, label, FileSystem::Type::Fat16)
|
||||
{
|
||||
}
|
||||
|
||||
fat16::fat16(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label, FileSystem::Type type) :
|
||||
fat12(firstsector, lastsector, sectorsused, label, type)
|
||||
fat16::fat16(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label, const QList<FSFeature>& features, FileSystem::Type type) :
|
||||
fat12(firstsector, lastsector, sectorsused, label, features, type)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -53,6 +48,11 @@ void fat16::init()
|
|||
m_Grow = findExternal(QStringLiteral("fatresize")) ? cmdSupportFileSystem : cmdSupportNone;
|
||||
m_Shrink = findExternal(QStringLiteral("fatresize")) ? cmdSupportFileSystem : cmdSupportNone;
|
||||
m_GetUUID = cmdSupportCore;
|
||||
|
||||
if (m_Create == cmdSupportFileSystem) {
|
||||
addAvailableFeature(QStringLiteral("sector-size"), FSFeature::Type::Int);
|
||||
addAvailableFeature(QStringLiteral("sectors-per-cluster"), FSFeature::Type::Int);
|
||||
}
|
||||
}
|
||||
|
||||
bool fat16::supportToolFound() const
|
||||
|
@ -84,8 +84,7 @@ qint64 fat16::maxCapacity() const
|
|||
|
||||
bool fat16::create(Report& report, const QString& deviceNode)
|
||||
{
|
||||
ExternalCommand cmd(report, QStringLiteral("mkfs.fat"), { QStringLiteral("-F16"), QStringLiteral("-I"), QStringLiteral("-v"), deviceNode });
|
||||
return cmd.run(-1) && cmd.exitCode() == 0;
|
||||
return createWithFatSize(report, deviceNode, 16);
|
||||
}
|
||||
|
||||
bool fat16::resize(Report& report, const QString& deviceNode, qint64 length) const
|
||||
|
|
|
@ -33,8 +33,7 @@ namespace FS
|
|||
class LIBKPMCORE_EXPORT fat16 : public fat12
|
||||
{
|
||||
public:
|
||||
fat16(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label);
|
||||
fat16(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label, FileSystem::Type type);
|
||||
fat16(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label, const QList<FSFeature>& features = {}, FileSystem::Type type = FileSystem::Type::Fat16);
|
||||
|
||||
public:
|
||||
void init() override;
|
||||
|
|
|
@ -26,8 +26,8 @@
|
|||
|
||||
namespace FS
|
||||
{
|
||||
fat32::fat32(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label) :
|
||||
fat16(firstsector, lastsector, sectorsused, label, FileSystem::Type::Fat32)
|
||||
fat32::fat32(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label, const QList<FSFeature>& features) :
|
||||
fat16(firstsector, lastsector, sectorsused, label, features, FileSystem::Type::Fat32)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -43,8 +43,7 @@ qint64 fat32::maxCapacity() const
|
|||
|
||||
bool fat32::create(Report& report, const QString& deviceNode)
|
||||
{
|
||||
ExternalCommand cmd(report, QStringLiteral("mkfs.fat"), { QStringLiteral("-F32"), QStringLiteral("-I"), QStringLiteral("-v"), deviceNode });
|
||||
return cmd.run(-1) && cmd.exitCode() == 0;
|
||||
return createWithFatSize(report, deviceNode, 32);
|
||||
}
|
||||
|
||||
bool fat32::updateUUID(Report& report, const QString& deviceNode) const
|
||||
|
|
|
@ -40,7 +40,7 @@ namespace FS
|
|||
class LIBKPMCORE_EXPORT fat32 : public fat16
|
||||
{
|
||||
public:
|
||||
fat32(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label);
|
||||
fat32(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label, const QList<FSFeature>& features = {});
|
||||
|
||||
public:
|
||||
bool create(Report& report, const QString& deviceNode) override;
|
||||
|
|
|
@ -0,0 +1,126 @@
|
|||
/*************************************************************************
|
||||
* Copyright (C) 2019 by Collabora Ltd <arnaud.ferraris@collabora.com> *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU General Public License as *
|
||||
* published by the Free Software Foundation; either version 3 of *
|
||||
* the License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.*
|
||||
*************************************************************************/
|
||||
|
||||
#include "fs/filesystem.h"
|
||||
|
||||
struct FSFeaturePrivate {
|
||||
QString m_name;
|
||||
FSFeature::Type m_type;
|
||||
bool m_boolean;
|
||||
int m_integer;
|
||||
QString m_string;
|
||||
};
|
||||
|
||||
FSFeature::FSFeature(const QString& n, FSFeature::Type t) :
|
||||
d(std::make_unique<FSFeaturePrivate>())
|
||||
{
|
||||
d->m_name = n;
|
||||
d->m_type = t;
|
||||
}
|
||||
|
||||
FSFeature::FSFeature(const QString& n, bool b) :
|
||||
d(std::make_unique<FSFeaturePrivate>())
|
||||
{
|
||||
d->m_name = n;
|
||||
d->m_type = FSFeature::Type::Bool;
|
||||
d->m_boolean = b;
|
||||
}
|
||||
|
||||
FSFeature::FSFeature(const QString& n, int i) :
|
||||
d(std::make_unique<FSFeaturePrivate>())
|
||||
{
|
||||
d->m_name = n;
|
||||
d->m_type = FSFeature::Type::Int;
|
||||
d->m_integer = i;
|
||||
}
|
||||
|
||||
FSFeature::FSFeature(const QString& n, const QString& s) :
|
||||
d(std::make_unique<FSFeaturePrivate>())
|
||||
{
|
||||
d->m_name = n;
|
||||
d->m_type = FSFeature::Type::String;
|
||||
d->m_string = s;
|
||||
}
|
||||
|
||||
FSFeature::FSFeature(const FSFeature& other) :
|
||||
d(std::make_unique<FSFeaturePrivate>(*(other.d)))
|
||||
{
|
||||
}
|
||||
|
||||
FSFeature::~FSFeature()
|
||||
{
|
||||
}
|
||||
|
||||
FSFeature& FSFeature::operator=(const FSFeature& other)
|
||||
{
|
||||
if (&other != this)
|
||||
*d = *(other.d);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
const QString& FSFeature::name()
|
||||
{
|
||||
return d->m_name;
|
||||
}
|
||||
|
||||
FSFeature::Type FSFeature::type()
|
||||
{
|
||||
return d->m_type;
|
||||
}
|
||||
|
||||
bool FSFeature::bValue()
|
||||
{
|
||||
return d->m_boolean;
|
||||
}
|
||||
|
||||
int FSFeature::iValue()
|
||||
{
|
||||
return d->m_integer;
|
||||
}
|
||||
|
||||
const QString& FSFeature::sValue()
|
||||
{
|
||||
return d->m_string;
|
||||
}
|
||||
|
||||
bool FSFeature::setValue(bool b)
|
||||
{
|
||||
if (d->m_type != FSFeature::Type::Bool)
|
||||
return false;
|
||||
|
||||
d->m_boolean = b;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool FSFeature::setValue(int i)
|
||||
{
|
||||
if (d->m_type != FSFeature::Type::Int)
|
||||
return false;
|
||||
|
||||
d->m_integer = i;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool FSFeature::setValue(const QString& s)
|
||||
{
|
||||
if (d->m_type != FSFeature::Type::String)
|
||||
return false;
|
||||
|
||||
d->m_string = s;
|
||||
return true;
|
||||
}
|
|
@ -0,0 +1,77 @@
|
|||
/*************************************************************************
|
||||
* Copyright (C) 2019 by Collabora Ltd <arnaud.ferraris@collabora.com> *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU General Public License as *
|
||||
* published by the Free Software Foundation; either version 3 of *
|
||||
* the License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.*
|
||||
*************************************************************************/
|
||||
|
||||
#ifndef KPMCORE_FSFEATURE_H
|
||||
#define KPMCORE_FSFEATURE_H
|
||||
|
||||
#include "util/libpartitionmanagerexport.h"
|
||||
|
||||
#include <QString>
|
||||
|
||||
#include <memory>
|
||||
|
||||
struct FSFeaturePrivate;
|
||||
|
||||
/**
|
||||
* Class for filesystem-specific features
|
||||
*
|
||||
* FSFeatures have a name, type (boolean, integer or string) and value.
|
||||
* This class can be used to describe specific features for any FileSystem, but it
|
||||
* is up to each FileSystem implementation to handle them as needed.
|
||||
*/
|
||||
class LIBKPMCORE_EXPORT FSFeature
|
||||
{
|
||||
public:
|
||||
enum Type : int {
|
||||
Bool,
|
||||
Int,
|
||||
String
|
||||
};
|
||||
|
||||
public:
|
||||
FSFeature(const QString& n, Type t = Type::Bool);
|
||||
FSFeature(const QString& n, bool b);
|
||||
FSFeature(const QString& n, int i);
|
||||
FSFeature(const QString& n, const QString& s);
|
||||
FSFeature(const FSFeature& f);
|
||||
~FSFeature();
|
||||
|
||||
FSFeature& operator=(const FSFeature& f);
|
||||
|
||||
Type type();
|
||||
const QString& name();
|
||||
|
||||
/**< @return the value of a boolean FSFeature ; feature type is NOT checked */
|
||||
bool bValue();
|
||||
/**< @return the value of an integer FSFeature ; feature type is NOT checked */
|
||||
int iValue();
|
||||
/**< @return the value of a string FSFeature ; feature type is NOT checked */
|
||||
const QString& sValue();
|
||||
|
||||
/**
|
||||
* Set feature value
|
||||
* @return false if the feature is of the wrong type
|
||||
*/
|
||||
bool setValue(bool b);
|
||||
bool setValue(int i);
|
||||
bool setValue(const QString& s);
|
||||
|
||||
private:
|
||||
std::unique_ptr<FSFeaturePrivate> d;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -84,6 +84,8 @@ struct FileSystemPrivate {
|
|||
qint64 m_SectorsUsed;
|
||||
QString m_Label;
|
||||
QString m_UUID;
|
||||
QList<FSFeature> m_AvailableFeatures;
|
||||
QList<FSFeature> m_Features;
|
||||
};
|
||||
|
||||
/** Creates a new FileSystem object
|
||||
|
@ -104,6 +106,26 @@ FileSystem::FileSystem(qint64 firstsector, qint64 lastsector, qint64 sectorsused
|
|||
d->m_UUID = QString();
|
||||
}
|
||||
|
||||
/** Creates a new FileSystem object
|
||||
@param firstsector the first sector used by this FileSystem on the Device
|
||||
@param lastsector the last sector used by this FileSystem on the Device
|
||||
@param sectorsused the number of sectors in use on the FileSystem
|
||||
@param label the FileSystem label
|
||||
@param features the FileSystem features
|
||||
@param type the FileSystem type
|
||||
*/
|
||||
FileSystem::FileSystem(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label, const QList<FSFeature>& features, FileSystem::Type type) :
|
||||
d(std::make_unique<FileSystemPrivate>())
|
||||
{
|
||||
d->m_Type = type;
|
||||
d->m_FirstSector = firstsector;
|
||||
d->m_LastSector = lastsector;
|
||||
d->m_SectorsUsed = sectorsused;
|
||||
d->m_Label = label;
|
||||
d->m_Features = features;
|
||||
d->m_UUID = QString();
|
||||
}
|
||||
|
||||
FileSystem::~FileSystem()
|
||||
{
|
||||
}
|
||||
|
@ -582,6 +604,26 @@ bool FileSystem::findExternal(const QString& cmdName, const QStringList& args, i
|
|||
return cmd.exitCode() == 0 || cmd.exitCode() == expectedCode;
|
||||
}
|
||||
|
||||
void FileSystem::addAvailableFeature(const FSFeature& feature)
|
||||
{
|
||||
d->m_AvailableFeatures.append(feature);
|
||||
}
|
||||
|
||||
void FileSystem::addAvailableFeature(const QString& name, FSFeature::Type type)
|
||||
{
|
||||
d->m_AvailableFeatures.append(FSFeature(name, type));
|
||||
}
|
||||
|
||||
void FileSystem::addFeature(const FSFeature& feature)
|
||||
{
|
||||
d->m_Features.append(feature);
|
||||
}
|
||||
|
||||
void FileSystem::addFeatures(const QList<FSFeature>& features)
|
||||
{
|
||||
d->m_Features.append(features);
|
||||
}
|
||||
|
||||
bool FileSystem::supportToolFound() const
|
||||
{
|
||||
return false;
|
||||
|
@ -607,6 +649,16 @@ const QString& FileSystem::label() const
|
|||
return d->m_Label;
|
||||
}
|
||||
|
||||
const QList<FSFeature>& FileSystem::availableFeatures() const
|
||||
{
|
||||
return d->m_AvailableFeatures;
|
||||
}
|
||||
|
||||
const QList<FSFeature>& FileSystem::features() const
|
||||
{
|
||||
return d->m_Features;
|
||||
}
|
||||
|
||||
qint64 FileSystem::sectorSize() const
|
||||
{
|
||||
return d->m_SectorSize;
|
||||
|
|
|
@ -20,8 +20,11 @@
|
|||
#ifndef KPMCORE_FILESYSTEM_H
|
||||
#define KPMCORE_FILESYSTEM_H
|
||||
|
||||
|
||||
#include "util/libpartitionmanagerexport.h"
|
||||
|
||||
#include "fs/feature.h"
|
||||
|
||||
#include <QList>
|
||||
#include <QStringList>
|
||||
#include <QString>
|
||||
|
@ -113,6 +116,7 @@ public:
|
|||
|
||||
protected:
|
||||
FileSystem(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label, FileSystem::Type type);
|
||||
FileSystem(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label, const QList<FSFeature>& features, FileSystem::Type type);
|
||||
|
||||
public:
|
||||
virtual ~FileSystem();
|
||||
|
@ -149,6 +153,9 @@ public:
|
|||
virtual CommandSupportType supportCreateWithLabel() const {
|
||||
return cmdSupportNone; /**< @return CommandSupportType for creating */
|
||||
}
|
||||
virtual CommandSupportType supportCreateWithFeatures() const {
|
||||
return cmdSupportNone; /**< @return CommandSupportType for creating */
|
||||
}
|
||||
virtual CommandSupportType supportGrow() const {
|
||||
return cmdSupportNone; /**< @return CommandSupportType for growing */
|
||||
}
|
||||
|
@ -263,6 +270,18 @@ public:
|
|||
/**< @return the FileSystem's label */
|
||||
const QString& label() const;
|
||||
|
||||
/**< @return the FileSystem's available features */
|
||||
const QList<FSFeature>& availableFeatures() const;
|
||||
|
||||
/**< @return the FileSystem's features */
|
||||
const QList<FSFeature>& features() const;
|
||||
|
||||
/**< @param feature the feature to add to the FileSystem */
|
||||
void addFeature(const FSFeature& feature);
|
||||
|
||||
/**< @param features the list of features to add to the FileSystem */
|
||||
void addFeatures(const QList<FSFeature>& features);
|
||||
|
||||
/**< @return the sector size in the underlying Device */
|
||||
qint64 sectorSize() const;
|
||||
|
||||
|
@ -286,6 +305,8 @@ public:
|
|||
|
||||
protected:
|
||||
static bool findExternal(const QString& cmdName, const QStringList& args = QStringList(), int exptectedCode = 1);
|
||||
void addAvailableFeature(const FSFeature& feature);
|
||||
void addAvailableFeature(const QString& name, FSFeature::Type type = FSFeature::Type::Bool);
|
||||
|
||||
std::unique_ptr<FileSystemPrivate> d;
|
||||
};
|
||||
|
|
|
@ -116,45 +116,45 @@ void FileSystemFactory::init()
|
|||
@param label the FileSystem's label
|
||||
@return pointer to the newly created FileSystem object or nullptr if FileSystem could not be created
|
||||
*/
|
||||
FileSystem* FileSystemFactory::create(FileSystem::Type t, qint64 firstsector, qint64 lastsector, qint64 sectorSize, qint64 sectorsused, const QString& label, const QString& uuid)
|
||||
FileSystem* FileSystemFactory::create(FileSystem::Type t, qint64 firstsector, qint64 lastsector, qint64 sectorSize, qint64 sectorsused, const QString& label, const QList<FSFeature>& features, const QString& uuid)
|
||||
{
|
||||
FileSystem* fs = nullptr;
|
||||
|
||||
switch (t) {
|
||||
case FileSystem::Type::Apfs: fs = new FS::apfs (firstsector, lastsector, sectorsused, label); break;
|
||||
case FileSystem::Type::BitLocker: fs = new FS::bitlocker (firstsector, lastsector, sectorsused, label); break;
|
||||
case FileSystem::Type::Btrfs: fs = new FS::btrfs (firstsector, lastsector, sectorsused, label); break;
|
||||
case FileSystem::Type::Exfat: fs = new FS::exfat (firstsector, lastsector, sectorsused, label); break;
|
||||
case FileSystem::Type::Ext2: fs = new FS::ext2 (firstsector, lastsector, sectorsused, label); break;
|
||||
case FileSystem::Type::Ext3: fs = new FS::ext3 (firstsector, lastsector, sectorsused, label); break;
|
||||
case FileSystem::Type::Ext4: fs = new FS::ext4 (firstsector, lastsector, sectorsused, label); break;
|
||||
case FileSystem::Type::Extended: fs = new FS::extended (firstsector, lastsector, sectorsused, label); break;
|
||||
case FileSystem::Type::F2fs: fs = new FS::f2fs (firstsector, lastsector, sectorsused, label); break;
|
||||
case FileSystem::Type::Fat12: fs = new FS::fat12 (firstsector, lastsector, sectorsused, label); break;
|
||||
case FileSystem::Type::Fat16: fs = new FS::fat16 (firstsector, lastsector, sectorsused, label); break;
|
||||
case FileSystem::Type::Fat32: fs = new FS::fat32 (firstsector, lastsector, sectorsused, label); break;
|
||||
case FileSystem::Type::Hfs: fs = new FS::hfs (firstsector, lastsector, sectorsused, label); break;
|
||||
case FileSystem::Type::HfsPlus: fs = new FS::hfsplus (firstsector, lastsector, sectorsused, label); break;
|
||||
case FileSystem::Type::Hpfs: fs = new FS::hpfs (firstsector, lastsector, sectorsused, label); break;
|
||||
case FileSystem::Type::Iso9660: fs = new FS::iso9660 (firstsector, lastsector, sectorsused, label); break;
|
||||
case FileSystem::Type::Jfs: fs = new FS::jfs (firstsector, lastsector, sectorsused, label); break;
|
||||
case FileSystem::Type::LinuxRaidMember: fs = new FS::linuxraidmember(firstsector, lastsector, sectorsused, label); break;
|
||||
case FileSystem::Type::LinuxSwap: fs = new FS::linuxswap (firstsector, lastsector, sectorsused, label); break;
|
||||
case FileSystem::Type::Luks: fs = new FS::luks (firstsector, lastsector, sectorsused, label); break;
|
||||
case FileSystem::Type::Luks2: fs = new FS::luks2 (firstsector, lastsector, sectorsused, label); break;
|
||||
case FileSystem::Type::Lvm2_PV: fs = new FS::lvm2_pv (firstsector, lastsector, sectorsused, label); break;
|
||||
case FileSystem::Type::Minix: fs = new FS::minix (firstsector, lastsector, sectorsused, label); break;
|
||||
case FileSystem::Type::Nilfs2: fs = new FS::nilfs2 (firstsector, lastsector, sectorsused, label); break;
|
||||
case FileSystem::Type::Ntfs: fs = new FS::ntfs (firstsector, lastsector, sectorsused, label); break;
|
||||
case FileSystem::Type::Ocfs2: fs = new FS::ocfs2 (firstsector, lastsector, sectorsused, label); break;
|
||||
case FileSystem::Type::ReiserFS: fs = new FS::reiserfs (firstsector, lastsector, sectorsused, label); break;
|
||||
case FileSystem::Type::Reiser4: fs = new FS::reiser4 (firstsector, lastsector, sectorsused, label); break;
|
||||
case FileSystem::Type::Udf: fs = new FS::udf (firstsector, lastsector, sectorsused, label); break;
|
||||
case FileSystem::Type::Ufs: fs = new FS::ufs (firstsector, lastsector, sectorsused, label); break;
|
||||
case FileSystem::Type::Unformatted: fs = new FS::unformatted (firstsector, lastsector, sectorsused, label); break;
|
||||
case FileSystem::Type::Unknown: fs = new FS::unknown (firstsector, lastsector, sectorsused, label); break;
|
||||
case FileSystem::Type::Xfs: fs = new FS::xfs (firstsector, lastsector, sectorsused, label); break;
|
||||
case FileSystem::Type::Zfs: fs = new FS::zfs (firstsector, lastsector, sectorsused, label); break;
|
||||
case FileSystem::Type::Apfs: fs = new FS::apfs (firstsector, lastsector, sectorsused, label, features); break;
|
||||
case FileSystem::Type::BitLocker: fs = new FS::bitlocker (firstsector, lastsector, sectorsused, label, features); break;
|
||||
case FileSystem::Type::Btrfs: fs = new FS::btrfs (firstsector, lastsector, sectorsused, label, features); break;
|
||||
case FileSystem::Type::Exfat: fs = new FS::exfat (firstsector, lastsector, sectorsused, label, features); break;
|
||||
case FileSystem::Type::Ext2: fs = new FS::ext2 (firstsector, lastsector, sectorsused, label, features); break;
|
||||
case FileSystem::Type::Ext3: fs = new FS::ext3 (firstsector, lastsector, sectorsused, label, features); break;
|
||||
case FileSystem::Type::Ext4: fs = new FS::ext4 (firstsector, lastsector, sectorsused, label, features); break;
|
||||
case FileSystem::Type::Extended: fs = new FS::extended (firstsector, lastsector, sectorsused, label, features); break;
|
||||
case FileSystem::Type::F2fs: fs = new FS::f2fs (firstsector, lastsector, sectorsused, label, features); break;
|
||||
case FileSystem::Type::Fat12: fs = new FS::fat12 (firstsector, lastsector, sectorsused, label, features); break;
|
||||
case FileSystem::Type::Fat16: fs = new FS::fat16 (firstsector, lastsector, sectorsused, label, features); break;
|
||||
case FileSystem::Type::Fat32: fs = new FS::fat32 (firstsector, lastsector, sectorsused, label, features); break;
|
||||
case FileSystem::Type::Hfs: fs = new FS::hfs (firstsector, lastsector, sectorsused, label, features); break;
|
||||
case FileSystem::Type::HfsPlus: fs = new FS::hfsplus (firstsector, lastsector, sectorsused, label, features); break;
|
||||
case FileSystem::Type::Hpfs: fs = new FS::hpfs (firstsector, lastsector, sectorsused, label, features); break;
|
||||
case FileSystem::Type::Iso9660: fs = new FS::iso9660 (firstsector, lastsector, sectorsused, label, features); break;
|
||||
case FileSystem::Type::Jfs: fs = new FS::jfs (firstsector, lastsector, sectorsused, label, features); break;
|
||||
case FileSystem::Type::LinuxRaidMember: fs = new FS::linuxraidmember(firstsector, lastsector, sectorsused, label, features); break;
|
||||
case FileSystem::Type::LinuxSwap: fs = new FS::linuxswap (firstsector, lastsector, sectorsused, label, features); break;
|
||||
case FileSystem::Type::Luks: fs = new FS::luks (firstsector, lastsector, sectorsused, label, features); break;
|
||||
case FileSystem::Type::Luks2: fs = new FS::luks2 (firstsector, lastsector, sectorsused, label, features); break;
|
||||
case FileSystem::Type::Lvm2_PV: fs = new FS::lvm2_pv (firstsector, lastsector, sectorsused, label, features); break;
|
||||
case FileSystem::Type::Minix: fs = new FS::minix (firstsector, lastsector, sectorsused, label, features); break;
|
||||
case FileSystem::Type::Nilfs2: fs = new FS::nilfs2 (firstsector, lastsector, sectorsused, label, features); break;
|
||||
case FileSystem::Type::Ntfs: fs = new FS::ntfs (firstsector, lastsector, sectorsused, label, features); break;
|
||||
case FileSystem::Type::Ocfs2: fs = new FS::ocfs2 (firstsector, lastsector, sectorsused, label, features); break;
|
||||
case FileSystem::Type::ReiserFS: fs = new FS::reiserfs (firstsector, lastsector, sectorsused, label, features); break;
|
||||
case FileSystem::Type::Reiser4: fs = new FS::reiser4 (firstsector, lastsector, sectorsused, label, features); break;
|
||||
case FileSystem::Type::Udf: fs = new FS::udf (firstsector, lastsector, sectorsused, label, features); break;
|
||||
case FileSystem::Type::Ufs: fs = new FS::ufs (firstsector, lastsector, sectorsused, label, features); break;
|
||||
case FileSystem::Type::Unformatted: fs = new FS::unformatted (firstsector, lastsector, sectorsused, label, features); break;
|
||||
case FileSystem::Type::Unknown: fs = new FS::unknown (firstsector, lastsector, sectorsused, label, features); break;
|
||||
case FileSystem::Type::Xfs: fs = new FS::xfs (firstsector, lastsector, sectorsused, label, features); break;
|
||||
case FileSystem::Type::Zfs: fs = new FS::zfs (firstsector, lastsector, sectorsused, label, features); break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
|
@ -171,7 +171,7 @@ FileSystem* FileSystemFactory::create(FileSystem::Type t, qint64 firstsector, qi
|
|||
*/
|
||||
FileSystem* FileSystemFactory::create(const FileSystem& other)
|
||||
{
|
||||
return create(other.type(), other.firstSector(), other.lastSector(), other.sectorSize(), other.sectorsUsed(), other.label(), other.uuid());
|
||||
return create(other.type(), other.firstSector(), other.lastSector(), other.sectorSize(), other.sectorsUsed(), other.label(), other.features(), other.uuid());
|
||||
}
|
||||
|
||||
/** @return the map of FileSystems */
|
||||
|
@ -187,5 +187,5 @@ const FileSystemFactory::FileSystems& FileSystemFactory::map()
|
|||
*/
|
||||
FileSystem* FileSystemFactory::cloneWithNewType(FileSystem::Type newType, const FileSystem& other)
|
||||
{
|
||||
return create(newType, other.firstSector(), other.lastSector(), other.sectorSize(), other.sectorsUsed(), other.label());
|
||||
return create(newType, other.firstSector(), other.lastSector(), other.sectorSize(), other.sectorsUsed(), other.label(), other.features());
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ private:
|
|||
|
||||
public:
|
||||
static void init();
|
||||
static FileSystem* create(FileSystem::Type t, qint64 firstsector, qint64 lastsector, qint64 sectorSize, qint64 sectorsused = -1, const QString& label = QString(), const QString& uuid = QString());
|
||||
static FileSystem* create(FileSystem::Type t, qint64 firstsector, qint64 lastsector, qint64 sectorSize, qint64 sectorsused = -1, const QString& label = QString(), const QList<FSFeature>& features = {}, const QString& uuid = QString());
|
||||
static FileSystem* create(const FileSystem& other);
|
||||
static FileSystem* cloneWithNewType(FileSystem::Type newType, const FileSystem& other);
|
||||
static const FileSystems& map();
|
||||
|
|
|
@ -34,8 +34,8 @@ FileSystem::CommandSupportType hfs::m_Check = FileSystem::cmdSupportNone;
|
|||
FileSystem::CommandSupportType hfs::m_Copy = FileSystem::cmdSupportNone;
|
||||
FileSystem::CommandSupportType hfs::m_Backup = FileSystem::cmdSupportNone;
|
||||
|
||||
hfs::hfs(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label) :
|
||||
FileSystem(firstsector, lastsector, sectorsused, label, FileSystem::Type::Hfs)
|
||||
hfs::hfs(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label, const QList<FSFeature>& features) :
|
||||
FileSystem(firstsector, lastsector, sectorsused, label, features, FileSystem::Type::Hfs)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ namespace FS
|
|||
class LIBKPMCORE_EXPORT hfs : public FileSystem
|
||||
{
|
||||
public:
|
||||
hfs(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label);
|
||||
hfs(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label, const QList<FSFeature>& features = {});
|
||||
|
||||
public:
|
||||
void init() override;
|
||||
|
|
|
@ -34,8 +34,8 @@ FileSystem::CommandSupportType hfsplus::m_Create = FileSystem::cmdSupportNone;
|
|||
FileSystem::CommandSupportType hfsplus::m_Copy = FileSystem::cmdSupportNone;
|
||||
FileSystem::CommandSupportType hfsplus::m_Backup = FileSystem::cmdSupportNone;
|
||||
|
||||
hfsplus::hfsplus(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label) :
|
||||
FileSystem(firstsector, lastsector, sectorsused, label, FileSystem::Type::HfsPlus)
|
||||
hfsplus::hfsplus(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label, const QList<FSFeature>& features) :
|
||||
FileSystem(firstsector, lastsector, sectorsused, label, features, FileSystem::Type::HfsPlus)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ namespace FS
|
|||
class LIBKPMCORE_EXPORT hfsplus : public FileSystem
|
||||
{
|
||||
public:
|
||||
hfsplus(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label);
|
||||
hfsplus(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label, const QList<FSFeature>& features = {});
|
||||
|
||||
public:
|
||||
void init() override;
|
||||
|
|
|
@ -36,8 +36,8 @@ FileSystem::CommandSupportType hpfs::m_SetLabel = FileSystem::cmdSupportNone;
|
|||
FileSystem::CommandSupportType hpfs::m_UpdateUUID = FileSystem::cmdSupportNone;
|
||||
FileSystem::CommandSupportType hpfs::m_GetUUID = FileSystem::cmdSupportNone;
|
||||
|
||||
hpfs::hpfs(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label) :
|
||||
FileSystem(firstsector, lastsector, sectorsused, label, FileSystem::Type::Hpfs)
|
||||
hpfs::hpfs(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label, const QList<FSFeature>& features) :
|
||||
FileSystem(firstsector, lastsector, sectorsused, label, features, FileSystem::Type::Hpfs)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ namespace FS
|
|||
class LIBKPMCORE_EXPORT hpfs : public FileSystem
|
||||
{
|
||||
public:
|
||||
hpfs(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label);
|
||||
hpfs(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label, const QList<FSFeature>& features = {});
|
||||
|
||||
public:
|
||||
CommandSupportType supportGetUsed() const override {
|
||||
|
|
|
@ -20,8 +20,8 @@
|
|||
namespace FS
|
||||
{
|
||||
|
||||
iso9660::iso9660(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label) :
|
||||
FileSystem(firstsector, lastsector, sectorsused, label, FileSystem::Type::Iso9660)
|
||||
iso9660::iso9660(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label, const QList<FSFeature>& features) :
|
||||
FileSystem(firstsector, lastsector, sectorsused, label, features, FileSystem::Type::Iso9660)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ namespace FS
|
|||
class LIBKPMCORE_EXPORT iso9660 : public FileSystem
|
||||
{
|
||||
public:
|
||||
iso9660(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label);
|
||||
iso9660(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label, const QList<FSFeature>& features = {});
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -39,8 +39,8 @@ FileSystem::CommandSupportType jfs::m_Copy = FileSystem::cmdSupportNone;
|
|||
FileSystem::CommandSupportType jfs::m_Backup = FileSystem::cmdSupportNone;
|
||||
FileSystem::CommandSupportType jfs::m_SetLabel = FileSystem::cmdSupportNone;
|
||||
|
||||
jfs::jfs(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label) :
|
||||
FileSystem(firstsector, lastsector, sectorsused, label, FileSystem::Type::Jfs)
|
||||
jfs::jfs(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label, const QList<FSFeature>& features) :
|
||||
FileSystem(firstsector, lastsector, sectorsused, label, features, FileSystem::Type::Jfs)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ namespace FS
|
|||
class LIBKPMCORE_EXPORT jfs : public FileSystem
|
||||
{
|
||||
public:
|
||||
jfs(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label);
|
||||
jfs(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label, const QList<FSFeature>& features = {});
|
||||
|
||||
public:
|
||||
void init() override;
|
||||
|
|
|
@ -20,8 +20,8 @@
|
|||
namespace FS
|
||||
{
|
||||
|
||||
linuxraidmember::linuxraidmember(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label) :
|
||||
FileSystem(firstsector, lastsector, sectorsused, label, FileSystem::Type::LinuxRaidMember)
|
||||
linuxraidmember::linuxraidmember(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label, const QList<FSFeature>& features) :
|
||||
FileSystem(firstsector, lastsector, sectorsused, label, features, FileSystem::Type::LinuxRaidMember)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ namespace FS
|
|||
class LIBKPMCORE_EXPORT linuxraidmember : public FileSystem
|
||||
{
|
||||
public:
|
||||
linuxraidmember(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label);
|
||||
linuxraidmember(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label, const QList<FSFeature>& features = {});
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -39,8 +39,8 @@ FileSystem::CommandSupportType linuxswap::m_SetLabel = FileSystem::cmdSupportNon
|
|||
FileSystem::CommandSupportType linuxswap::m_GetUUID = FileSystem::cmdSupportNone;
|
||||
FileSystem::CommandSupportType linuxswap::m_UpdateUUID = FileSystem::cmdSupportNone;
|
||||
|
||||
linuxswap::linuxswap(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label) :
|
||||
FileSystem(firstsector, lastsector, sectorsused, label, FileSystem::Type::LinuxSwap)
|
||||
linuxswap::linuxswap(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label, const QList<FSFeature>& features) :
|
||||
FileSystem(firstsector, lastsector, sectorsused, label, features, FileSystem::Type::LinuxSwap)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ namespace FS
|
|||
class LIBKPMCORE_EXPORT linuxswap : public FileSystem
|
||||
{
|
||||
public:
|
||||
linuxswap(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label);
|
||||
linuxswap(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label, const QList<FSFeature>& features = {});
|
||||
|
||||
public:
|
||||
void init() override;
|
||||
|
|
|
@ -63,8 +63,9 @@ luks::luks(qint64 firstsector,
|
|||
qint64 lastsector,
|
||||
qint64 sectorsused,
|
||||
const QString& label,
|
||||
const QList<FSFeature>& features,
|
||||
FileSystem::Type t)
|
||||
: FileSystem(firstsector, lastsector, sectorsused, label, t)
|
||||
: FileSystem(firstsector, lastsector, sectorsused, label, features, t)
|
||||
, m_innerFs(nullptr)
|
||||
, m_isCryptOpen(false)
|
||||
, m_cryptsetupFound(m_Create != cmdSupportNone)
|
||||
|
|
|
@ -39,7 +39,7 @@ namespace FS
|
|||
class LIBKPMCORE_EXPORT luks : public FileSystem
|
||||
{
|
||||
public:
|
||||
luks(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label, FileSystem::Type t = FileSystem::Type::Luks);
|
||||
luks(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label, const QList<FSFeature>& features = {}, FileSystem::Type t = FileSystem::Type::Luks);
|
||||
~luks() override;
|
||||
|
||||
enum class KeyLocation {
|
||||
|
|
|
@ -27,8 +27,8 @@
|
|||
namespace FS
|
||||
{
|
||||
|
||||
luks2::luks2(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label)
|
||||
: luks(firstsector, lastsector, sectorsused, label, FileSystem::Type::Luks2)
|
||||
luks2::luks2(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label, const QList<FSFeature>& features)
|
||||
: luks(firstsector, lastsector, sectorsused, label, features, FileSystem::Type::Luks2)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ namespace FS
|
|||
class LIBKPMCORE_EXPORT luks2 : public luks
|
||||
{
|
||||
public:
|
||||
luks2(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label);
|
||||
luks2(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label, const QList<FSFeature>& features = {});
|
||||
~luks2() override;
|
||||
|
||||
bool create(Report& report, const QString& deviceNode) override;
|
||||
|
|
|
@ -42,8 +42,8 @@ FileSystem::CommandSupportType lvm2_pv::m_UpdateUUID = FileSystem::cmdSupportNon
|
|||
FileSystem::CommandSupportType lvm2_pv::m_GetUUID = FileSystem::cmdSupportNone;
|
||||
|
||||
lvm2_pv::lvm2_pv(qint64 firstsector, qint64 lastsector,
|
||||
qint64 sectorsused, const QString& label)
|
||||
: FileSystem(firstsector, lastsector, sectorsused, label, FileSystem::Type::Lvm2_PV)
|
||||
qint64 sectorsused, const QString& label, const QList<FSFeature>& features)
|
||||
: FileSystem(firstsector, lastsector, sectorsused, label, features, FileSystem::Type::Lvm2_PV)
|
||||
, m_PESize(0)
|
||||
, m_TotalPE(0)
|
||||
, m_AllocatedPE(0)
|
||||
|
|
|
@ -89,7 +89,7 @@ class LIBKPMCORE_EXPORT lvm2_pv : public FileSystem
|
|||
{
|
||||
|
||||
public:
|
||||
lvm2_pv(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label);
|
||||
lvm2_pv(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label, const QList<FSFeature>& features = {});
|
||||
|
||||
public:
|
||||
void init() override;
|
||||
|
|
|
@ -33,8 +33,8 @@ FileSystem::CommandSupportType minix::m_Create = FileSystem::cmdSupportNone;
|
|||
FileSystem::CommandSupportType minix::m_Copy = FileSystem::cmdSupportNone;
|
||||
FileSystem::CommandSupportType minix::m_Backup = FileSystem::cmdSupportNone;
|
||||
|
||||
minix::minix(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label) :
|
||||
FileSystem(firstsector, lastsector, sectorsused, label, FileSystem::Type::Minix)
|
||||
minix::minix(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label, const QList<FSFeature>& features) :
|
||||
FileSystem(firstsector, lastsector, sectorsused, label, features, FileSystem::Type::Minix)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -34,8 +34,8 @@ namespace FS
|
|||
class LIBKPMCORE_EXPORT minix : public FileSystem
|
||||
{
|
||||
public:
|
||||
minix(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label);
|
||||
|
||||
minix(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label, const QList<FSFeature>& features = {});
|
||||
|
||||
void init() override;
|
||||
|
||||
bool check(Report& report, const QString&deviceNode) const override;
|
||||
|
|
|
@ -46,8 +46,8 @@ FileSystem::CommandSupportType nilfs2::m_SetLabel = FileSystem::cmdSupportNone;
|
|||
FileSystem::CommandSupportType nilfs2::m_UpdateUUID = FileSystem::cmdSupportNone;
|
||||
FileSystem::CommandSupportType nilfs2::m_GetUUID = FileSystem::cmdSupportNone;
|
||||
|
||||
nilfs2::nilfs2(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label) :
|
||||
FileSystem(firstsector, lastsector, sectorsused, label, FileSystem::Type::Nilfs2)
|
||||
nilfs2::nilfs2(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label, const QList<FSFeature>& features) :
|
||||
FileSystem(firstsector, lastsector, sectorsused, label, features, FileSystem::Type::Nilfs2)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ namespace FS
|
|||
class LIBKPMCORE_EXPORT nilfs2 : public FileSystem
|
||||
{
|
||||
public:
|
||||
nilfs2(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label);
|
||||
nilfs2(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label, const QList<FSFeature>& features = {});
|
||||
|
||||
public:
|
||||
void init() override;
|
||||
|
|
|
@ -48,8 +48,8 @@ FileSystem::CommandSupportType ntfs::m_SetLabel = FileSystem::cmdSupportNone;
|
|||
FileSystem::CommandSupportType ntfs::m_UpdateUUID = FileSystem::cmdSupportNone;
|
||||
FileSystem::CommandSupportType ntfs::m_GetUUID = FileSystem::cmdSupportNone;
|
||||
|
||||
ntfs::ntfs(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label) :
|
||||
FileSystem(firstsector, lastsector, sectorsused, label, FileSystem::Type::Ntfs)
|
||||
ntfs::ntfs(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label, const QList<FSFeature>& features) :
|
||||
FileSystem(firstsector, lastsector, sectorsused, label, features, FileSystem::Type::Ntfs)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ namespace FS
|
|||
class LIBKPMCORE_EXPORT ntfs : public FileSystem
|
||||
{
|
||||
public:
|
||||
ntfs(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label);
|
||||
ntfs(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label, const QList<FSFeature>& features = {});
|
||||
|
||||
public:
|
||||
void init() override;
|
||||
|
|
|
@ -39,8 +39,8 @@ FileSystem::CommandSupportType ocfs2::m_SetLabel = FileSystem::cmdSupportNone;
|
|||
FileSystem::CommandSupportType ocfs2::m_UpdateUUID = FileSystem::cmdSupportNone;
|
||||
FileSystem::CommandSupportType ocfs2::m_GetUUID = FileSystem::cmdSupportNone;
|
||||
|
||||
ocfs2::ocfs2(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label) :
|
||||
FileSystem(firstsector, lastsector, sectorsused, label, FileSystem::Type::Ocfs2)
|
||||
ocfs2::ocfs2(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label, const QList<FSFeature>& features) :
|
||||
FileSystem(firstsector, lastsector, sectorsused, label, features, FileSystem::Type::Ocfs2)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ namespace FS
|
|||
class LIBKPMCORE_EXPORT ocfs2 : public FileSystem
|
||||
{
|
||||
public:
|
||||
ocfs2(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label);
|
||||
ocfs2(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label, const QList<FSFeature>& features = {});
|
||||
|
||||
public:
|
||||
void init() override;
|
||||
|
|
|
@ -34,8 +34,8 @@ FileSystem::CommandSupportType reiser4::m_Check = FileSystem::cmdSupportNone;
|
|||
FileSystem::CommandSupportType reiser4::m_Copy = FileSystem::cmdSupportNone;
|
||||
FileSystem::CommandSupportType reiser4::m_Backup = FileSystem::cmdSupportNone;
|
||||
|
||||
reiser4::reiser4(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label) :
|
||||
FileSystem(firstsector, lastsector, sectorsused, label, FileSystem::Type::Reiser4)
|
||||
reiser4::reiser4(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label, const QList<FSFeature>& features) :
|
||||
FileSystem(firstsector, lastsector, sectorsused, label, features, FileSystem::Type::Reiser4)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ namespace FS
|
|||
class LIBKPMCORE_EXPORT reiser4 : public FileSystem
|
||||
{
|
||||
public:
|
||||
reiser4(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label);
|
||||
reiser4(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label, const QList<FSFeature>& features = {});
|
||||
|
||||
public:
|
||||
void init() override;
|
||||
|
|
|
@ -41,8 +41,8 @@ FileSystem::CommandSupportType reiserfs::m_SetLabel = FileSystem::cmdSupportNone
|
|||
FileSystem::CommandSupportType reiserfs::m_UpdateUUID = FileSystem::cmdSupportNone;
|
||||
FileSystem::CommandSupportType reiserfs::m_GetUUID = FileSystem::cmdSupportNone;
|
||||
|
||||
reiserfs::reiserfs(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label) :
|
||||
FileSystem(firstsector, lastsector, sectorsused, label, FileSystem::Type::ReiserFS)
|
||||
reiserfs::reiserfs(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label, const QList<FSFeature>& features) :
|
||||
FileSystem(firstsector, lastsector, sectorsused, label, features, FileSystem::Type::ReiserFS)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ namespace FS
|
|||
class LIBKPMCORE_EXPORT reiserfs : public FileSystem
|
||||
{
|
||||
public:
|
||||
reiserfs(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label);
|
||||
reiserfs(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label, const QList<FSFeature>& features = {});
|
||||
|
||||
public:
|
||||
void init() override;
|
||||
|
|
|
@ -39,8 +39,8 @@ FileSystem::CommandSupportType udf::m_UpdateUUID = FileSystem::cmdSupportNone;
|
|||
FileSystem::CommandSupportType udf::m_Create = FileSystem::cmdSupportNone;
|
||||
bool udf::oldMkudffsVersion = false;
|
||||
|
||||
udf::udf(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label) :
|
||||
FileSystem(firstsector, lastsector, sectorsused, label, FileSystem::Type::Udf)
|
||||
udf::udf(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label, const QList<FSFeature>& features) :
|
||||
FileSystem(firstsector, lastsector, sectorsused, label, features, FileSystem::Type::Udf)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ namespace FS
|
|||
class LIBKPMCORE_EXPORT udf : public FileSystem
|
||||
{
|
||||
public:
|
||||
udf(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label);
|
||||
udf(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label, const QList<FSFeature>& features = {});
|
||||
|
||||
public:
|
||||
void init() override;
|
||||
|
|
|
@ -23,8 +23,8 @@ FileSystem::CommandSupportType ufs::m_Move = FileSystem::cmdSupportCore;
|
|||
FileSystem::CommandSupportType ufs::m_Copy = FileSystem::cmdSupportCore;
|
||||
FileSystem::CommandSupportType ufs::m_Backup = FileSystem::cmdSupportCore;
|
||||
|
||||
ufs::ufs(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label) :
|
||||
FileSystem(firstsector, lastsector, sectorsused, label, FileSystem::Type::Ufs)
|
||||
ufs::ufs(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label, const QList<FSFeature>& features) :
|
||||
FileSystem(firstsector, lastsector, sectorsused, label, features, FileSystem::Type::Ufs)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ namespace FS
|
|||
class LIBKPMCORE_EXPORT ufs : public FileSystem
|
||||
{
|
||||
public:
|
||||
ufs(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label);
|
||||
ufs(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label, const QList<FSFeature>& features = {});
|
||||
|
||||
public:
|
||||
CommandSupportType supportMove() const override {
|
||||
|
|
|
@ -21,8 +21,8 @@ namespace FS
|
|||
{
|
||||
FileSystem::CommandSupportType unformatted::m_Create = FileSystem::cmdSupportFileSystem;
|
||||
|
||||
unformatted::unformatted(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label) :
|
||||
FileSystem(firstsector, lastsector, sectorsused, label, FileSystem::Type::Unformatted)
|
||||
unformatted::unformatted(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label, const QList<FSFeature>& features) :
|
||||
FileSystem(firstsector, lastsector, sectorsused, label, features, FileSystem::Type::Unformatted)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ namespace FS
|
|||
class LIBKPMCORE_EXPORT unformatted : public FileSystem
|
||||
{
|
||||
public:
|
||||
unformatted(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label);
|
||||
unformatted(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label, const QList<FSFeature>& features = {});
|
||||
|
||||
public:
|
||||
bool create(Report&, const QString&) override;
|
||||
|
|
|
@ -22,8 +22,8 @@ namespace FS
|
|||
|
||||
FileSystem::CommandSupportType unknown::m_Move = FileSystem::cmdSupportNone;
|
||||
|
||||
unknown::unknown(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label) :
|
||||
FileSystem(firstsector, lastsector, sectorsused, label, FileSystem::Type::Unknown)
|
||||
unknown::unknown(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label, const QList<FSFeature>& features) :
|
||||
FileSystem(firstsector, lastsector, sectorsused, label, features, FileSystem::Type::Unknown)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ namespace FS
|
|||
class LIBKPMCORE_EXPORT unknown : public FileSystem
|
||||
{
|
||||
public:
|
||||
unknown(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label);
|
||||
unknown(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label, const QList<FSFeature>& features = {});
|
||||
|
||||
public:
|
||||
bool supportToolFound() const override {
|
||||
|
|
|
@ -41,8 +41,8 @@ FileSystem::CommandSupportType xfs::m_Copy = FileSystem::cmdSupportNone;
|
|||
FileSystem::CommandSupportType xfs::m_Backup = FileSystem::cmdSupportNone;
|
||||
FileSystem::CommandSupportType xfs::m_SetLabel = FileSystem::cmdSupportNone;
|
||||
|
||||
xfs::xfs(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label) :
|
||||
FileSystem(firstsector, lastsector, sectorsused, label, FileSystem::Type::Xfs)
|
||||
xfs::xfs(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label, const QList<FSFeature>& features) :
|
||||
FileSystem(firstsector, lastsector, sectorsused, label, features, FileSystem::Type::Xfs)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ namespace FS
|
|||
class LIBKPMCORE_EXPORT xfs : public FileSystem
|
||||
{
|
||||
public:
|
||||
xfs(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label);
|
||||
xfs(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label, const QList<FSFeature>& features = {});
|
||||
|
||||
public:
|
||||
void init() override;
|
||||
|
|
|
@ -39,8 +39,8 @@ FileSystem::CommandSupportType zfs::m_SetLabel = FileSystem::cmdSupportNone;
|
|||
FileSystem::CommandSupportType zfs::m_UpdateUUID = FileSystem::cmdSupportNone;
|
||||
FileSystem::CommandSupportType zfs::m_GetUUID = FileSystem::cmdSupportNone;
|
||||
|
||||
zfs::zfs(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label) :
|
||||
FileSystem(firstsector, lastsector, sectorsused, label, FileSystem::Type::Zfs)
|
||||
zfs::zfs(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label, const QList<FSFeature>& features) :
|
||||
FileSystem(firstsector, lastsector, sectorsused, label, features, FileSystem::Type::Zfs)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ namespace FS
|
|||
class LIBKPMCORE_EXPORT zfs : public FileSystem
|
||||
{
|
||||
public:
|
||||
zfs(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label);
|
||||
zfs(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label, const QList<FSFeature>& features = {});
|
||||
|
||||
public:
|
||||
void init() override;
|
||||
|
|
|
@ -54,10 +54,11 @@ bool CreateFileSystemJob::run(Report& parent)
|
|||
|
||||
bool createResult;
|
||||
if (partition().fileSystem().supportCreate() == FileSystem::cmdSupportFileSystem) {
|
||||
if (partition().fileSystem().supportCreateWithLabel() == FileSystem::cmdSupportFileSystem)
|
||||
if (partition().fileSystem().supportCreateWithLabel() == FileSystem::cmdSupportFileSystem) {
|
||||
createResult = partition().fileSystem().createWithLabel(*report, partition().deviceNode(), m_Label);
|
||||
else
|
||||
} else {
|
||||
createResult = partition().fileSystem().create(*report, partition().deviceNode());
|
||||
}
|
||||
if (createResult) {
|
||||
if (device().type() == Device::Type::Disk_Device || device().type() == Device::Type::SoftwareRAID_Device) {
|
||||
std::unique_ptr<CoreBackendDevice> backendDevice = CoreBackendManager::self()->backend()->openDevice(device());
|
||||
|
|
Loading…
Reference in New Issue