[gparted] Add labelling of btrfs file systems



commit 7ba1d417c5c4a76945ec7253be03460313c5c429
Author: Mike Fleetwood <mike fleetwood googlemail com>
Date:   Tue Nov 1 22:52:33 2011 +0000

    Add labelling of btrfs file systems
    
    Use "btrfs filesystem label" command to set the label of unmounted
    btrfs file systems.

 src/btrfs.cc |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/src/btrfs.cc b/src/btrfs.cc
index e29d913..41d38bf 100644
--- a/src/btrfs.cc
+++ b/src/btrfs.cc
@@ -51,6 +51,13 @@ FS btrfs::get_filesystem_support()
 			fs .shrink = FS::EXTERNAL ;
 	}
 
+	if ( ! Glib::find_program_in_path( "btrfs" ) .empty() )
+	{
+		//Test for labelling capability in btrfs command
+		if ( ! Utils::execute_command( "btrfs filesystem label --help", output, error, true ) )
+			fs .write_label = FS::EXTERNAL;
+	}
+
 	if ( fs .check )
 	{
 		fs .copy = GParted::FS::GPARTED ;
@@ -115,8 +122,7 @@ void btrfs::set_used_sectors( Partition & partition )
 
 bool btrfs::write_label( const Partition & partition, OperationDetail & operationdetail )
 {
-// TODO
-        return true ;
+	return ! execute_command( "btrfs filesystem label " + partition .get_path() + " \"" + partition .label + "\"", operationdetail ) ;
 }
 
 bool btrfs::move( const Partition & partition_new



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