Explicitely specify the scope of enum.

This commit is contained in:
Andrius Štikonas 2018-04-07 19:54:30 +01:00
parent 876c037ebf
commit 17c8772240
46 changed files with 214 additions and 216 deletions

View File

@ -129,7 +129,7 @@ Partition* LvmDevice::scanPartition(const QString& lvPath, PartitionTable* pTabl
bool mounted;
// Handle LUKS partition
if (fs->type() == FileSystem::Luks) {
if (fs->type() == FileSystem::Type::Luks) {
r |= PartitionRole::Luks;
FS::luks* luksFs = static_cast<FS::luks*>(fs);
luksFs->initLUKS();
@ -141,9 +141,9 @@ Partition* LvmDevice::scanPartition(const QString& lvPath, PartitionTable* pTabl
mountPoint = FileSystem::detectMountPoint(fs, lvPath);
mounted = FileSystem::detectMountStatus(fs, lvPath);
if (mountPoint != QString() && fs->type() != FileSystem::LinuxSwap) {
if (mountPoint != QString() && fs->type() != FileSystem::Type::LinuxSwap) {
const QStorageInfo storage = QStorageInfo(mountPoint);
if (logicalSize() > 0 && fs->type() != FileSystem::Luks && mounted && storage.isValid())
if (logicalSize() > 0 && fs->type() != FileSystem::Type::Luks && mounted && storage.isValid())
fs->setSectorsUsed( (storage.bytesTotal() - storage.bytesFree()) / logicalSize() );
}
else if (fs->supportGetUsed() == FileSystem::cmdSupportFileSystem)

View File

@ -325,7 +325,7 @@ Partition* createUnallocated(const Device& device, PartitionNode& parent, qint64
if (!PartitionTable::getUnallocatedRange(device, parent, start, end))
return nullptr;
return new Partition(&parent, device, PartitionRole(r), FileSystemFactory::create(FileSystem::Unknown, start, end, device.logicalSize()), start, end, QString());
return new Partition(&parent, device, PartitionRole(r), FileSystemFactory::create(FileSystem::Type::Unknown, start, end, device.logicalSize()), start, end, QString());
}
/** Removes all unallocated children from a PartitionNode

View File

@ -39,7 +39,7 @@ 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::Exfat)
FileSystem(firstsector, lastsector, sectorsused, label, FileSystem::Type::Exfat)
{
}

View File

@ -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::Ext2);
ext2(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label, FileSystem::Type t = FileSystem::Type::Ext2);
public:
void init() override;

View File

@ -25,7 +25,7 @@
namespace FS
{
ext3::ext3(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label) :
ext2(firstsector, lastsector, sectorsused, label, FileSystem::Ext3)
ext2(firstsector, lastsector, sectorsused, label, FileSystem::Type::Ext3)
{
}

View File

@ -25,7 +25,7 @@
namespace FS
{
ext4::ext4(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label) :
ext2(firstsector, lastsector, sectorsused, label, FileSystem::Ext4)
ext2(firstsector, lastsector, sectorsused, label, FileSystem::Type::Ext4)
{
}

View File

@ -25,7 +25,7 @@ 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::Extended)
FileSystem(firstsector, lastsector, sectorsused, label, FileSystem::Type::Extended)
{
}

View File

@ -46,7 +46,7 @@ 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::F2fs)
FileSystem(firstsector, lastsector, sectorsused, label, FileSystem::Type::F2fs)
{
}

View File

@ -38,7 +38,7 @@ namespace FS
class LIBKPMCORE_EXPORT fat12 : public FileSystem
{
public:
fat12(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label, FileSystem::Type t = FileSystem::Fat12);
fat12(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label, FileSystem::Type t = FileSystem::Type::Fat12);
public:
void init() override;

View File

@ -33,7 +33,7 @@
namespace FS
{
fat16::fat16(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label) :
fat12(firstsector, lastsector, sectorsused, label, FileSystem::Fat16)
fat12(firstsector, lastsector, sectorsused, label, FileSystem::Type::Fat16)
{
}

View File

@ -26,7 +26,7 @@
namespace FS
{
fat32::fat32(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label) :
fat16(firstsector, lastsector, sectorsused, label, FileSystem::Fat32)
fat16(firstsector, lastsector, sectorsused, label, FileSystem::Type::Fat32)
{
}

View File

@ -108,7 +108,7 @@ FileSystem::Type FileSystem::detectFileSystem(const QString& partitionPath)
QString FileSystem::detectMountPoint(FileSystem* fs, const QString& partitionPath)
{
if (fs->type() == FileSystem::Lvm2_PV)
if (fs->type() == FileSystem::Type::Lvm2_PV)
return FS::lvm2_pv::getVGName(partitionPath);
if (partitionPath.isEmpty()) // Happens when during initial scan LUKS is closed
@ -133,7 +133,7 @@ bool FileSystem::detectMountStatus(FileSystem* fs, const QString& partitionPath)
{
bool mounted = false;
if (fs->type() == FileSystem::Lvm2_PV) {
if (fs->type() == FileSystem::Type::Lvm2_PV) {
mounted = FS::lvm2_pv::getVGName(partitionPath) != QString();
} else {
mounted = isMounted(partitionPath);
@ -437,10 +437,9 @@ static const KLocalizedString* typeNames()
*/
QString FileSystem::nameForType(FileSystem::Type t, const QStringList& languages)
{
Q_ASSERT(t >= 0);
Q_ASSERT(t < __lastType);
Q_ASSERT(t < Type::__lastType);
return typeNames()[t].toString(languages);
return typeNames()[static_cast<int>(t)].toString(languages);
}
/** @param s the name to get the type for
@ -448,11 +447,11 @@ QString FileSystem::nameForType(FileSystem::Type t, const QStringList& languages
*/
FileSystem::Type FileSystem::typeForName(const QString& s, const QStringList& languages )
{
for (quint32 i = 0; i < __lastType; i++)
for (quint32 i = 0; i < static_cast<int>(Type::__lastType); i++)
if (typeNames()[i].toString(languages) == s)
return static_cast<FileSystem::Type>(i);
return Unknown;
return Type::Unknown;
}
/** @return a QList of all known types */
@ -460,8 +459,8 @@ QList<FileSystem::Type> FileSystem::types()
{
QList<FileSystem::Type> result;
int i = Ext2; // first "real" filesystem
while (i != __lastType)
int i = static_cast<int>(Type::Ext2); // first "real" filesystem
while (i != static_cast<int>(Type::__lastType))
result.append(static_cast<FileSystem::Type>(i++));
return result;

View File

@ -1,7 +1,7 @@
/*************************************************************************
* Copyright (C) 2012 by Volker Lanz <vl@fidra.de> *
* Copyright (C) 2015 by Teo Mrnjavac <teo@kde.org> *
* Copyright (C) 2016 by Andrius Štikonas <andrius@stikonas.eu> *
* Copyright (C) 2016-2018 by Andrius Štikonas <andrius@stikonas.eu> *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
@ -17,7 +17,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.*
*************************************************************************/
#if !defined(KPMCORE_FILESYSTEM_H)
#ifndef KPMCORE_FILESYSTEM_H
#define KPMCORE_FILESYSTEM_H
#include "util/libpartitionmanagerexport.h"
@ -58,39 +58,39 @@ public:
/** Supported FileSystem types */
enum Type : int {
Unknown = 0,
Extended = 1,
Unknown,
Extended,
Ext2 = 2,
Ext3 = 3,
Ext4 = 4,
LinuxSwap = 5,
Fat16 = 6,
Fat32 = 7,
Ntfs = 8,
ReiserFS = 9,
Reiser4 = 10,
Xfs = 11,
Jfs = 12,
Hfs = 13,
HfsPlus = 14,
Ufs = 15,
Unformatted = 16,
Btrfs = 17,
Hpfs = 18,
Luks = 19,
Ocfs2 = 20,
Zfs = 21,
Exfat = 22,
Nilfs2 = 23,
Lvm2_PV = 24,
F2fs = 25,
Udf = 26,
Iso9660 = 27,
Luks2 = 28,
Fat12 = 29,
Ext2,
Ext3,
Ext4,
LinuxSwap,
Fat16,
Fat32,
Ntfs,
ReiserFS,
Reiser4,
Xfs,
Jfs,
Hfs,
HfsPlus,
Ufs,
Unformatted,
Btrfs,
Hpfs,
Luks,
Ocfs2,
Zfs,
Exfat,
Nilfs2,
Lvm2_PV,
F2fs,
Udf,
Iso9660,
Luks2,
Fat12,
__lastType = 30
__lastType
};
/** The type of support for a given FileSystem action */

View File

@ -61,36 +61,36 @@ void FileSystemFactory::init()
qDeleteAll(m_FileSystems);
m_FileSystems.clear();
m_FileSystems.insert(FileSystem::Btrfs, new FS::btrfs(-1, -1, -1, QString()));
m_FileSystems.insert(FileSystem::Exfat, new FS::exfat(-1, -1, -1, QString()));
m_FileSystems.insert(FileSystem::Ext2, new FS::ext2(-1, -1, -1, QString()));
m_FileSystems.insert(FileSystem::Ext3, new FS::ext3(-1, -1, -1, QString()));
m_FileSystems.insert(FileSystem::Ext4, new FS::ext4(-1, -1, -1, QString()));
m_FileSystems.insert(FileSystem::Extended, new FS::extended(-1, -1, -1, QString()));
m_FileSystems.insert(FileSystem::F2fs, new FS::f2fs(-1, -1, -1, QString()));
m_FileSystems.insert(FileSystem::Fat12, new FS::fat12(-1, -1, -1, QString()));
m_FileSystems.insert(FileSystem::Fat16, new FS::fat16(-1, -1, -1, QString()));
m_FileSystems.insert(FileSystem::Fat32, new FS::fat32(-1, -1, -1, QString()));
m_FileSystems.insert(FileSystem::Hfs, new FS::hfs(-1, -1, -1, QString()));
m_FileSystems.insert(FileSystem::HfsPlus, new FS::hfsplus(-1, -1, -1, QString()));
m_FileSystems.insert(FileSystem::Hpfs, new FS::hpfs(-1, -1, -1, QString()));
m_FileSystems.insert(FileSystem::Iso9660, new FS::iso9660(-1, -1, -1, QString()));
m_FileSystems.insert(FileSystem::Jfs, new FS::jfs(-1, -1, -1, QString()));
m_FileSystems.insert(FileSystem::LinuxSwap, new FS::linuxswap(-1, -1, -1, QString()));
m_FileSystems.insert(FileSystem::Luks, new FS::luks(-1, -1, -1, QString()));
m_FileSystems.insert(FileSystem::Luks2, new FS::luks2(-1, -1, -1, QString()));
m_FileSystems.insert(FileSystem::Lvm2_PV, new FS::lvm2_pv(-1, -1, -1, QString()));
m_FileSystems.insert(FileSystem::Nilfs2, new FS::nilfs2(-1, -1, -1, QString()));
m_FileSystems.insert(FileSystem::Ntfs, new FS::ntfs(-1, -1, -1, QString()));
m_FileSystems.insert(FileSystem::Ocfs2, new FS::ocfs2(-1, -1, -1, QString()));
m_FileSystems.insert(FileSystem::ReiserFS, new FS::reiserfs(-1, -1, -1, QString()));
m_FileSystems.insert(FileSystem::Reiser4, new FS::reiser4(-1, -1, -1, QString()));
m_FileSystems.insert(FileSystem::Udf, new FS::udf(-1, -1, -1, QString()));
m_FileSystems.insert(FileSystem::Ufs, new FS::ufs(-1, -1, -1, QString()));
m_FileSystems.insert(FileSystem::Unformatted, new FS::unformatted(-1, -1, -1, QString()));
m_FileSystems.insert(FileSystem::Unknown, new FS::unknown(-1, -1, -1, QString()));
m_FileSystems.insert(FileSystem::Xfs, new FS::xfs(-1, -1, -1, QString()));
m_FileSystems.insert(FileSystem::Zfs, new FS::zfs(-1, -1, -1, QString()));
m_FileSystems.insert(FileSystem::Type::Btrfs, new FS::btrfs(-1, -1, -1, QString()));
m_FileSystems.insert(FileSystem::Type::Exfat, new FS::exfat(-1, -1, -1, QString()));
m_FileSystems.insert(FileSystem::Type::Ext2, new FS::ext2(-1, -1, -1, QString()));
m_FileSystems.insert(FileSystem::Type::Ext3, new FS::ext3(-1, -1, -1, QString()));
m_FileSystems.insert(FileSystem::Type::Ext4, new FS::ext4(-1, -1, -1, QString()));
m_FileSystems.insert(FileSystem::Type::Extended, new FS::extended(-1, -1, -1, QString()));
m_FileSystems.insert(FileSystem::Type::F2fs, new FS::f2fs(-1, -1, -1, QString()));
m_FileSystems.insert(FileSystem::Type::Fat12, new FS::fat12(-1, -1, -1, QString()));
m_FileSystems.insert(FileSystem::Type::Fat16, new FS::fat16(-1, -1, -1, QString()));
m_FileSystems.insert(FileSystem::Type::Fat32, new FS::fat32(-1, -1, -1, QString()));
m_FileSystems.insert(FileSystem::Type::Hfs, new FS::hfs(-1, -1, -1, QString()));
m_FileSystems.insert(FileSystem::Type::HfsPlus, new FS::hfsplus(-1, -1, -1, QString()));
m_FileSystems.insert(FileSystem::Type::Hpfs, new FS::hpfs(-1, -1, -1, QString()));
m_FileSystems.insert(FileSystem::Type::Iso9660, new FS::iso9660(-1, -1, -1, QString()));
m_FileSystems.insert(FileSystem::Type::Jfs, new FS::jfs(-1, -1, -1, QString()));
m_FileSystems.insert(FileSystem::Type::LinuxSwap, new FS::linuxswap(-1, -1, -1, QString()));
m_FileSystems.insert(FileSystem::Type::Luks, new FS::luks(-1, -1, -1, QString()));
m_FileSystems.insert(FileSystem::Type::Luks2, new FS::luks2(-1, -1, -1, QString()));
m_FileSystems.insert(FileSystem::Type::Lvm2_PV, new FS::lvm2_pv(-1, -1, -1, QString()));
m_FileSystems.insert(FileSystem::Type::Nilfs2, new FS::nilfs2(-1, -1, -1, QString()));
m_FileSystems.insert(FileSystem::Type::Ntfs, new FS::ntfs(-1, -1, -1, QString()));
m_FileSystems.insert(FileSystem::Type::Ocfs2, new FS::ocfs2(-1, -1, -1, QString()));
m_FileSystems.insert(FileSystem::Type::ReiserFS, new FS::reiserfs(-1, -1, -1, QString()));
m_FileSystems.insert(FileSystem::Type::Reiser4, new FS::reiser4(-1, -1, -1, QString()));
m_FileSystems.insert(FileSystem::Type::Udf, new FS::udf(-1, -1, -1, QString()));
m_FileSystems.insert(FileSystem::Type::Ufs, new FS::ufs(-1, -1, -1, QString()));
m_FileSystems.insert(FileSystem::Type::Unformatted, new FS::unformatted(-1, -1, -1, QString()));
m_FileSystems.insert(FileSystem::Type::Unknown, new FS::unknown(-1, -1, -1, QString()));
m_FileSystems.insert(FileSystem::Type::Xfs, new FS::xfs(-1, -1, -1, QString()));
m_FileSystems.insert(FileSystem::Type::Zfs, new FS::zfs(-1, -1, -1, QString()));
for (const auto &fs : FileSystemFactory::map())
fs->init();
@ -111,36 +111,36 @@ FileSystem* FileSystemFactory::create(FileSystem::Type t, qint64 firstsector, qi
FileSystem* fs = nullptr;
switch (t) {
case FileSystem::Btrfs: fs = new FS::btrfs(firstsector, lastsector, sectorsused, label); break;
case FileSystem::Exfat: fs = new FS::exfat(firstsector, lastsector, sectorsused, label); break;
case FileSystem::Ext2: fs = new FS::ext2(firstsector, lastsector, sectorsused, label); break;
case FileSystem::Ext3: fs = new FS::ext3(firstsector, lastsector, sectorsused, label); break;
case FileSystem::Ext4: fs = new FS::ext4(firstsector, lastsector, sectorsused, label); break;
case FileSystem::Extended: fs = new FS::extended(firstsector, lastsector, sectorsused, label); break;
case FileSystem::F2fs: fs = new FS::f2fs(firstsector, lastsector, sectorsused, label); break;
case FileSystem::Fat12: fs = new FS::fat12(firstsector, lastsector, sectorsused, label); break;
case FileSystem::Fat16: fs = new FS::fat16(firstsector, lastsector, sectorsused, label); break;
case FileSystem::Fat32: fs = new FS::fat32(firstsector, lastsector, sectorsused, label); break;
case FileSystem::Hfs: fs = new FS::hfs(firstsector, lastsector, sectorsused, label); break;
case FileSystem::HfsPlus: fs = new FS::hfsplus(firstsector, lastsector, sectorsused, label); break;
case FileSystem::Hpfs: fs = new FS::hpfs(firstsector, lastsector, sectorsused, label); break;
case FileSystem::Iso9660: fs = new FS::iso9660(firstsector, lastsector, sectorsused, label); break;
case FileSystem::Jfs: fs = new FS::jfs(firstsector, lastsector, sectorsused, label); break;
case FileSystem::LinuxSwap: fs = new FS::linuxswap(firstsector, lastsector, sectorsused, label); break;
case FileSystem::Luks: fs = new FS::luks(firstsector, lastsector, sectorsused, label); break;
case FileSystem::Luks2: fs = new FS::luks2(firstsector, lastsector, sectorsused, label); break;
case FileSystem::Lvm2_PV: fs = new FS::lvm2_pv(firstsector, lastsector, sectorsused, label); break;
case FileSystem::Nilfs2: fs = new FS::nilfs2(firstsector, lastsector, sectorsused, label); break;
case FileSystem::Ntfs: fs = new FS::ntfs(firstsector, lastsector, sectorsused, label); break;
case FileSystem::Ocfs2: fs = new FS::ocfs2(firstsector, lastsector, sectorsused, label); break;
case FileSystem::ReiserFS: fs = new FS::reiserfs(firstsector, lastsector, sectorsused, label); break;
case FileSystem::Reiser4: fs = new FS::reiser4(firstsector, lastsector, sectorsused, label); break;
case FileSystem::Udf: fs = new FS::udf(firstsector, lastsector, sectorsused, label); break;
case FileSystem::Ufs: fs = new FS::ufs(firstsector, lastsector, sectorsused, label); break;
case FileSystem::Unformatted: fs = new FS::unformatted(firstsector, lastsector, sectorsused, label); break;
case FileSystem::Unknown: fs = new FS::unknown(firstsector, lastsector, sectorsused, label); break;
case FileSystem::Xfs: fs = new FS::xfs(firstsector, lastsector, sectorsused, label); break;
case FileSystem::Zfs: fs = new FS::zfs(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::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::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;
default: break;
}

View File

@ -15,8 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.*
*************************************************************************/
#if !defined(KPMCORE_FILESYSTEMFACTORY_H)
#ifndef KPMCORE_FILESYSTEMFACTORY_H
#define KPMCORE_FILESYSTEMFACTORY_H
#include "fs/filesystem.h"

View File

@ -35,7 +35,7 @@ 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::Hfs)
FileSystem(firstsector, lastsector, sectorsused, label, FileSystem::Type::Hfs)
{
}

View File

@ -35,7 +35,7 @@ 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::HfsPlus)
FileSystem(firstsector, lastsector, sectorsused, label, FileSystem::Type::HfsPlus)
{
}

View File

@ -37,7 +37,7 @@ 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::Hpfs)
FileSystem(firstsector, lastsector, sectorsused, label, FileSystem::Type::Hpfs)
{
}

View File

@ -21,7 +21,7 @@ namespace FS
{
iso9660::iso9660(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label) :
FileSystem(firstsector, lastsector, sectorsused, label, FileSystem::Iso9660)
FileSystem(firstsector, lastsector, sectorsused, label, FileSystem::Type::Iso9660)
{
}

View File

@ -40,7 +40,7 @@ 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::Jfs)
FileSystem(firstsector, lastsector, sectorsused, label, FileSystem::Type::Jfs)
{
}

View File

@ -40,7 +40,7 @@ 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::LinuxSwap)
FileSystem(firstsector, lastsector, sectorsused, label, FileSystem::Type::LinuxSwap)
{
}

View File

@ -288,7 +288,7 @@ bool luks::cryptOpen(QWidget* parent, const QString& deviceNode)
return false;
for (auto &p : LVM::pvList)
if (p.isLuks() && p.partition()->deviceNode() == deviceNode && p.partition()->fileSystem().type() == FileSystem::Lvm2_PV)
if (p.isLuks() && p.partition()->deviceNode() == deviceNode && p.partition()->fileSystem().type() == FileSystem::Type::Lvm2_PV)
p.setLuks(false);
m_passphrase = passphrase;
@ -465,7 +465,7 @@ FileSystem::Type luks::type() const
{
if (m_isCryptOpen && m_innerFs)
return m_innerFs->type();
return FileSystem::Luks;
return FileSystem::Type::Luks;
}
QString luks::suggestedMapperName(const QString& deviceNode) const
@ -648,19 +648,19 @@ bool luks::canEncryptType(FileSystem::Type type)
{
switch (type)
{
case Btrfs:
case F2fs:
case Ext2:
case Ext3:
case Ext4:
case Jfs:
case LinuxSwap:
case Lvm2_PV:
case Nilfs2:
case ReiserFS:
case Reiser4:
case Xfs:
case Zfs:
case Type::Btrfs:
case Type::F2fs:
case Type::Ext2:
case Type::Ext3:
case Type::Ext4:
case Type::Jfs:
case Type::LinuxSwap:
case Type::Lvm2_PV:
case Type::Nilfs2:
case Type::ReiserFS:
case Type::Reiser4:
case Type::Xfs:
case Type::Zfs:
return true;
default:
return false;

View File

@ -40,7 +40,7 @@ namespace FS
class LIBKPMCORE_EXPORT luks : public FileSystem
{
public:
luks(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label, FileSystem::Type t = FileSystem::Luks);
luks(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label, FileSystem::Type t = FileSystem::Type::Luks);
~luks() override;
enum KeyLocation {

View File

@ -28,7 +28,7 @@ namespace FS
{
luks2::luks2(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label)
: luks(firstsector, lastsector, sectorsused, label, FileSystem::Luks2)
: luks(firstsector, lastsector, sectorsused, label, FileSystem::Type::Luks2)
{
}
@ -40,7 +40,7 @@ FileSystem::Type luks2::type() const
{
if (m_isCryptOpen && m_innerFs)
return m_innerFs->type();
return FileSystem::Luks2;
return FileSystem::Type::Luks2;
}
bool luks2::create(Report& report, const QString& deviceNode)

View File

@ -43,7 +43,7 @@ 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::Lvm2_PV)
: FileSystem(firstsector, lastsector, sectorsused, label, FileSystem::Type::Lvm2_PV)
, m_PESize(0)
, m_TotalPE(0)
, m_AllocatedPE(0)
@ -270,10 +270,10 @@ QList<LvmPV> lvm2_pv::getPVinNode(const PartitionNode* parent)
partitions.append(getPVinNode(node));
// FIXME: reenable newly created PVs (before applying) once everything works
if(p->fileSystem().type() == FileSystem::Lvm2_PV && p->deviceNode() == p->partitionPath())
if(p->fileSystem().type() == FileSystem::Type::Lvm2_PV && p->deviceNode() == p->partitionPath())
partitions.append(LvmPV(p->mountPoint(), p));
if(p->fileSystem().type() == FileSystem::Luks && p->deviceNode() == p->partitionPath())
if(p->fileSystem().type() == FileSystem::Type::Luks && p->deviceNode() == p->partitionPath())
partitions.append(LvmPV(p->mountPoint(), p, true));
}

View File

@ -47,7 +47,7 @@ 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::Nilfs2)
FileSystem(firstsector, lastsector, sectorsused, label, FileSystem::Type::Nilfs2)
{
}

View File

@ -50,7 +50,7 @@ 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::Ntfs)
FileSystem(firstsector, lastsector, sectorsused, label, FileSystem::Type::Ntfs)
{
}

View File

@ -40,7 +40,7 @@ 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::Ocfs2)
FileSystem(firstsector, lastsector, sectorsused, label, FileSystem::Type::Ocfs2)
{
}

View File

@ -35,7 +35,7 @@ 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::Reiser4)
FileSystem(firstsector, lastsector, sectorsused, label, FileSystem::Type::Reiser4)
{
}

View File

@ -42,7 +42,7 @@ FileSystem::CommandSupportType reiserfs::m_UpdateUUID = FileSystem::cmdSupportNo
FileSystem::CommandSupportType reiserfs::m_GetUUID = FileSystem::cmdSupportNone;
reiserfs::reiserfs(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label) :
FileSystem(firstsector, lastsector, sectorsused, label, FileSystem::ReiserFS)
FileSystem(firstsector, lastsector, sectorsused, label, FileSystem::Type::ReiserFS)
{
}

View File

@ -40,7 +40,7 @@ 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::Udf)
FileSystem(firstsector, lastsector, sectorsused, label, FileSystem::Type::Udf)
{
}

View File

@ -24,7 +24,7 @@ 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::Ufs)
FileSystem(firstsector, lastsector, sectorsused, label, FileSystem::Type::Ufs)
{
}
}

