Add detection of exfat file systems (#639760)

Note that util-linux v2.18 or higher is required to detect exfat file
systems.

Part of Bug #639760 - exfat / fat64 support
This commit is contained in:
Curtis Gedak 2011-10-22 10:50:34 -06:00
parent 2bcd5d2954
commit 7cbc125a2e
9 changed files with 161 additions and 13 deletions

View File

@ -37,6 +37,7 @@ EXTRA_DIST = \
Utils.h \ Utils.h \
Win_GParted.h \ Win_GParted.h \
btrfs.h \ btrfs.h \
exfat.h \
ext2.h \ ext2.h \
ext3.h \ ext3.h \
ext4.h \ ext4.h \

View File

@ -60,20 +60,21 @@ enum FILESYSTEM
FS_LINUX_SWAP = 8, FS_LINUX_SWAP = 8,
FS_FAT16 = 9, FS_FAT16 = 9,
FS_FAT32 = 10, FS_FAT32 = 10,
FS_NTFS = 11, FS_EXFAT = 11, /* Also known as fat64 */
FS_REISERFS = 12, FS_NTFS = 12,
FS_REISER4 = 13, FS_REISERFS = 13,
FS_XFS = 14, FS_REISER4 = 14,
FS_JFS = 15, FS_XFS = 15,
FS_HFS = 16, FS_JFS = 16,
FS_HFSPLUS = 17, FS_HFS = 17,
FS_UFS = 18, FS_HFSPLUS = 18,
FS_UFS = 19,
FS_USED = 19, FS_USED = 20,
FS_UNUSED = 20, FS_UNUSED = 21,
FS_LVM2 = 21, FS_LVM2 = 22,
FS_LUKS = 22 FS_LUKS = 23
} ; } ;
enum SIZE_UNIT enum SIZE_UNIT

52
include/exfat.h Normal file
View File

@ -0,0 +1,52 @@
/* Copyright (C) 2011 Curtis Gedak
*
* 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 Library 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef EXFAT_H_
#define EXFAT_H_
#include "../include/FileSystem.h"
namespace GParted
{
class exfat : public FileSystem
{
public:
FS get_filesystem_support() ;
void set_used_sectors( Partition & partition ) ;
void read_label( Partition & partition ) ;
bool write_label( const Partition & partition, OperationDetail & operationdetail ) ;
bool create( const Partition & new_partition, OperationDetail & operationdetail ) ;
bool resize( const Partition & partition_new
, OperationDetail & operationdetail
, bool fill_partition = false
) ;
bool move( const Partition & partition_new
, const Partition & partition_old
, OperationDetail & operationdetail
) ;
bool copy( const Glib::ustring & src_part_path
, const Glib::ustring & dest_part_path
, OperationDetail & operationdetail
) ;
bool check_repair( const Partition & partition, OperationDetail & operationdetail ) ;
};
} //GParted
#endif /* EXFAT_H_ */

View File

@ -26,6 +26,7 @@ src/Partition.cc
src/TreeView_Detail.cc src/TreeView_Detail.cc
src/Utils.cc src/Utils.cc
src/Win_GParted.cc src/Win_GParted.cc
src/exfat.cc
src/ext2.cc src/ext2.cc
src/ext3.cc src/ext3.cc
src/fat16.cc src/fat16.cc

View File

