Index: include/Utils.h
===================================================================
--- include/Utils.h	(revisione 1057)
+++ include/Utils.h	(copia locale)
@@ -64,11 +64,12 @@
 	FS_HFS		= 15,
 	FS_HFSPLUS	= 16,
 	FS_UFS		= 17,
+	FS_BTRFS	= 18,
 
-	FS_USED		= 18,
-	FS_UNUSED	= 19,
+	FS_USED		= 19,
+	FS_UNUSED	= 20,
 
-	FS_LVM2		= 20   
+	FS_LVM2		= 21   
 } ;
 
 enum SIZE_UNIT
Index: include/btrfs.h
===================================================================
--- include/btrfs.h	(revisione 0)
+++ include/btrfs.h	(revisione 0)
@@ -0,0 +1,44 @@
+/* Copyright (C) 2009 Luca Bruno <lucab@debian.org>
+ *
+ *  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 BTRFS_H_
+#define BTRFS_H_
+
+#include "../include/FileSystem.h"
+
+namespace GParted
+{
+
+class btrfs : 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 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 //BTRFS_H_
Index: include/Makefile.am
===================================================================
--- include/Makefile.am	(revisione 1057)
+++ include/Makefile.am	(copia locale)
@@ -32,6 +32,7 @@
 	TreeView_Detail.h 		\
 	Utils.h 			\
 	Win_GParted.h 			\
+	btrfs.h				\
 	ext2.h				\
 	ext3.h  			\
 	ext4.h  			\
Index: src/Utils.cc
===================================================================
--- src/Utils.cc	(revisione 1057)
+++ src/Utils.cc	(copia locale)
@@ -85,6 +85,7 @@
 		case FS_HFS			: return "#E0B6AF" ;	//red hilight
 		case FS_HFSPLUS		: return "#C0A39E" ;	// ~ serene red
 		case FS_UFS			: return "#D1940C" ;	//accent yellow dark
+		case FS_BTRFS			: return "#FF9955" ;	//orange
 		case FS_USED		: return "#F8F8BA" ;	// ~ light tan yellow
 		case FS_UNUSED		: return "#FFFFFF" ;	//white
 		case FS_LVM2		: return "#CC9966" ;	// ~ medium brown
@@ -131,6 +132,7 @@
 		case FS_HFS		: return "hfs" ;
 		case FS_HFSPLUS		: return "hfs+" ;
 		case FS_UFS		: return "ufs" ;
+		case FS_BTRFS		: return "btrfs" ;
 		case FS_USED		: return _("used") ;
 		case FS_UNUSED		: return _("unused") ;
 		case FS_LVM2		: return "lvm2" ;
@@ -156,6 +158,7 @@
 		case FS_REISER4     : return "reiser4progs" ;
 		case FS_REISERFS    : return "reiserfsprogs" ;
 		case FS_UFS         : return "" ;
+		case FS_BTRFS       : return "btrfs-tools" ;
 		case FS_XFS         : return "xfsprogs" ;
 
 		default             : return "" ;
Index: src/btrfs.cc
===================================================================
--- src/btrfs.cc	(revisione 0)
+++ src/btrfs.cc	(revisione 0)
@@ -0,0 +1,106 @@
+/* Copyright (C) 2009 Luca Bruno <lucab@debian.org>
+ *
+ *  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/btrfs.h"
+
+namespace GParted
+{
+
+FS btrfs::get_filesystem_support()
+{
+	FS fs ;
+	fs .filesystem = GParted::FS_BTRFS ;
+	
+	if ( ! Glib::find_program_in_path( "btrfs-show" ) .empty() )
+	{
+		fs .read = GParted::FS::EXTERNAL ;
+		fs .read_label = FS::EXTERNAL ;
+	}
+
+	if ( ! Glib::find_program_in_path( "mkfs.btrfs" ) .empty() )
+		fs .create = GParted::FS::EXTERNAL ;
+	
+	if ( ! Glib::find_program_in_path( "btrfsck" ) .empty() )
+		fs .check = GParted::FS::EXTERNAL ;
+		
+	if ( fs .check )
+	{
+		fs .copy = GParted::FS::GPARTED ;
+		fs .move = GParted::FS::GPARTED ;
+	}
+
+	fs .MIN = 256 * MEBIBYTE ;
+	
+	return fs ;
+}
+
+bool btrfs::create( const Partition & new_partition, OperationDetail & operationdetail )
+{
+	return (! execute_command( "mkfs.btrfs -L \"" + new_partition .label + "\" " + new_partition .get_path(), operationdetail ) );
+}
+
+bool btrfs::check_repair( const Partition & partition, OperationDetail & operationdetail )
+{
+	return (! execute_command( "btrfsck " + partition .get_path(), operationdetail )) ;
+}
+
+void btrfs::set_used_sectors( Partition & partition )
+{
+// TODO
+    return;
+}
+
+bool btrfs::write_label( const Partition & partition, OperationDetail & operationdetail )
+{
+// TODO
+        return true ;
+}
+
+bool btrfs::copy( const Glib::ustring & src_part_path,
+                    const Glib::ustring & dest_part_path,
+                    OperationDetail & operationdetail )
+{
+// TODO
+        return true ;
+}
+
+bool btrfs::resize( const Partition & partition_new, OperationDetail & operationdetail, bool fill_partition )
+{
+// TODO
+        return true ;
+}
+
+void btrfs::read_label( Partition & partition )
+{
+        if ( ! Utils::execute_command( "btrfs-show " + partition .get_path(), output, error, true ) )
+        {
+                partition .label = Utils::regexp_label( output, "^Label ([^\n\t]*)" ) ;
+        }
+        else
+        {
+                if ( ! output .empty() )
+                        partition .messages .push_back( output ) ;
+
+                if ( ! error .empty() )
+                        partition .messages .push_back( error ) ;
+        }
+}
+
+} //GParted
+
+
Index: src/GParted_Core.cc
===================================================================
--- src/GParted_Core.cc	(revisione 1057)
+++ src/GParted_Core.cc	(copia locale)
@@ -39,6 +39,7 @@
 #include "../include/hfsplus.h"
 #include "../include/reiser4.h"
 #include "../include/ufs.h"
+#include "../include/btrfs.h"
 
 #include <set>
 #include <cerrno>
@@ -124,6 +125,9 @@
 
 	xfs fs_xfs;
 	FILESYSTEMS .push_back( fs_xfs .get_filesystem_support() ) ;
+	
+	btrfs fs_btrfs;
+	FILESYSTEMS .push_back( fs_btrfs .get_filesystem_support() ) ;
 
 	FS *fs ;
 	//lvm2 physical volume -- not a file system
@@ -779,6 +783,8 @@
 			return GParted::FS_HFSPLUS ;
 		else if ( Glib::ustring( lp_partition ->fs_type ->name ) == "ufs" )
 			return GParted::FS_UFS ;
+		else if ( Glib::ustring( lp_partition ->fs_type ->name ) == "btrfs" )
+			return GParted::FS_BTRFS ;
 	}
 	
 	
@@ -1139,7 +1145,7 @@
 		return true ;
 	}
 	else
-	{		
+	{	
 		operationdetail .get_last_child() .set_status( STATUS_ERROR ) ;	
 		return false ;
 	} 
@@ -2307,6 +2313,7 @@
 		case FS_HFS		: p_filesystem = new hfs() ; 		break ;
 		case FS_HFSPLUS		: p_filesystem = new hfsplus() ; 	break ;
 		case FS_UFS		: p_filesystem = new ufs() ;	 	break ;
+		case FS_BTRFS		: p_filesystem = new btrfs() ;	 	break ;
 
 		default			: p_filesystem = NULL ;
 	}
Index: src/Makefile.am
===================================================================
--- src/Makefile.am	(revisione 1057)
+++ src/Makefile.am	(copia locale)
@@ -41,6 +41,7 @@
 	TreeView_Detail.cc		\
 	Utils.cc			\
 	Win_GParted.cc			\
+	btrfs.cc			\
 	ext2.cc				\
 	ext3.cc				\
 	ext4.cc				\
