diff --git a/src/fs/CMakeLists.txt b/src/fs/CMakeLists.txt index 8a03a17..2755bd8 100644 --- a/src/fs/CMakeLists.txt +++ b/src/fs/CMakeLists.txt @@ -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 diff --git a/src/fs/apfs.cpp b/src/fs/apfs.cpp index 984cef2..470a83b 100644 --- a/src/fs/apfs.cpp +++ b/src/fs/apfs.cpp @@ -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& features) : + FileSystem(firstsector, lastsector, sectorsused, label, features, FileSystem::Type::Apfs) { } } diff --git a/src/fs/apfs.h b/src/fs/apfs.h index 2af3a40..9a9fb7d 100644 --- a/src/fs/apfs.h +++ b/src/fs/apfs.h @@ -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& features = {}); public: CommandSupportType supportMove() const override { diff --git a/src/fs/bitlocker.cpp b/src/fs/bitlocker.cpp index 15280cf..3eadfbf 100644 --- a/src/fs/bitlocker.cpp +++ b/src/fs/bitlocker.cpp @@ -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& features) : + FileSystem(firstsector, lastsector, sectorsused, label, features, FileSystem::Type::BitLocker) { } } diff --git a/src/fs/bitlocker.h b/src/fs/bitlocker.h index 493eb4d..2fcfda6 100644 --- a/src/fs/bitlocker.h +++ b/src/fs/bitlocker.h @@ -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& features = {}); public: CommandSupportType supportMove() const override { diff --git a/src/fs/btrfs.cpp b/src/fs/btrfs.cpp index 7f051cf..324e588 100644 --- a/src/fs/btrfs.cpp +++ b/src/fs/btrfs.cpp @@ -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& 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; } diff --git a/src/fs/btrfs.h b/src/fs/btrfs.h index 694f8c8..fded355 100644 --- a/src/fs/btrfs.h +++ b/src/fs/btrfs.h @@ -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& 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; } diff --git a/src/fs/exfat.cpp b/src/fs/exfat.cpp index f92cdf2..4cf7b7c 100644 --- a/src/fs/exfat.cpp +++ b/src/fs/exfat.cpp @@ -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& features) : + FileSystem(firstsector, lastsector, sectorsused, label, features, FileSystem::Type::Exfat) { } diff --git a/src/fs/exfat.h b/src/fs/exfat.h index 55940b0..ca88f8f 100644 --- a/src/fs/exfat.h +++ b/src/fs/exfat.h @@ -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& features = {}); public: void init() override; diff --git a/src/fs/ext2.cpp b/src/fs/ext2.cpp index fce9274..7360ee1 100644 --- a/src/fs/ext2.cpp +++ b/src/fs/ext2.cpp @@ -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& 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; } diff --git a/src/fs/ext2.h b/src/fs/ext2.h index ec2ca59..4b0eaca 100644 --- a/src/fs/ext2.h +++ b/src/fs/ext2.h @@ -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& 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; } diff --git a/src/fs/ext3.cpp b/src/fs/ext3.cpp index 7fa67c9..6ef17fe 100644 --- a/src/fs/ext3.cpp +++ b/src/fs/ext3.cpp @@ -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& 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; } diff --git a/src/fs/ext3.h b/src/fs/ext3.h index 23ac4df..7e5949c 100644 --- a/src/fs/ext3.h +++ b/src/fs/ext3.h @@ -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& features = {}); public: bool create(Report& report, const QString& deviceNode) override; diff --git a/src/fs/ext4.cpp b/src/fs/ext4.cpp index 0fa3811..a70a5a3 100644 --- a/src/fs/ext4.cpp +++ b/src/fs/ext4.cpp @@ -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& 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; } diff --git a/src/fs/ext4.h b/src/fs/ext4.h index 8050413..12e4528 100644 --- a/src/fs/ext4.h +++ b/src/fs/ext4.h @@ -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& features = {}); public: bool create(Report& report, const QString& deviceNode) override; diff --git a/src/fs/extended.cpp b/src/fs/extended.cpp index 49ab801..ae9bea9 100644 --- a/src/fs/extended.cpp +++ b/src/fs/extended.cpp @@ -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& features) : + FileSystem(firstsector, lastsector, sectorsused, label, features, FileSystem::Type::Extended) { } diff --git a/src/fs/extended.h b/src/fs/extended.h index ef00a7c..1bd6bc6 100644 --- a/src/fs/extended.h +++ b/src/fs/extended.h @@ -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& features = {}); public: diff --git a/src/fs/f2fs.cpp b/src/fs/f2fs.cpp index f8c62cb..85d311d 100644 --- a/src/fs/f2fs.cpp +++ b/src/fs/f2fs.cpp @@ -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& features) : + FileSystem(firstsector, lastsector, sectorsused, label, features, FileSystem::Type::F2fs) { } diff --git a/src/fs/f2fs.h b/src/fs/f2fs.h index 4d2d92b..65031cf 100644 --- a/src/fs/f2fs.h +++ b/src/fs/f2fs.h @@ -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& features = {}); public: void init() override; diff --git a/src/fs/fat12.cpp b/src/fs/fat12.cpp index b4917fe..ac55d25 100644 --- a/src/fs/fat12.cpp +++ b/src/fs/fat12.cpp @@ -29,6 +29,9 @@ #include #include +#include +#include + #include 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& 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; } diff --git a/src/fs/fat12.h b/src/fs/fat12.h index 5a02895..22635a5 100644 --- a/src/fs/fat12.h +++ b/src/fs/fat12.h @@ -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& 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; diff --git a/src/fs/fat16.cpp b/src/fs/fat16.cpp index 69962de..4db1b35 100644 --- a/src/fs/fat16.cpp +++ b/src/fs/fat16.cpp @@ -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& 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 diff --git a/src/fs/fat16.h b/src/fs/fat16.h index ea988a5..57e5456 100644 --- a/src/fs/fat16.h +++ b/src/fs/fat16.h @@ -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& features = {}, FileSystem::Type type = FileSystem::Type::Fat16); public: void init() override; diff --git a/src/fs/fat32.cpp b/src/fs/fat32.cpp index 2bb6b34..22ba321 100644 --- a/src/fs/fat32.cpp +++ b/src/fs/fat32.cpp @@ -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& 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 diff --git a/src/fs/fat32.h b/src/fs/fat32.h index a356bf7..e5b467b 100644 --- a/src/fs/fat32.h +++ b/src/fs/fat32.h @@ -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& features = {}); public: bool create(Report& report, const QString& deviceNode) override; diff --git a/src/fs/feature.cpp b/src/fs/feature.cpp new file mode 100644 index 0000000..bb1b001 --- /dev/null +++ b/src/fs/feature.cpp @@ -0,0 +1,126 @@ +/************************************************************************* + * Copyright (C) 2019 by Collabora Ltd * + * * + * 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 .* + *************************************************************************/ + +#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()) +{ + d->m_name = n; + d->m_type = t; +} + +FSFeature::FSFeature(const QString& n, bool b) : + d(std::make_unique()) +{ + 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()) +{ + 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()) +{ + d->m_name = n; + d->m_type = FSFeature::Type::String; + d->m_string = s; +} + +FSFeature::FSFeature(const FSFeature& other) : + d(std::make_unique(*(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; +} diff --git a/src/fs/feature.h b/src/fs/feature.h new file mode 100644 index 0000000..ffa6e58 --- /dev/null +++ b/src/fs/feature.h @@ -0,0 +1,77 @@ +/************************************************************************* + * Copyright (C) 2019 by Collabora Ltd * + * * + * 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 .* + *************************************************************************/ + +#ifndef KPMCORE_FSFEATURE_H +#define KPMCORE_FSFEATURE_H + +#include "util/libpartitionmanagerexport.h" + +#include + +#include + +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 d; +}; + +#endif diff --git a/src/fs/filesystem.cpp b/src/fs/filesystem.cpp index 548330b..8b795f0 100644 --- a/src/fs/filesystem.cpp +++ b/src/fs/filesystem.cpp @@ -84,6 +84,8 @@ struct FileSystemPrivate { qint64 m_SectorsUsed; QString m_Label; QString m_UUID; + QList m_AvailableFeatures; + QList 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& features, FileSystem::Type type) : + d(std::make_unique()) +{ + 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& 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& FileSystem::availableFeatures() const +{ + return d->m_AvailableFeatures; +} + +const QList& FileSystem::features() const +{ + return d->m_Features; +} + qint64 FileSystem::sectorSize() const { return d->m_SectorSize; diff --git a/src/fs/filesystem.h b/src/fs/filesystem.h index 052a391..8d1d05f 100644 --- a/src/fs/filesystem.h +++ b/src/fs/filesystem.h @@ -20,8 +20,11 @@ #ifndef KPMCORE_FILESYSTEM_H #define KPMCORE_FILESYSTEM_H + #include "util/libpartitionmanagerexport.h" +#include "fs/feature.h" + #include #include #include @@ -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& 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& availableFeatures() const; + + /**< @return the FileSystem's features */ + const QList& 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& 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 d; }; diff --git a/src/fs/filesystemfactory.cpp b/src/fs/filesystemfactory.cpp index 8f67cf4..597f412 100644 --- a/src/fs/filesystemfactory.cpp +++ b/src/fs/filesystemfactory.cpp @@ -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& 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()); } diff --git a/src/fs/filesystemfactory.h b/src/fs/filesystemfactory.h index 6679bbc..9385328 100644 --- a/src/fs/filesystemfactory.h +++ b/src/fs/filesystemfactory.h @@ -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& features = {}, const QString& uuid = QString()); static FileSystem* create(const FileSystem& other); static FileSystem* cloneWithNewType(FileSystem::Type newType, const FileSystem& other); static const FileSystems& map(); diff --git a/src/fs/hfs.cpp b/src/fs/hfs.cpp index db89025..5505e50 100644 --- a/src/fs/hfs.cpp +++ b/src/fs/hfs.cpp @@ -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& features) : + FileSystem(firstsector, lastsector, sectorsused, label, features, FileSystem::Type::Hfs) { } diff --git a/src/fs/hfs.h b/src/fs/hfs.h index 780dc72..4456d0c 100644 --- a/src/fs/hfs.h +++ b/src/fs/hfs.h @@ -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& features = {}); public: void init() override; diff --git a/src/fs/hfsplus.cpp b/src/fs/hfsplus.cpp index 80a6553..6e6b02b 100644 --- a/src/fs/hfsplus.cpp +++ b/src/fs/hfsplus.cpp @@ -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& features) : + FileSystem(firstsector, lastsector, sectorsused, label, features, FileSystem::Type::HfsPlus) { } diff --git a/src/fs/hfsplus.h b/src/fs/hfsplus.h index 8f3e2d4..ed2efa1 100644 --- a/src/fs/hfsplus.h +++ b/src/fs/hfsplus.h @@ -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& features = {}); public: void init() override; diff --git a/src/fs/hpfs.cpp b/src/fs/hpfs.cpp index 55c41a1..37e5638 100644 --- a/src/fs/hpfs.cpp +++ b/src/fs/hpfs.cpp @@ -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& features) : + FileSystem(firstsector, lastsector, sectorsused, label, features, FileSystem::Type::Hpfs) { } diff --git a/src/fs/hpfs.h b/src/fs/hpfs.h index 7bbb9ba..8c7c3d6 100644 --- a/src/fs/hpfs.h +++ b/src/fs/hpfs.h @@ -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& features = {}); public: CommandSupportType supportGetUsed() const override { diff --git a/src/fs/iso9660.cpp b/src/fs/iso9660.cpp index d7939a9..b45e6ee 100644 --- a/src/fs/iso9660.cpp +++ b/src/fs/iso9660.cpp @@ -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& features) : + FileSystem(firstsector, lastsector, sectorsused, label, features, FileSystem::Type::Iso9660) { } diff --git a/src/fs/iso9660.h b/src/fs/iso9660.h index f6b2192..1316831 100644 --- a/src/fs/iso9660.h +++ b/src/fs/iso9660.h @@ -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& features = {}); }; diff --git a/src/fs/jfs.cpp b/src/fs/jfs.cpp index dfb90a0..33befe6 100644 --- a/src/fs/jfs.cpp +++ b/src/fs/jfs.cpp @@ -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& features) : + FileSystem(firstsector, lastsector, sectorsused, label, features, FileSystem::Type::Jfs) { } diff --git a/src/fs/jfs.h b/src/fs/jfs.h index c67ab27..4e11630 100644 --- a/src/fs/jfs.h +++ b/src/fs/jfs.h @@ -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& features = {}); public: void init() override; diff --git a/src/fs/linuxraidmember.cpp b/src/fs/linuxraidmember.cpp index 19b4825..9d1d389 100644 --- a/src/fs/linuxraidmember.cpp +++ b/src/fs/linuxraidmember.cpp @@ -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& features) : + FileSystem(firstsector, lastsector, sectorsused, label, features, FileSystem::Type::LinuxRaidMember) { } diff --git a/src/fs/linuxraidmember.h b/src/fs/linuxraidmember.h index aa71cdd..7bdfbff 100644 --- a/src/fs/linuxraidmember.h +++ b/src/fs/linuxraidmember.h @@ -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& features = {}); }; } diff --git a/src/fs/linuxswap.cpp b/src/fs/linuxswap.cpp index 376a883..c4e91d5 100644 --- a/src/fs/linuxswap.cpp +++ b/src/fs/linuxswap.cpp @@ -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& features) : + FileSystem(firstsector, lastsector, sectorsused, label, features, FileSystem::Type::LinuxSwap) { } diff --git a/src/fs/linuxswap.h b/src/fs/linuxswap.h index d36392b..fd43bf1 100644 --- a/src/fs/linuxswap.h +++ b/src/fs/linuxswap.h @@ -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& features = {}); public: void init() override; diff --git a/src/fs/luks.cpp b/src/fs/luks.cpp index dcc7cdb..f6face5 100644 --- a/src/fs/luks.cpp +++ b/src/fs/luks.cpp @@ -63,8 +63,9 @@ luks::luks(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label, + const QList& 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) diff --git a/src/fs/luks.h b/src/fs/luks.h index 7dddba1..dabee44 100644 --- a/src/fs/luks.h +++ b/src/fs/luks.h @@ -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& features = {}, FileSystem::Type t = FileSystem::Type::Luks); ~luks() override; enum class KeyLocation { diff --git a/src/fs/luks2.cpp b/src/fs/luks2.cpp index a315da0..372c875 100644 --- a/src/fs/luks2.cpp +++ b/src/fs/luks2.cpp @@ -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& features) + : luks(firstsector, lastsector, sectorsused, label, features, FileSystem::Type::Luks2) { } diff --git a/src/fs/luks2.h b/src/fs/luks2.h index cb014f8..eebbc9a 100644 --- a/src/fs/luks2.h +++ b/src/fs/luks2.h @@ -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& features = {}); ~luks2() override; bool create(Report& report, const QString& deviceNode) override; diff --git a/src/fs/lvm2_pv.cpp b/src/fs/lvm2_pv.cpp index 7bac15a..3c1de3b 100644 --- a/src/fs/lvm2_pv.cpp +++ b/src/fs/lvm2_pv.cpp @@ -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& features) + : FileSystem(firstsector, lastsector, sectorsused, label, features, FileSystem::Type::Lvm2_PV) , m_PESize(0) , m_TotalPE(0) , m_AllocatedPE(0) diff --git a/src/fs/lvm2_pv.h b/src/fs/lvm2_pv.h index 15bbd92..a12d9d1 100644 --- a/src/fs/lvm2_pv.h +++ b/src/fs/lvm2_pv.h @@ -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& features = {}); public: void init() override; diff --git a/src/fs/minix.cpp b/src/fs/minix.cpp index cbd4038..4229361 100644 --- a/src/fs/minix.cpp +++ b/src/fs/minix.cpp @@ -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& features) : + FileSystem(firstsector, lastsector, sectorsused, label, features, FileSystem::Type::Minix) { } diff --git a/src/fs/minix.h b/src/fs/minix.h index 2d7b6ee..7ad9eb8 100644 --- a/src/fs/minix.h +++ b/src/fs/minix.h @@ -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& features = {}); + void init() override; bool check(Report& report, const QString&deviceNode) const override; diff --git a/src/fs/nilfs2.cpp b/src/fs/nilfs2.cpp index 87ceef7..fb0cd0b 100644 --- a/src/fs/nilfs2.cpp +++ b/src/fs/nilfs2.cpp @@ -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& features) : + FileSystem(firstsector, lastsector, sectorsused, label, features, FileSystem::Type::Nilfs2) { } diff --git a/src/fs/nilfs2.h b/src/fs/nilfs2.h index 9432208..97556be 100644 --- a/src/fs/nilfs2.h +++ b/src/fs/nilfs2.h @@ -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& features = {}); public: void init() override; diff --git a/src/fs/ntfs.cpp b/src/fs/ntfs.cpp index ee23322..9a6e359 100644 --- a/src/fs/ntfs.cpp +++ b/src/fs/ntfs.cpp @@ -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& features) : + FileSystem(firstsector, lastsector, sectorsused, label, features, FileSystem::Type::Ntfs) { } diff --git a/src/fs/ntfs.h b/src/fs/ntfs.h index c1d409e..989f1aa 100644 --- a/src/fs/ntfs.h +++ b/src/fs/ntfs.h @@ -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& features = {}); public: void init() override; diff --git a/src/fs/ocfs2.cpp b/src/fs/ocfs2.cpp index 0091ce1..daac42e 100644 --- a/src/fs/ocfs2.cpp +++ b/src/fs/ocfs2.cpp @@ -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& features) : + FileSystem(firstsector, lastsector, sectorsused, label, features, FileSystem::Type::Ocfs2) { } diff --git a/src/fs/ocfs2.h b/src/fs/ocfs2.h index 1a86172..873513f 100644 --- a/src/fs/ocfs2.h +++ b/src/fs/ocfs2.h @@ -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& features = {}); public: void init() override; diff --git a/src/fs/reiser4.cpp b/src/fs/reiser4.cpp index 5d25bd3..520afa2 100644 --- a/src/fs/reiser4.cpp +++ b/src/fs/reiser4.cpp @@ -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& features) : + FileSystem(firstsector, lastsector, sectorsused, label, features, FileSystem::Type::Reiser4) { } diff --git a/src/fs/reiser4.h b/src/fs/reiser4.h index 34f4a13..7084a6f 100644 --- a/src/fs/reiser4.h +++ b/src/fs/reiser4.h @@ -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& features = {}); public: void init() override; diff --git a/src/fs/reiserfs.cpp b/src/fs/reiserfs.cpp index 5df1a65..e8bae7b 100644 --- a/src/fs/reiserfs.cpp +++ b/src/fs/reiserfs.cpp @@ -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& features) : + FileSystem(firstsector, lastsector, sectorsused, label, features, FileSystem::Type::ReiserFS) { } diff --git a/src/fs/reiserfs.h b/src/fs/reiserfs.h index 598c4d2..68ae7c6 100644 --- a/src/fs/reiserfs.h +++ b/src/fs/reiserfs.h @@ -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& features = {}); public: void init() override; diff --git a/src/fs/udf.cpp b/src/fs/udf.cpp index b0d28a9..935cd82 100644 --- a/src/fs/udf.cpp +++ b/src/fs/udf.cpp @@ -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& features) : + FileSystem(firstsector, lastsector, sectorsused, label, features, FileSystem::Type::Udf) { } diff --git a/src/fs/udf.h b/src/fs/udf.h index f49df36..ce84283 100644 --- a/src/fs/udf.h +++ b/src/fs/udf.h @@ -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& features = {}); public: void init() override; diff --git a/src/fs/ufs.cpp b/src/fs/ufs.cpp index 71f5e51..72989a9 100644 --- a/src/fs/ufs.cpp +++ b/src/fs/ufs.cpp @@ -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& features) : + FileSystem(firstsector, lastsector, sectorsused, label, features, FileSystem::Type::Ufs) { } } diff --git a/src/fs/ufs.h b/src/fs/ufs.h index 2c67f92..44814a3 100644 --- a/src/fs/ufs.h +++ b/src/fs/ufs.h @@ -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& features = {}); public: CommandSupportType supportMove() const override { diff --git a/src/fs/unformatted.cpp b/src/fs/unformatted.cpp index e1813de..2928fcc 100644 --- a/src/fs/unformatted.cpp +++ b/src/fs/unformatted.cpp @@ -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& features) : + FileSystem(firstsector, lastsector, sectorsused, label, features, FileSystem::Type::Unformatted) { } diff --git a/src/fs/unformatted.h b/src/fs/unformatted.h index 8c66407..bd65a68 100644 --- a/src/fs/unformatted.h +++ b/src/fs/unformatted.h @@ -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& features = {}); public: bool create(Report&, const QString&) override; diff --git a/src/fs/unknown.cpp b/src/fs/unknown.cpp index 173d596..6bd9154 100644 --- a/src/fs/unknown.cpp +++ b/src/fs/unknown.cpp @@ -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& features) : + FileSystem(firstsector, lastsector, sectorsused, label, features, FileSystem::Type::Unknown) { } diff --git a/src/fs/unknown.h b/src/fs/unknown.h index cf87ca4..4111172 100644 --- a/src/fs/unknown.h +++ b/src/fs/unknown.h @@ -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& features = {}); public: bool supportToolFound() const override { diff --git a/src/fs/xfs.cpp b/src/fs/xfs.cpp index 734a418..bf29beb 100644 --- a/src/fs/xfs.cpp +++ b/src/fs/xfs.cpp @@ -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& features) : + FileSystem(firstsector, lastsector, sectorsused, label, features, FileSystem::Type::Xfs) { } diff --git a/src/fs/xfs.h b/src/fs/xfs.h index 3199c93..a7c6f75 100644 --- a/src/fs/xfs.h +++ b/src/fs/xfs.h @@ -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& features = {}); public: void init() override; diff --git a/src/fs/zfs.cpp b/src/fs/zfs.cpp index c237da4..2596746 100644 --- a/src/fs/zfs.cpp +++ b/src/fs/zfs.cpp @@ -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& features) : + FileSystem(firstsector, lastsector, sectorsused, label, features, FileSystem::Type::Zfs) { } diff --git a/src/fs/zfs.h b/src/fs/zfs.h index c87f971..8fa944a 100644 --- a/src/fs/zfs.h +++ b/src/fs/zfs.h @@ -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& features = {}); public: void init() override; diff --git a/src/jobs/createfilesystemjob.cpp b/src/jobs/createfilesystemjob.cpp index 6a285d2..2ce2eee 100644 --- a/src/jobs/createfilesystemjob.cpp +++ b/src/jobs/createfilesystemjob.cpp @@ -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 backendDevice = CoreBackendManager::self()->backend()->openDevice(device());