[gparted] Add detection of exfat file systems (#639760)



commit 7cbc125a2e9d26999c18f7a1539d96ed61a81f5c
Author: Curtis Gedak <gedakc gmail com>
Date:   Sat Oct 22 10:50:34 2011 -0600

    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

 include/Makefile.am   |    1 +
 include/Utils.h       |   29 +++++++++--------
 include/exfat.h       |   52 ++++++++++++++++++++++++++++++
 po/POTFILES.in        |    1 +
 src/DialogFeatures.cc |    2 +-
 src/GParted_Core.cc   |    7 ++++
 src/Makefile.am       |    1 +
 src/Utils.cc          |    2 +
 src/exfat.cc          |   83 +++++++++++++++++++++++++++++++++++++++++++++++++
 9 files changed, 163 insertions(+), 15 deletions(-)
---
diff --git a/include/Makefile.am b/include/Makefile.am
index a0ab11d..a894212 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -37,6 +37,7 @@ EXTRA_DIST = \
 	Utils.h 			\
 	Win_GParted.h 			\
 	btrfs.h				\
+	exfat.h				\
 	ext2.h				\
 	ext3.h  			\
 	ext4.h  			\
diff --git a/include/Utils.h b/include/Utils.h
index c255d81..3ab76ae 100644
--- a/include/Utils.h
+++ b/include/Utils.h
@@ -60,20 +60,21 @@ enum FILESYSTEM
 	FS_LINUX_SWAP	= 8,
 	FS_FAT16	= 9,
 	FS_FAT32	= 10,
-	FS_NTFS		= 11,
-	FS_REISERFS	= 12,
-	FS_REISER4	= 13,
-	FS_XFS		= 14,
-	FS_JFS		= 15,
-	FS_HFS		= 16,
-	FS_HFSPLUS	= 17,
-	FS_UFS		= 18,
-
-	FS_USED		= 19,
-	FS_UNUSED	= 20,
-
-	FS_LVM2		= 21,
-	FS_LUKS		= 22
+	FS_EXFAT	= 11, /* Also known as fat64 */
+	FS_NTFS		= 12,
+	FS_REISERFS	= 13,
+	FS_REISER4	= 14,
+	FS_XFS		= 15,
+	FS_JFS		= 16,
+	FS_HFS		= 17,
+	FS_HFSPLUS	= 18,
+	FS_UFS		= 19,
+
+	FS_USED		= 20,
+	FS_UNUSED	= 21,
+
+	FS_LVM2		= 22,
+	FS_LUKS		= 23
 } ;
 
 enum SIZE_UNIT
diff --git a/include/exfat.h b/include/exfat.h
new file mode 100644
index 0000000..eb82f3b
--- /dev/null
+++ b/include/exfat.h
@@ -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_ */
diff --git a/po/POTFILES.in b/po/POTFILES.in
index dc53a29..87b1901 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -26,6 +26,7 @@ src/Partition.cc
 src/TreeView_Detail.cc
 src/Utils.cc
 src/Win_GParted.cc
+src/exfat.cc
 src/ext2.cc
 src/ext3.cc
 src/fat16.cc
diff --git a/src/DialogFeatures.cc b/src/DialogFeatures.cc
index 12ad0c1..a3995f5 100644
--- a/src/DialogFeatures.cc
+++ b/src/DialogFeatures.cc
@@ -1,5 +1,5 @@
 /* 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
  *  it under the terms of the GNU General Public License as published by
diff --git a/src/GParted_Core.cc b/src/GParted_Core.cc
index a39b88f..88139ab 100644
--- a/src/GParted_Core.cc
+++ b/src/GParted_Core.cc
@@ -30,6 +30,7 @@
 #include "../include/Proc_Partitions_Info.h"
 
 #include "../include/btrfs.h"
+#include "../include/exfat.h"
 #include "../include/ext2.h"
 #include "../include/ext3.h"
 #include "../include/ext4.h"
@@ -93,6 +94,9 @@ void GParted_Core::find_supported_filesystems()
 	btrfs fs_btrfs;
 	FILESYSTEMS .push_back( fs_btrfs .get_filesystem_support() ) ;
 
+	exfat fs_exfat;
+	FILESYSTEMS .push_back( fs_exfat .get_filesystem_support() ) ;
+
 	ext2 fs_ext2;
 	FILESYSTEMS .push_back( fs_ext2 .get_filesystem_support() ) ;
 	
@@ -1087,6 +1091,8 @@ GParted::FILESYSTEM GParted_Core::get_filesystem()
 			return GParted::FS_EXTENDED ;
 		else if ( fs_type == "btrfs" )
 			return GParted::FS_BTRFS ;
+		else if ( fs_type == "exfat" )
+			return GParted::FS_EXFAT ;
 		else if ( fs_type == "ext2" )
 			return GParted::FS_EXT2 ;
 		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)
 	// - no patches sent to parted for lvm2, or luks
 
diff --git a/src/Makefile.am b/src/Makefile.am
index 2def664..ff58ba4 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -46,6 +46,7 @@ gpartedbin_SOURCES = \
 	Utils.cc			\
 	Win_GParted.cc			\
 	btrfs.cc			\
+	exfat.cc			\
 	ext2.cc				\
 	ext3.cc				\
 	ext4.cc				\
diff --git a/src/Utils.cc b/src/Utils.cc
index 9e2d34b..1a72a57 100644
--- a/src/Utils.cc
+++ b/src/Utils.cc
@@ -79,6 +79,7 @@ Glib::ustring Utils::get_color( FILESYSTEM filesystem )
 		case FS_LINUX_SWAP	: return "#C1665A" ;	//red medium
 		case FS_FAT16		: return "#00FF00" ;	//green
 		case FS_FAT32		: return "#18D918" ;	// ~ medium green
+		case FS_EXFAT		: return "#2E8B57" ;	// ~ sea green
 		case FS_NTFS		: return "#42E5AC" ;	// ~ light turquoise
 		case FS_REISERFS	: return "#ADA7C8" ;	//purple hilight
 		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_FAT16		: return "fat16" ;
 		case FS_FAT32		: return "fat32" ;
+		case FS_EXFAT		: return "exfat" ;
 		case FS_NTFS		: return "ntfs" ;
 		case FS_REISERFS	: return "reiserfs" ;
 		case FS_REISER4		: return "reiser4" ;
diff --git a/src/exfat.cc b/src/exfat.cc
new file mode 100644
index 0000000..e0dfcff
--- /dev/null
+++ b/src/exfat.cc
@@ -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
+



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]