Add detection support for Apple File System (APFS).
This commit is contained in:
parent
e749b01b8e
commit
559c326be7
|
@ -1,4 +1,5 @@
|
||||||
set(FS_SRC
|
set(FS_SRC
|
||||||
|
fs/apfs.cpp
|
||||||
fs/bitlocker.cpp
|
fs/bitlocker.cpp
|
||||||
fs/btrfs.cpp
|
fs/btrfs.cpp
|
||||||
fs/exfat.cpp
|
fs/exfat.cpp
|
||||||
|
@ -36,6 +37,7 @@ set(FS_SRC
|
||||||
)
|
)
|
||||||
|
|
||||||
set(FS_LIB_HDRS
|
set(FS_LIB_HDRS
|
||||||
|
fs/apfs.h
|
||||||
fs/bitlocker.h
|
fs/bitlocker.h
|
||||||
fs/btrfs.h
|
fs/btrfs.h
|
||||||
fs/exfat.h
|
fs/exfat.h
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
/*************************************************************************
|
||||||
|
* Copyright (C) 2019 by Andrius Štikonas <stikonas@kde.org> *
|
||||||
|
* *
|
||||||
|
* This program is free software; you can redistribute it and/or *
|
||||||
|
* modify it under the terms of the GNU General Public License as *
|
||||||
|
* published by the Free Software Foundation; either version 3 of *
|
||||||
|
* the License, or (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
* This program is distributed in the hope that it will be useful, *
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
|
* GNU General Public License for more details. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU General Public License *
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.*
|
||||||
|
*************************************************************************/
|
||||||
|
|
||||||
|
#include "fs/apfs.h"
|
||||||
|
|
||||||
|
namespace FS
|
||||||
|
{
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,61 @@
|
||||||
|
/*************************************************************************
|
||||||
|
* Copyright (C) 2019 by Andrius Štikonas <stikonas@kde.org> *
|
||||||
|
* *
|
||||||
|
* This program is free software; you can redistribute it and/or *
|
||||||
|
* modify it under the terms of the GNU General Public License as *
|
||||||
|
* published by the Free Software Foundation; either version 3 of *
|
||||||
|
* the License, or (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
* This program is distributed in the hope that it will be useful, *
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
|
* GNU General Public License for more details. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU General Public License *
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.*
|
||||||
|
*************************************************************************/
|
||||||
|
|
||||||
|
#ifndef KPMCORE_APFS_H
|
||||||
|
#define KPMCORE_APFS_H
|
||||||
|
|
||||||
|
#include "util/libpartitionmanagerexport.h"
|
||||||
|
|
||||||
|
#include "fs/filesystem.h"
|
||||||
|
|
||||||
|
#include <QtGlobal>
|
||||||
|
|
||||||
|
class QString;
|
||||||
|
|
||||||
|
namespace FS
|
||||||
|
{
|
||||||
|
/** An APFS file system.
|
||||||
|
@author Andrius Štikonas <stikonas@kde.org>
|
||||||
|
*/
|
||||||
|
class LIBKPMCORE_EXPORT apfs : public FileSystem
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
apfs(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label);
|
||||||
|
|
||||||
|
public:
|
||||||
|
CommandSupportType supportMove() const override {
|
||||||
|
return m_Move;
|
||||||
|
}
|
||||||
|
CommandSupportType supportCopy() const override {
|
||||||
|
return m_Copy;
|
||||||
|
}
|
||||||
|
CommandSupportType supportBackup() const override {
|
||||||
|
return m_Backup;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool supportToolFound() const override {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public:
|
||||||
|
static CommandSupportType m_Move;
|
||||||
|
static CommandSupportType m_Copy;
|
||||||
|
static CommandSupportType m_Backup;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
|
@ -71,6 +71,7 @@ const std::vector<QColor> FileSystem::defaultColorCode =
|
||||||
QColor( 204,179,255 ), // fat12
|
QColor( 204,179,255 ), // fat12
|
||||||
QColor( 255,100,100 ), // linux_raid_member
|
QColor( 255,100,100 ), // linux_raid_member
|
||||||
QColor( 110,20,50 ), // bitlocker
|
QColor( 110,20,50 ), // bitlocker
|
||||||
|
QColor( 255,155,174 ), // apfs
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -450,6 +451,7 @@ static const KLocalizedString* typeNames()
|
||||||
kxi18nc("@item filesystem name", "fat12"),
|
kxi18nc("@item filesystem name", "fat12"),
|
||||||
kxi18nc("@item filesystem name", "linux_raid_member"),
|
kxi18nc("@item filesystem name", "linux_raid_member"),
|
||||||
kxi18nc("@item filesystem name", "BitLocker"),
|
kxi18nc("@item filesystem name", "BitLocker"),
|
||||||
|
kxi18nc("@item filesystem name", "apfs"),
|
||||||
};
|
};
|
||||||
|
|
||||||
return s;
|
return s;
|
||||||
|
|
|
@ -93,6 +93,7 @@ public:
|
||||||
Fat12,
|
Fat12,
|
||||||
LinuxRaidMember,
|
LinuxRaidMember,
|
||||||
BitLocker,
|
BitLocker,
|
||||||
|
Apfs,
|
||||||
|
|
||||||
__lastType
|
__lastType
|
||||||
};
|
};
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
#include "fs/filesystemfactory.h"
|
#include "fs/filesystemfactory.h"
|
||||||
#include "fs/filesystem.h"
|
#include "fs/filesystem.h"
|
||||||
|
|
||||||
|
#include "fs/apfs.h"
|
||||||
#include "fs/bitlocker.h"
|
#include "fs/bitlocker.h"
|
||||||
#include "fs/btrfs.h"
|
#include "fs/btrfs.h"
|
||||||
#include "fs/exfat.h"
|
#include "fs/exfat.h"
|
||||||
|
@ -63,6 +64,7 @@ void FileSystemFactory::init()
|
||||||
qDeleteAll(m_FileSystems);
|
qDeleteAll(m_FileSystems);
|
||||||
m_FileSystems.clear();
|
m_FileSystems.clear();
|
||||||
|
|
||||||
|
m_FileSystems.insert(FileSystem::Type::Apfs, new FS::apfs(-1, -1, -1, QString()));
|
||||||
m_FileSystems.insert(FileSystem::Type::BitLocker, new FS::bitlocker(-1, -1, -1, QString()));
|
m_FileSystems.insert(FileSystem::Type::BitLocker, new FS::bitlocker(-1, -1, -1, QString()));
|
||||||
m_FileSystems.insert(FileSystem::Type::Btrfs, new FS::btrfs(-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::Exfat, new FS::exfat(-1, -1, -1, QString()));
|
||||||
|
@ -115,6 +117,7 @@ FileSystem* FileSystemFactory::create(FileSystem::Type t, qint64 firstsector, qi
|
||||||
FileSystem* fs = nullptr;
|
FileSystem* fs = nullptr;
|
||||||
|
|
||||||
switch (t) {
|
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::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::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::Exfat: fs = new FS::exfat (firstsector, lastsector, sectorsused, label); break;
|
||||||
|
|
|
@ -450,6 +450,7 @@ FileSystem::Type SfdiskBackend::detectFileSystem(const QString& partitionPath)
|
||||||
else if (s == QStringLiteral("iso9660")) rval = FileSystem::Type::Iso9660;
|
else if (s == QStringLiteral("iso9660")) rval = FileSystem::Type::Iso9660;
|
||||||
else if (s == QStringLiteral("linux_raid_member")) rval = FileSystem::Type::LinuxRaidMember;
|
else if (s == QStringLiteral("linux_raid_member")) rval = FileSystem::Type::LinuxRaidMember;
|
||||||
else if (s == QStringLiteral("BitLocker")) rval = FileSystem::Type::BitLocker;
|
else if (s == QStringLiteral("BitLocker")) rval = FileSystem::Type::BitLocker;
|
||||||
|
else if (s == QStringLiteral("apfs")) rval = FileSystem::Type::Apfs;
|
||||||
else
|
else
|
||||||
qWarning() << "unknown file system type " << s << " on " << partitionPath;
|
qWarning() << "unknown file system type " << s << " on " << partitionPath;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue