Add exFAT support (!30)
With exfatprogs (https://github.com/exfatprogs/exfatprogs) installed the following operations on exFAT file systems are supported: - Creation - Checking - Labelling As of the current exfatprogs 1.0.4 the following are not supported: - Reading usage - Resizing - Updating the UUID Closes !30 - Add exFAT support
This commit is contained in:
parent
56fb026658
commit
bd386f445d
1
README
1
README
|
@ -261,6 +261,7 @@ provide this support:
|
||||||
|
|
||||||
btrfs-progs / btrfs-tools
|
btrfs-progs / btrfs-tools
|
||||||
e2fsprogs
|
e2fsprogs
|
||||||
|
exfatprogs
|
||||||
f2fs-tools
|
f2fs-tools
|
||||||
dosfstools
|
dosfstools
|
||||||
mtools - required to read and write FAT16/32 volume labels
|
mtools - required to read and write FAT16/32 volume labels
|
||||||
|
|
|
@ -18,9 +18,9 @@
|
||||||
data rescue from lost partitions.
|
data rescue from lost partitions.
|
||||||
</_p>
|
</_p>
|
||||||
<_p>
|
<_p>
|
||||||
GParted works with many file systems including: btrfs, ext2, ext3,
|
GParted works with many file systems including: btrfs, exfat, ext2,
|
||||||
ext4, fat16, fat32, hfs, hfs+, linux-swap, lvm2 pv, minix, nilfs2,
|
ext3, ext4, fat16, fat32, hfs, hfs+, linux-swap, lvm2 pv, minix,
|
||||||
ntfs, reiserfs, reiser4, udf, ufs, and xfs.
|
nilfs2, ntfs, reiserfs, reiser4, udf, ufs, and xfs.
|
||||||
</_p>
|
</_p>
|
||||||
</description>
|
</description>
|
||||||
<launchable type="desktop-id">gparted.desktop</launchable>
|
<launchable type="desktop-id">gparted.desktop</launchable>
|
||||||
|
|
|
@ -14,21 +14,30 @@
|
||||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef GPARTED_EXFAT_H
|
#ifndef GPARTED_EXFAT_H
|
||||||
#define GPARTED_EXFAT_H
|
#define GPARTED_EXFAT_H
|
||||||
|
|
||||||
|
|
||||||
#include "FileSystem.h"
|
#include "FileSystem.h"
|
||||||
|
#include "OperationDetail.h"
|
||||||
|
#include "Partition.h"
|
||||||
|
|
||||||
|
|
||||||
namespace GParted
|
namespace GParted
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
class exfat : public FileSystem
|
class exfat : public FileSystem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
FS get_filesystem_support();
|
FS get_filesystem_support();
|
||||||
|
bool create(const Partition& new_partition, OperationDetail& operationdetail);
|
||||||
|
void read_label(Partition& partition);
|
||||||
|
bool write_label(const Partition& partition, OperationDetail& operationdetail);
|
||||||
|
bool check_repair(const Partition& partition, OperationDetail& operationdetail);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
} //GParted
|
} //GParted
|
||||||
|
|
||||||
#endif /* GPARTED_EXFAT_H */
|
#endif /* GPARTED_EXFAT_H */
|
||||||
|
|
|
@ -261,7 +261,7 @@ int Utils::get_filesystem_label_maxlength(FSType fstype)
|
||||||
//All file systems commented out are not supported for labelling
|
//All file systems commented out are not supported for labelling
|
||||||
// by either the new partition or label partition operations.
|
// by either the new partition or label partition operations.
|
||||||
case FS_BTRFS : return 255 ;
|
case FS_BTRFS : return 255 ;
|
||||||
//case FS_EXFAT : return ;
|
case FS_EXFAT : return 11;
|
||||||
case FS_EXT2 : return 16 ;
|
case FS_EXT2 : return 16 ;
|
||||||
case FS_EXT3 : return 16 ;
|
case FS_EXT3 : return 16 ;
|
||||||
case FS_EXT4 : return 16 ;
|
case FS_EXT4 : return 16 ;
|
||||||
|
@ -433,6 +433,7 @@ Glib::ustring Utils::get_filesystem_software(FSType fstype)
|
||||||
switch (fstype)
|
switch (fstype)
|
||||||
{
|
{
|
||||||
case FS_BTRFS : return "btrfs-progs / btrfs-tools" ;
|
case FS_BTRFS : return "btrfs-progs / btrfs-tools" ;
|
||||||
|
case FS_EXFAT : return "exfatprogs";
|
||||||
case FS_EXT2 : return "e2fsprogs" ;
|
case FS_EXT2 : return "e2fsprogs" ;
|
||||||
case FS_EXT3 : return "e2fsprogs" ;
|
case FS_EXT3 : return "e2fsprogs" ;
|
||||||
case FS_EXT4 : return "e2fsprogs v1.41+" ;
|
case FS_EXT4 : return "e2fsprogs v1.41+" ;
|
||||||
|
|
61
src/exfat.cc
61
src/exfat.cc
|
@ -16,10 +16,18 @@
|
||||||
|
|
||||||
#include "exfat.h"
|
#include "exfat.h"
|
||||||
#include "FileSystem.h"
|
#include "FileSystem.h"
|
||||||
|
#include "OperationDetail.h"
|
||||||
|
#include "Partition.h"
|
||||||
|
#include "Utils.h"
|
||||||
|
|
||||||
|
#include <glibmm/miscutils.h>
|
||||||
|
#include <glibmm/shell.h>
|
||||||
|
|
||||||
|
|
||||||
namespace GParted
|
namespace GParted
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
FS exfat::get_filesystem_support()
|
FS exfat::get_filesystem_support()
|
||||||
{
|
{
|
||||||
FS fs( FS_EXFAT );
|
FS fs( FS_EXFAT );
|
||||||
|
@ -29,7 +37,60 @@ FS exfat::get_filesystem_support()
|
||||||
fs .move = FS::GPARTED ;
|
fs .move = FS::GPARTED ;
|
||||||
fs .online_read = FS::GPARTED ;
|
fs .online_read = FS::GPARTED ;
|
||||||
|
|
||||||
|
if (! Glib::find_program_in_path("mkfs.exfat").empty())
|
||||||
|
fs.create = FS::EXTERNAL;
|
||||||
|
|
||||||
|
if (! Glib::find_program_in_path("tune.exfat").empty())
|
||||||
|
{
|
||||||
|
fs.read_label = FS::EXTERNAL;
|
||||||
|
fs.write_label = FS::EXTERNAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! Glib::find_program_in_path("fsck.exfat").empty())
|
||||||
|
fs.check = FS::EXTERNAL;
|
||||||
|
|
||||||
return fs;
|
return fs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool exfat::create(const Partition& new_partition, OperationDetail& operationdetail)
|
||||||
|
{
|
||||||
|
return ! execute_command("mkfs.exfat -L " + Glib::shell_quote(new_partition.get_filesystem_label()) +
|
||||||
|
" " + Glib::shell_quote(new_partition.get_path()),
|
||||||
|
operationdetail, EXEC_CHECK_STATUS|EXEC_CANCEL_SAFE);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void exfat::read_label(Partition& partition)
|
||||||
|
{
|
||||||
|
exit_status = Utils::execute_command("tune.exfat -l " + Glib::shell_quote(partition.get_path()),
|
||||||
|
output, error, true);
|
||||||
|
if (exit_status != 0)
|
||||||
|
{
|
||||||
|
if (! output.empty())
|
||||||
|
partition.push_back_message(output);
|
||||||
|
if (! error.empty())
|
||||||
|
partition.push_back_message(error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
partition.set_filesystem_label(Utils::regexp_label(output, "^label: ([^\n]*)"));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool exfat::write_label(const Partition& partition, OperationDetail& operationdetail)
|
||||||
|
{
|
||||||
|
return ! execute_command("tune.exfat -L " + Glib::shell_quote(partition.get_filesystem_label()) +
|
||||||
|
" " + Glib::shell_quote(partition.get_path()),
|
||||||
|
operationdetail, EXEC_CHECK_STATUS|EXEC_CANCEL_SAFE);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool exfat::check_repair(const Partition& partition, OperationDetail& operationdetail)
|
||||||
|
{
|
||||||
|
return ! execute_command("fsck.exfat -v " + Glib::shell_quote(partition.get_path()),
|
||||||
|
operationdetail, EXEC_CHECK_STATUS|EXEC_CANCEL_SAFE);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} //GParted
|
} //GParted
|
||||||
|
|
Loading…
Reference in New Issue