View File

@ -22,7 +22,7 @@ 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::Unformatted)
FileSystem(firstsector, lastsector, sectorsused, label, FileSystem::Type::Unformatted)
{
}

View File

@ -20,7 +20,7 @@
namespace FS
{
unknown::unknown(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label) :
FileSystem(firstsector, lastsector, sectorsused, label, FileSystem::Unknown)
FileSystem(firstsector, lastsector, sectorsused, label, FileSystem::Type::Unknown)
{
}

View File

@ -42,7 +42,7 @@ 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::Xfs)
FileSystem(firstsector, lastsector, sectorsused, label, FileSystem::Type::Xfs)
{
}

View File

@ -40,7 +40,7 @@ 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::Zfs)
FileSystem(firstsector, lastsector, sectorsused, label, FileSystem::Type::Zfs)
{
}

View File

@ -101,12 +101,12 @@ void PartWidget::paintEvent(QPaintEvent*)
if (partition()->roles().has(PartitionRole::Extended)) {
drawGradient(&painter, activeColor(
m_fileSystemColorCode[ partition()->fileSystem().type() ]),
m_fileSystemColorCode[ static_cast<int>(partition()->fileSystem().type()) ]),
QRect(0, 0, width(), height()));
return;
}
const QColor base = activeColor(m_fileSystemColorCode[ partition()->fileSystem().type() ]);
const QColor base = activeColor(m_fileSystemColorCode[ static_cast<int>(partition()->fileSystem().type()) ]);
if (!partition()->roles().has(PartitionRole::Unallocated)) {
const QColor dark = base.darker(105);

View File

@ -49,7 +49,7 @@ bool CreateFileSystemJob::run(Report& parent)
Report* report = jobStarted(parent);
if (partition().fileSystem().type() == FileSystem::Unformatted)
if (partition().fileSystem().type() == FileSystem::Type::Unformatted)
return true;
bool createResult;

View File

@ -82,7 +82,7 @@ bool RestoreFileSystemJob::run(Report& parent)
std::unique_ptr<CoreBackendDevice> backendDevice = CoreBackendManager::self()->backend()->openDevice(targetDevice());
FileSystem::Type t = FileSystem::Unknown;
FileSystem::Type t = FileSystem::Type::Unknown;
if (backendDevice) {
std::unique_ptr<CoreBackendPartitionTable> backendPartitionTable = backendDevice->openPartitionTable();

View File

@ -55,7 +55,7 @@ NewOperation::NewOperation(Device& d, Partition* p) :
const FileSystem& fs = newPartition().fileSystem();
if (fs.type() != FileSystem::Extended) {
if (fs.type() != FileSystem::Type::Extended) {
// It would seem tempting to skip the CreateFileSystemJob or the
// SetFileSystemLabelJob if either has nothing to do (unformatted FS or
// empty label). However, the user might later on decide to change FS or
@ -65,7 +65,7 @@ NewOperation::NewOperation(Device& d, Partition* p) :
m_CreateFileSystemJob = new CreateFileSystemJob(targetDevice(), newPartition(), fs.label());
addJob(createFileSystemJob());
if (fs.type() == FileSystem::Lvm2_PV) {
if (fs.type() == FileSystem::Type::Lvm2_PV) {
m_SetPartFlagsJob = new SetPartFlagsJob(targetDevice(), newPartition(), PartitionTable::FlagLvm);
addJob(setPartFlagsJob());
}

View File

@ -67,7 +67,7 @@ bool RemoveVolumeGroupOperation::isRemovable(const VolumeManagerDevice* dev)
else if (dev->partitionTable()->children().count() > 1)
return false;
else
if (dev->partitionTable()->children().first()->fileSystem().type() == FileSystem::Unknown)
if (dev->partitionTable()->children().first()->fileSystem().type() == FileSystem::Type::Unknown)
return true;
}

View File

@ -225,7 +225,7 @@ Partition* RestoreOperation::createRestorePartition(const Device& device, Partit
return nullptr;
const qint64 end = start + fileInfo.size() / device.logicalSize() - 1;
Partition* p = new Partition(&parent, device, PartitionRole(r), FileSystemFactory::create(FileSystem::Unknown, start, end, device.logicalSize()), start, end, QString());
Partition* p = new Partition(&parent, device, PartitionRole(r), FileSystemFactory::create(FileSystem::Type::Unknown, start, end, device.logicalSize()), start, end, QString());
p->setState(Partition::StateRestore);
return p;

View File

@ -74,7 +74,7 @@ FileSystem::Type DummyBackend::detectFileSystem(const QString& deviceNode)
{
Q_UNUSED(deviceNode)
return FileSystem::Unknown;
return FileSystem::Type::Unknown;
}
QString DummyBackend::readLabel(const QString& deviceNode) const

View File

@ -96,7 +96,7 @@ FileSystem::Type DummyPartitionTable::detectFileSystemBySector(Report& report, c
Q_UNUSED(device)
Q_UNUSED(sector)
FileSystem::Type rval = FileSystem::Unknown;
FileSystem::Type rval = FileSystem::Type::Unknown;
return rval;
}

View File

@ -209,13 +209,13 @@ void SfdiskBackend::scanDevicePartitions(Device& d, const QJsonArray& jsonPartit
else if (partitionType == QStringLiteral("21686148-6449-6E6F-744E-656564454649"))
activeFlags = PartitionTable::FlagBiosGrub;
FileSystem::Type type = FileSystem::Unknown;
FileSystem::Type type = FileSystem::Type::Unknown;
type = detectFileSystem(partitionNode);
PartitionRole::Roles r = PartitionRole::Primary;
if ( (d.partitionTable()->type() == PartitionTable::msdos || d.partitionTable()->type() == PartitionTable::msdos_sectorbased) && partitionType.toInt() == 5 ) {
r = PartitionRole::Extended;
type = FileSystem::Extended;
type = FileSystem::Type::Extended;
}
// Find an extended partition this partition is in.
@ -233,7 +233,7 @@ void SfdiskBackend::scanDevicePartitions(Device& d, const QJsonArray& jsonPartit
QString mountPoint;
bool mounted;
// sfdisk does not handle LUKS partitions
if (fs->type() == FileSystem::Luks || fs->type() == FileSystem::Luks2) {
if (fs->type() == FileSystem::Type::Luks || fs->type() == FileSystem::Type::Luks2) {
r |= PartitionRole::Luks;
FS::luks* luksFs = static_cast<FS::luks*>(fs);
luksFs->initLUKS();
@ -280,7 +280,7 @@ void SfdiskBackend::scanDevicePartitions(Device& d, const QJsonArray& jsonPartit
*/
void SfdiskBackend::readSectorsUsed(const Device& d, Partition& p, const QString& mountPoint)
{
if (!mountPoint.isEmpty() && p.fileSystem().type() != FileSystem::LinuxSwap && p.fileSystem().type() != FileSystem::Lvm2_PV) {
if (!mountPoint.isEmpty() && p.fileSystem().type() != FileSystem::Type::LinuxSwap && p.fileSystem().type() != FileSystem::Type::Lvm2_PV) {
const QStorageInfo storage = QStorageInfo(mountPoint);
if (p.isMounted() && storage.isValid())
p.fileSystem().setSectorsUsed( (storage.bytesTotal() - storage.bytesFree()) / d.logicalSize());
@ -291,7 +291,7 @@ void SfdiskBackend::readSectorsUsed(const Device& d, Partition& p, const QString
FileSystem::Type SfdiskBackend::detectFileSystem(const QString& partitionPath)
{
FileSystem::Type rval = FileSystem::Unknown;
FileSystem::Type rval = FileSystem::Type::Unknown;
ExternalCommand udevCommand(QStringLiteral("udevadm"), {
QStringLiteral("info"),
@ -314,43 +314,43 @@ FileSystem::Type SfdiskBackend::detectFileSystem(const QString& partitionPath)
version = reFileSystemVersion.captured(1);
}
if (s == QStringLiteral("ext2")) rval = FileSystem::Ext2;
else if (s == QStringLiteral("ext3")) rval = FileSystem::Ext3;
else if (s.startsWith(QStringLiteral("ext4"))) rval = FileSystem::Ext4;
else if (s == QStringLiteral("swap")) rval = FileSystem::LinuxSwap;
else if (s == QStringLiteral("ntfs-3g")) rval = FileSystem::Ntfs;
else if (s == QStringLiteral("reiserfs")) rval = FileSystem::ReiserFS;
else if (s == QStringLiteral("reiser4")) rval = FileSystem::Reiser4;
else if (s == QStringLiteral("xfs")) rval = FileSystem::Xfs;
else if (s == QStringLiteral("jfs")) rval = FileSystem::Jfs;
else if (s == QStringLiteral("hfs")) rval = FileSystem::Hfs;
else if (s == QStringLiteral("hfsplus")) rval = FileSystem::HfsPlus;
else if (s == QStringLiteral("ufs")) rval = FileSystem::Ufs;
if (s == QStringLiteral("ext2")) rval = FileSystem::Type::Ext2;
else if (s == QStringLiteral("ext3")) rval = FileSystem::Type::Ext3;
else if (s.startsWith(QStringLiteral("ext4"))) rval = FileSystem::Type::Ext4;
else if (s == QStringLiteral("swap")) rval = FileSystem::Type::LinuxSwap;
else if (s == QStringLiteral("ntfs-3g")) rval = FileSystem::Type::Ntfs;
else if (s == QStringLiteral("reiserfs")) rval = FileSystem::Type::ReiserFS;
else if (s == QStringLiteral("reiser4")) rval = FileSystem::Type::Reiser4;
else if (s == QStringLiteral("xfs")) rval = FileSystem::Type::Xfs;
else if (s == QStringLiteral("jfs")) rval = FileSystem::Type::Jfs;
else if (s == QStringLiteral("hfs")) rval = FileSystem::Type::Hfs;
else if (s == QStringLiteral("hfsplus")) rval = FileSystem::Type::HfsPlus;
else if (s == QStringLiteral("ufs")) rval = FileSystem::Type::Ufs;
else if (s == QStringLiteral("vfat")) {
if (version == QStringLiteral("FAT32"))
rval = FileSystem::Fat32;
rval = FileSystem::Type::Fat32;
else if (version == QStringLiteral("FAT16"))
rval = FileSystem::Fat16;
rval = FileSystem::Type::Fat16;
else if (version == QStringLiteral("FAT12"))
rval = FileSystem::Fat12;
rval = FileSystem::Type::Fat12;
}
else if (s == QStringLiteral("btrfs")) rval = FileSystem::Btrfs;
else if (s == QStringLiteral("ocfs2")) rval = FileSystem::Ocfs2;
else if (s == QStringLiteral("zfs_member")) rval = FileSystem::Zfs;
else if (s == QStringLiteral("hpfs")) rval = FileSystem::Hpfs;
else if (s == QStringLiteral("btrfs")) rval = FileSystem::Type::Btrfs;
else if (s == QStringLiteral("ocfs2")) rval = FileSystem::Type::Ocfs2;
else if (s == QStringLiteral("zfs_member")) rval = FileSystem::Type::Zfs;
else if (s == QStringLiteral("hpfs")) rval = FileSystem::Type::Hpfs;
else if (s == QStringLiteral("crypto_LUKS")) {
if (version == QStringLiteral("1"))
rval = FileSystem::Luks;
rval = FileSystem::Type::Luks;
else if (version == QStringLiteral("2")) {
rval = FileSystem::Luks2;
rval = FileSystem::Type::Luks2;
}
}
else if (s == QStringLiteral("exfat")) rval = FileSystem::Exfat;
else if (s == QStringLiteral("nilfs2")) rval = FileSystem::Nilfs2;
else if (s == QStringLiteral("LVM2_member")) rval = FileSystem::Lvm2_PV;
else if (s == QStringLiteral("f2fs")) rval = FileSystem::F2fs;
else if (s == QStringLiteral("udf")) rval = FileSystem::Udf;
else if (s == QStringLiteral("iso9660")) rval = FileSystem::Iso9660;
else if (s == QStringLiteral("exfat")) rval = FileSystem::Type::Exfat;
else if (s == QStringLiteral("nilfs2")) rval = FileSystem::Type::Nilfs2;
else if (s == QStringLiteral("LVM2_member")) rval = FileSystem::Type::Lvm2_PV;
else if (s == QStringLiteral("f2fs")) rval = FileSystem::Type::F2fs;
else if (s == QStringLiteral("udf")) rval = FileSystem::Type::Udf;
else if (s == QStringLiteral("iso9660")) rval = FileSystem::Type::Iso9660;
else
qWarning() << "unknown file system type " << s << " on " << partitionPath;
}

View File

@ -135,7 +135,7 @@ bool SfdiskPartitionTable::resizeFileSystem(Report& report, const Partition& par
FileSystem::Type SfdiskPartitionTable::detectFileSystemBySector(Report& report, const Device& device, qint64 sector)
{
FileSystem::Type type = FileSystem::Unknown;
FileSystem::Type type = FileSystem::Type::Unknown;
ExternalCommand jsonCommand(QStringLiteral("sfdisk"), { QStringLiteral("--json"), device.deviceNode() } );
if (jsonCommand.run(-1) && jsonCommand.exitCode() == 0) {
@ -160,24 +160,24 @@ static struct {
FileSystem::Type type;
QLatin1String partitionType[2]; // GPT, MBR
} typemap[] = {
{ FileSystem::Btrfs, { QLatin1String("0FC63DAF-8483-4772-8E79-3D69D8477DE4"), QLatin1String("83") } },
{ FileSystem::Ext2, { QLatin1String("0FC63DAF-8483-4772-8E79-3D69D8477DE4"), QLatin1String("83") } },
{ FileSystem::Ext3, { QLatin1String("0FC63DAF-8483-4772-8E79-3D69D8477DE4"), QLatin1String("83") } },
{ FileSystem::Ext4, { QLatin1String("0FC63DAF-8483-4772-8E79-3D69D8477DE4"), QLatin1String("83") } },
{ FileSystem::LinuxSwap, { QLatin1String("0657FD6D-A4AB-43C4-84E5-0933C84B4F4F"), QLatin1String("82") } },
{ FileSystem::Fat12, { QLatin1String("EBD0A0A2-B9E5-4433-87C0-68B6B72699C7"), QLatin1String("6") } },
{ FileSystem::Fat16, { QLatin1String("EBD0A0A2-B9E5-4433-87C0-68B6B72699C7"), QLatin1String("6") } },
{ FileSystem::Fat32, { QLatin1String("EBD0A0A2-B9E5-4433-87C0-68B6B72699C7"), QLatin1String("7") } },
{ FileSystem::Nilfs2, { QLatin1String("0FC63DAF-8483-4772-8E79-3D69D8477DE4"), QLatin1String("83") } },
{ FileSystem::Ntfs, { QLatin1String("EBD0A0A2-B9E5-4433-87C0-68B6B72699C7"), QLatin1String("7") } },
{ FileSystem::Exfat, { QLatin1String("EBD0A0A2-B9E5-4433-87C0-68B6B72699C7"), QLatin1String("7") } },
{ FileSystem::ReiserFS, { QLatin1String("0FC63DAF-8483-4772-8E79-3D69D8477DE4"), QLatin1String("83") } },
{ FileSystem::Reiser4, { QLatin1String("0FC63DAF-8483-4772-8E79-3D69D8477DE4"), QLatin1String("83") } },
{ FileSystem::Xfs, { QLatin1String("0FC63DAF-8483-4772-8E79-3D69D8477DE4"), QLatin1String("83") } },
{ FileSystem::Jfs, { QLatin1String("0FC63DAF-8483-4772-8E79-3D69D8477DE4"), QLatin1String("83") } },
{ FileSystem::Hfs, { QLatin1String("48465300-0000-11AA-AA11-00306543ECAC"), QLatin1String("af")} },
{ FileSystem::HfsPlus, { QLatin1String("48465300-0000-11AA-AA11-00306543ECAC"), QLatin1String("af") } },
{ FileSystem::Udf, { QLatin1String("EBD0A0A2-B9E5-4433-87C0-68B6B72699C7"), QLatin1String("7") } }
{ FileSystem::Type::Btrfs, { QLatin1String("0FC63DAF-8483-4772-8E79-3D69D8477DE4"), QLatin1String("83") } },
{ FileSystem::Type::Ext2, { QLatin1String("0FC63DAF-8483-4772-8E79-3D69D8477DE4"), QLatin1String("83") } },
{ FileSystem::Type::Ext3, { QLatin1String("0FC63DAF-8483-4772-8E79-3D69D8477DE4"), QLatin1String("83") } },
{ FileSystem::Type::Ext4, { QLatin1String("0FC63DAF-8483-4772-8E79-3D69D8477DE4"), QLatin1String("83") } },
{ FileSystem::Type::LinuxSwap, { QLatin1String("0657FD6D-A4AB-43C4-84E5-0933C84B4F4F"), QLatin1String("82") } },
{ FileSystem::Type::Fat12, { QLatin1String("EBD0A0A2-B9E5-4433-87C0-68B6B72699C7"), QLatin1String("6") } },
{ FileSystem::Type::Fat16, { QLatin1String("EBD0A0A2-B9E5-4433-87C0-68B6B72699C7"), QLatin1String("6") } },
{ FileSystem::Type::Fat32, { QLatin1String("EBD0A0A2-B9E5-4433-87C0-68B6B72699C7"), QLatin1String("7") } },
{ FileSystem::Type::Nilfs2, { QLatin1String("0FC63DAF-8483-4772-8E79-3D69D8477DE4"), QLatin1String("83") } },
{ FileSystem::Type::Ntfs, { QLatin1String("EBD0A0A2-B9E5-4433-87C0-68B6B72699C7"), QLatin1String("7") } },
{ FileSystem::Type::Exfat, { QLatin1String("EBD0A0A2-B9E5-4433-87C0-68B6B72699C7"), QLatin1String("7") } },
{ FileSystem::Type::ReiserFS, { QLatin1String("0FC63DAF-8483-4772-8E79-3D69D8477DE4"), QLatin1String("83") } },
{ FileSystem::Type::Reiser4, { QLatin1String("0FC63DAF-8483-4772-8E79-3D69D8477DE4"), QLatin1String("83") } },
{ FileSystem::Type::Xfs, { QLatin1String("0FC63DAF-8483-4772-8E79-3D69D8477DE4"), QLatin1String("83") } },
{ FileSystem::Type::Jfs, { QLatin1String("0FC63DAF-8483-4772-8E79-3D69D8477DE4"), QLatin1String("83") } },
{ FileSystem::Type::Hfs, { QLatin1String("48465300-0000-11AA-AA11-00306543ECAC"), QLatin1String("af")} },
{ FileSystem::Type::HfsPlus, { QLatin1String("48465300-0000-11AA-AA11-00306543ECAC"), QLatin1String("af") } },
{ FileSystem::Type::Udf, { QLatin1String("EBD0A0A2-B9E5-4433-87C0-68B6B72699C7"), QLatin1String("7") } }
// Add ZFS too
};