@ -1,5 +1,5 @@
/* Copyright (C) 2004-2006 Bart 'plors' Hakvoort /* Copyright (C) 2004-2006 Bart 'plors' Hakvoort
* Copyright (C) 2008, 2009 Curtis Gedak * Copyright (C) 2008, 2009, 2010, 2011 Curtis Gedak
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by

View File

@ -30,6 +30,7 @@
#include "../include/Proc_Partitions_Info.h" #include "../include/Proc_Partitions_Info.h"
#include "../include/btrfs.h" #include "../include/btrfs.h"
#include "../include/exfat.h"
#include "../include/ext2.h" #include "../include/ext2.h"
#include "../include/ext3.h" #include "../include/ext3.h"
#include "../include/ext4.h" #include "../include/ext4.h"
@ -93,6 +94,9 @@ void GParted_Core::find_supported_filesystems()
btrfs fs_btrfs; btrfs fs_btrfs;
FILESYSTEMS .push_back( fs_btrfs .get_filesystem_support() ) ; FILESYSTEMS .push_back( fs_btrfs .get_filesystem_support() ) ;
exfat fs_exfat;
FILESYSTEMS .push_back( fs_exfat .get_filesystem_support() ) ;
ext2 fs_ext2; ext2 fs_ext2;
FILESYSTEMS .push_back( fs_ext2 .get_filesystem_support() ) ; FILESYSTEMS .push_back( fs_ext2 .get_filesystem_support() ) ;
@ -1087,6 +1091,8 @@ GParted::FILESYSTEM GParted_Core::get_filesystem()
return GParted::FS_EXTENDED ; return GParted::FS_EXTENDED ;
else if ( fs_type == "btrfs" ) else if ( fs_type == "btrfs" )
return GParted::FS_BTRFS ; return GParted::FS_BTRFS ;
else if ( fs_type == "exfat" )
return GParted::FS_EXFAT ;
else if ( fs_type == "ext2" ) else if ( fs_type == "ext2" )
return GParted::FS_EXT2 ; return GParted::FS_EXT2 ;
else if ( fs_type == "ext3" ) else if ( fs_type == "ext3" )
@ -1123,6 +1129,7 @@ GParted::FILESYSTEM GParted_Core::get_filesystem()
} }
//other file systems libparted couldn't detect (i've send patches for these file systems to the parted guys) //other file systems libparted couldn't detect (i've send patches for these file systems to the parted guys)
// - no patches sent to parted for lvm2, or luks // - no patches sent to parted for lvm2, or luks

View File

@ -46,6 +46,7 @@ gpartedbin_SOURCES = \
Utils.cc \ Utils.cc \
Win_GParted.cc \ Win_GParted.cc \
btrfs.cc \ btrfs.cc \
exfat.cc \
ext2.cc \ ext2.cc \
ext3.cc \ ext3.cc \
ext4.cc \ ext4.cc \

View File

@ -79,6 +79,7 @@ Glib::ustring Utils::get_color( FILESYSTEM filesystem )
case FS_LINUX_SWAP : return "#C1665A" ; //red medium case FS_LINUX_SWAP : return "#C1665A" ; //red medium
case FS_FAT16 : return "#00FF00" ; //green case FS_FAT16 : return "#00FF00" ; //green
case FS_FAT32 : return "#18D918" ; // ~ medium green case FS_FAT32 : return "#18D918" ; // ~ medium green
case FS_EXFAT : return "#2E8B57" ; // ~ sea green
case FS_NTFS : return "#42E5AC" ; // ~ light turquoise case FS_NTFS : return "#42E5AC" ; // ~ light turquoise
case FS_REISERFS : return "#ADA7C8" ; //purple hilight case FS_REISERFS : return "#ADA7C8" ; //purple hilight
case FS_REISER4 : return "#887FA3" ; //purple medium case FS_REISER4 : return "#887FA3" ; //purple medium
@ -144,6 +145,7 @@ Glib::ustring Utils::get_filesystem_string( FILESYSTEM filesystem )
case FS_LINUX_SWAP : return "linux-swap" ; case FS_LINUX_SWAP : return "linux-swap" ;
case FS_FAT16 : return "fat16" ; case FS_FAT16 : return "fat16" ;
case FS_FAT32 : return "fat32" ; case FS_FAT32 : return "fat32" ;
case FS_EXFAT : return "exfat" ;
case FS_NTFS : return "ntfs" ; case FS_NTFS : return "ntfs" ;
case FS_REISERFS : return "reiserfs" ; case FS_REISERFS : return "reiserfs" ;
case FS_REISER4 : return "reiser4" ; case FS_REISER4 : return "reiser4" ;

83
src/exfat.cc Normal file
View File

@ -0,0 +1,83 @@
/* Copyright (C) 2011 Curtis Gedak
*
* 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 Library 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "../include/exfat.h"
namespace GParted
{
FS exfat::get_filesystem_support()
{
FS fs ;
fs .filesystem = FS_EXFAT ;
fs .copy = FS::GPARTED ;
fs .move = FS::GPARTED ;
return fs ;
}
void exfat::set_used_sectors( Partition & partition )
{
}
void exfat::read_label( Partition & partition )
{
}
bool exfat::write_label( const Partition & partition, OperationDetail & operationdetail )
{
return true ;
}
bool exfat::create( const Partition & new_partition, OperationDetail & operationdetail )
{
return true ;
}
bool exfat::resize( const Partition & partition_new
, OperationDetail & operationdetail
, bool fill_partition )
{
return true ;
}
bool exfat::move( const Partition & partition_new
, const Partition & partition_old
, OperationDetail & operationdetail
)
{
return true ;
}
bool exfat::copy( const Glib::ustring & src_part_path
, const Glib::ustring & dest_part_path
, OperationDetail & operationdetail
)
{
return true ;
}
bool exfat::check_repair( const Partition & partition, OperationDetail & operationdetail )
{
return true ;
}
} //GParted