diff --git a/src/config.kcfg b/src/config.kcfg index bb85071..3027d55 100644 --- a/src/config.kcfg +++ b/src/config.kcfg @@ -60,7 +60,7 @@ - + 220,205,175 187,249,207 @@ -84,6 +84,7 @@ 170,30,77 96,140,85 33,137,108 + 250,230,255 diff --git a/src/config/configurepagefilesystemcolors.ui b/src/config/configurepagefilesystemcolors.ui index ac41b78..21f2d04 100644 --- a/src/config/configurepagefilesystemcolors.ui +++ b/src/config/configurepagefilesystemcolors.ui @@ -6,7 +6,7 @@ 0 0 - 450 + 481 457 @@ -23,6 +23,35 @@ File Systems + + + + luks: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + false + + + + + + + + + + ntfs: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + false + + + @@ -126,22 +155,6 @@ - - - - luks: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - false - - - - - - @@ -229,10 +242,10 @@ - - + + - ntfs: + zfs: Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter @@ -467,35 +480,9 @@ - - - - zfs: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - false - - - - - - - Qt::Horizontal - - - - 173 - 18 - - - - @@ -577,6 +564,19 @@ + + + + exfat: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + diff --git a/src/fs/btrfs.cpp b/src/fs/btrfs.cpp index fd723cb..44d9b06 100644 --- a/src/fs/btrfs.cpp +++ b/src/fs/btrfs.cpp @@ -57,7 +57,6 @@ namespace FS m_GetUsed = findExternal("btrfs-debug-tree") ? cmdSupportFileSystem : cmdSupportNone; m_Shrink = (m_Grow != cmdSupportNone && m_GetUsed != cmdSupportNone) ? cmdSupportFileSystem : cmdSupportNone; - m_GetLabel = cmdSupportCore; m_SetLabel = findExternal("btrfs") ? cmdSupportFileSystem : cmdSupportNone; m_UpdateUUID = cmdSupportNone; diff --git a/src/fs/exfat.cpp b/src/fs/exfat.cpp new file mode 100644 index 0000000..c6899e7 --- /dev/null +++ b/src/fs/exfat.cpp @@ -0,0 +1,117 @@ +/*************************************************************************** + * Copyright (C) 2010 by Volker Lanz * + * * + * 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 2 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, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * + ***************************************************************************/ + +#include "fs/exfat.h" + +#include "util/externalcommand.h" +#include "util/capacity.h" + +#include +#include + +namespace FS +{ + FileSystem::CommandSupportType exfat::m_GetUsed = FileSystem::cmdSupportNone; + FileSystem::CommandSupportType exfat::m_GetLabel = FileSystem::cmdSupportNone; + FileSystem::CommandSupportType exfat::m_Create = FileSystem::cmdSupportNone; + FileSystem::CommandSupportType exfat::m_Grow = FileSystem::cmdSupportNone; + FileSystem::CommandSupportType exfat::m_Shrink = FileSystem::cmdSupportNone; + FileSystem::CommandSupportType exfat::m_Move = FileSystem::cmdSupportNone; + FileSystem::CommandSupportType exfat::m_Check = FileSystem::cmdSupportNone; + FileSystem::CommandSupportType exfat::m_Copy = FileSystem::cmdSupportNone; + FileSystem::CommandSupportType exfat::m_Backup = FileSystem::cmdSupportNone; + 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::Exfat) + { + } + + void exfat::init() + { + m_Create = findExternal("mkfs.exfat") ? cmdSupportFileSystem : cmdSupportNone; + m_Check = findExternal("exfatfsck", QStringList(), 1) ? cmdSupportFileSystem : cmdSupportNone; + + m_GetLabel = cmdSupportCore; + m_SetLabel = findExternal("exfatlabel") ? cmdSupportFileSystem : cmdSupportNone; + m_UpdateUUID = cmdSupportNone; + + m_Copy = (m_Check != cmdSupportNone) ? cmdSupportCore : cmdSupportNone; + m_Move = (m_Check != cmdSupportNone) ? cmdSupportCore : cmdSupportNone; + + m_GetLabel = cmdSupportCore; + m_Backup = cmdSupportCore; + m_GetUUID = cmdSupportCore; + } + + bool exfat::supportToolFound() const + { + return +// m_GetUsed != cmdSupportNone && + m_GetLabel != cmdSupportNone && + m_SetLabel != cmdSupportNone && + m_Create != cmdSupportNone && + m_Check != cmdSupportNone && +// m_UpdateUUID != cmdSupportNone && +// m_Grow != cmdSupportNone && +// m_Shrink != cmdSupportNone && + m_Copy != cmdSupportNone && + m_Move != cmdSupportNone && + m_Backup != cmdSupportNone && + m_GetUUID != cmdSupportNone; + } + + FileSystem::SupportTool exfat::supportToolName() const + { + return SupportTool("exfat-utils", KUrl("http://code.google.com/p/exfat/")); + } + + qint64 exfat::maxCapacity() const + { + return Capacity::unitFactor(Capacity::Byte, Capacity::EiB); + } + + bool exfat::check(Report& report, const QString& deviceNode) const + { + ExternalCommand cmd(report, "exfatfsck", QStringList() << deviceNode); + return cmd.run(-1) && cmd.exitCode() == 0; + } + + bool exfat::create(Report& report, const QString& deviceNode) const + { + ExternalCommand cmd(report, "mkfs.exfat", QStringList() << deviceNode); + return cmd.run(-1) && cmd.exitCode() == 0; + } + + bool exfat::writeLabel(Report& report, const QString& deviceNode, const QString& newLabel) + { + ExternalCommand cmd(report, "exfatlabel", QStringList() << deviceNode << newLabel); + return cmd.run(-1) && cmd.exitCode() == 0; + } + + bool exfat::updateUUID(Report& report, const QString& deviceNode) const + { + Q_UNUSED(report); + Q_UNUSED(deviceNode); + + return false; + } +} diff --git a/src/fs/exfat.h b/src/fs/exfat.h new file mode 100644 index 0000000..97ba1b8 --- /dev/null +++ b/src/fs/exfat.h @@ -0,0 +1,88 @@ +/*************************************************************************** + * Copyright (C) 2010 by Volker Lanz * + * * + * 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 2 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, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * + ***************************************************************************/ + +#if !defined(EXFAT__H) + +#define EXFAT__H + +#include "util/libpartitionmanagerexport.h" + +#include "fs/filesystem.h" + +#include + +class Report; + +class QString; + +namespace FS +{ + /** An exfat file system. + @author Volker Lanz + */ + class LIBPARTITIONMANAGERPRIVATE_EXPORT exfat : public FileSystem + { + public: + exfat(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label); + + public: + static void init(); + +// virtual qint64 readUsedCapacity(const QString& deviceNode) const; + virtual bool check(Report& report, const QString& deviceNode) const; + virtual bool create(Report& report, const QString& deviceNode) const; +// virtual bool resize(Report& report, const QString& deviceNode, qint64 length) const; + virtual bool writeLabel(Report& report, const QString& deviceNode, const QString& newLabel); + virtual bool updateUUID(Report& report, const QString& deviceNode) const; + + virtual CommandSupportType supportGetUsed() const { return m_GetUsed; } + virtual CommandSupportType supportGetLabel() const { return m_GetLabel; } + virtual CommandSupportType supportCreate() const { return m_Create; } + virtual CommandSupportType supportGrow() const { return m_Grow; } + virtual CommandSupportType supportShrink() const { return m_Shrink; } + virtual CommandSupportType supportMove() const { return m_Move; } + virtual CommandSupportType supportCheck() const { return m_Check; } + virtual CommandSupportType supportCopy() const { return m_Copy; } + virtual CommandSupportType supportBackup() const { return m_Backup; } + virtual CommandSupportType supportSetLabel() const { return m_SetLabel; } + virtual CommandSupportType supportUpdateUUID() const { return m_UpdateUUID; } + virtual CommandSupportType supportGetUUID() const { return m_GetUUID; } + +// virtual qint64 minCapacity() const; + virtual qint64 maxCapacity() const; + virtual SupportTool supportToolName() const; + virtual bool supportToolFound() const; + + public: + static CommandSupportType m_GetUsed; + static CommandSupportType m_GetLabel; + static CommandSupportType m_Create; + static CommandSupportType m_Grow; + static CommandSupportType m_Shrink; + static CommandSupportType m_Move; + static CommandSupportType m_Check; + static CommandSupportType m_Copy; + static CommandSupportType m_Backup; + static CommandSupportType m_SetLabel; + static CommandSupportType m_UpdateUUID; + static CommandSupportType m_GetUUID; + }; +} + +#endif diff --git a/src/fs/filesystem.cpp b/src/fs/filesystem.cpp index a7f7c13..1ddcfbe 100644 --- a/src/fs/filesystem.cpp +++ b/src/fs/filesystem.cpp @@ -273,6 +273,7 @@ static const QString* typeNames() i18nc("@item/plain filesystem name", "luks"), i18nc("@item/plain filesystem name", "ocfs2"), i18nc("@item/plain filesystem name", "zfs"), + i18nc("@item/plain filesystem name", "exfat"), }; return s; diff --git a/src/fs/filesystem.h b/src/fs/filesystem.h index 915e548..f9e7ebd 100644 --- a/src/fs/filesystem.h +++ b/src/fs/filesystem.h @@ -78,8 +78,9 @@ class FileSystem Luks = 19, Ocfs2 = 20, Zfs = 21, + Exfat = 22, - __lastType = 22 + __lastType = 23 }; /** The type of support for a given FileSystem action */ diff --git a/src/fs/filesystemfactory.cpp b/src/fs/filesystemfactory.cpp index d4434b5..1f6efdc 100644 --- a/src/fs/filesystemfactory.cpp +++ b/src/fs/filesystemfactory.cpp @@ -21,6 +21,7 @@ #include "fs/filesystem.h" #include "fs/btrfs.h" +#include "fs/exfat.h" #include "fs/ext2.h" #include "fs/ext3.h" #include "fs/ext4.h" @@ -55,6 +56,7 @@ void FileSystemFactory::init() 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())); @@ -78,6 +80,7 @@ void FileSystemFactory::init() m_FileSystems.insert(FileSystem::Zfs, new FS::zfs(-1, -1, -1, QString())); FS::btrfs::init(); + FS::exfat::init(); FS::ext2::init(); FS::ext3::init(); FS::ext4::init(); @@ -118,6 +121,7 @@ FileSystem* FileSystemFactory::create(FileSystem::Type t, qint64 firstsector, qi 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; diff --git a/src/plugins/libparted/libpartedbackend.cpp b/src/plugins/libparted/libpartedbackend.cpp index 9b53329..1d3d32b 100644 --- a/src/plugins/libparted/libpartedbackend.cpp +++ b/src/plugins/libparted/libpartedbackend.cpp @@ -552,6 +552,7 @@ FileSystem::Type LibPartedBackend::detectFileSystem(PedPartition* pedPartition) else if (s == "zfs") rval = FileSystem::Zfs; else if (s == "hpfs") rval = FileSystem::Hpfs; else if (s == "crypto_LUKS") rval = FileSystem::Luks; + else if (s == "exfat") rval = FileSystem::Exfat; else kWarning() << "blkid: unknown file system type " << s << " on " << pedPath; }