Add exfat support.
svn path=/trunk/extragear/sysadmin/partitionmanager/; revision=1324282
This commit is contained in:
parent
c01900e6d1
commit
c2828d9e07
|
@ -60,7 +60,7 @@
|
|||
</entry>
|
||||
<entry key="fileSystemColorCode$(colorNumber)" type="Color">
|
||||
<label context="@label">File system colors</label>
|
||||
<parameter name="colorNumber" type="UInt" max="21"/>
|
||||
<parameter name="colorNumber" type="UInt" max="22"/>
|
||||
<!-- numbers correspond to the enum in fs/filesystem.h -->
|
||||
<default param="0">220,205,175</default> <!-- unknown -->
|
||||
<default param="1">187,249,207</default> <!-- extended -->
|
||||
|
@ -84,6 +84,7 @@
|
|||
<default param="19">170,30,77</default> <!-- luks -->
|
||||
<default param="20">96,140,85</default> <!-- ocfs2 -->
|
||||
<default param="21">33,137,108</default> <!-- zfs -->
|
||||
<default param="22">250,230,255</default> <!-- exfat -->
|
||||
</entry>
|
||||
<entry key="showMenuBar" type="Bool">
|
||||
<label context="@label">Show the application's menu bar</label>
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>450</width>
|
||||
<width>481</width>
|
||||
<height>457</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
@ -23,6 +23,35 @@
|
|||
<string>File Systems</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="1" column="3">
|
||||
<widget class="QLabel" name="textLabel_20">
|
||||
<property name="text">
|
||||
<string>luks:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="4">
|
||||
<widget class="KColorButton" name="kcfg_fileSystemColorCode19"/>
|
||||
</item>
|
||||
<item row="2" column="6">
|
||||
<widget class="QLabel" name="textLabel_9">
|
||||
<property name="text">
|
||||
<string>ntfs:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="textLabel">
|
||||
<property name="text">
|
||||
|
@ -126,22 +155,6 @@
|
|||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<widget class="QLabel" name="textLabel_20">
|
||||
<property name="text">
|
||||
<string>luks:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="4">
|
||||
<widget class="KColorButton" name="kcfg_fileSystemColorCode19"/>
|
||||
</item>
|
||||
<item row="1" column="5">
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
|
@ -229,10 +242,10 @@
|
|||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="2" column="6">
|
||||
<widget class="QLabel" name="textLabel_9">
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="textLabel_25">
|
||||
<property name="text">
|
||||
<string>ntfs:</string>
|
||||
<string>zfs:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
|
@ -467,35 +480,9 @@
|
|||
<item row="5" column="7">
|
||||
<widget class="KColorButton" name="kcfg_fileSystemColorCode20"/>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="textLabel_25">
|
||||
<property name="text">
|
||||
<string>zfs:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="KColorButton" name="kcfg_fileSystemColorCode21"/>
|
||||
</item>
|
||||
<item row="6" column="2" colspan="6">
|
||||
<spacer name="horizontalSpacer_17">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>173</width>
|
||||
<height>18</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="QLabel" name="textLabel_13">
|
||||
<property name="text">
|
||||
|
@ -577,6 +564,19 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="3">
|
||||
<widget class="QLabel" name="textLabel_26">
|
||||
<property name="text">
|
||||
<string>exfat:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="4">
|
||||
<widget class="KColorButton" name="kcfg_fileSystemColorCode22"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -0,0 +1,117 @@
|
|||
/***************************************************************************
|
||||
* Copyright (C) 2010 by Volker Lanz <vl@fidra.de> *
|
||||
* *
|
||||
* 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 <QString>
|
||||
#include <QRegExp>
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,88 @@
|
|||
/***************************************************************************
|
||||
* Copyright (C) 2010 by Volker Lanz <vl@fidra.de> *
|
||||
* *
|
||||
* 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 <qglobal.h>
|
||||
|
||||
class Report;
|
||||
|
||||
class QString;
|
||||
|
||||
namespace FS
|
||||
{
|
||||
/** An exfat file system.
|
||||
@author Volker Lanz <vl@fidra.de>
|
||||
*/
|
||||
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
|
|
@ -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;
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue