[gparted/psusi/refactor: 8/19] Flag mkfs and copy operations as safe to cancel (#601239)



commit 255895e453e26bbba57d41014570d1f8a68b6061
Author: Phillip Susi <psusi ubuntu com>
Date:   Mon Jan 28 22:21:14 2013 -0500

    Flag mkfs and copy operations as safe to cancel (#601239)
    
    Closes Bug #601239 - Please allow 'Cancel after current operation'

 src/ext2.cc     |   11 ++++++++---
 src/fat16.cc    |    9 +++++++--
 src/fat32.cc    |    7 +++++--
 src/jfs.cc      |    7 +++++--
 src/ntfs.cc     |   11 +++++++++--
 src/reiser4.cc  |    7 +++++--
 src/reiserfs.cc |    7 +++++--
 src/xfs.cc      |   13 +++++++++----
 8 files changed, 53 insertions(+), 19 deletions(-)
---
diff --git a/src/ext2.cc b/src/ext2.cc
index 56e38eb..2f113b5 100644
--- a/src/ext2.cc
+++ b/src/ext2.cc
@@ -167,7 +167,11 @@ bool ext2::write_uuid( const Partition & partition, OperationDetail & operationd
 
 bool ext2::create( const Partition & new_partition, OperationDetail & operationdetail )
 {
-       return ! execute_command( "mkfs.ext2 -L \"" + new_partition .get_label() + "\" " + new_partition 
.get_path(), operationdetail ) ;
+       return ! execute_command( "mkfs.ext2 -L \"" +
+                                 new_partition.get_label() + "\" " + new_partition.get_path(),
+                                 operationdetail,
+                                 false,
+                                 true );
 }
 
 bool ext2::resize( const Partition & partition_new, OperationDetail & operationdetail, bool fill_partition )
@@ -198,8 +202,9 @@ bool ext2::copy( const Glib::ustring & src_part_path,
 
 bool ext2::check_repair( const Partition & partition, OperationDetail & operationdetail )
 {
-       exit_status = execute_command( "e2fsck -f -y -v " + partition .get_path(), operationdetail ) ;
-       
+       exit_status = execute_command( "e2fsck -f -y -v " + partition.get_path(), operationdetail,
+                                      false, true );
+
        //exitstatus 256 isn't documented, but it's returned when the 'FILE SYSTEM IS MODIFIED'
        //this is quite normal (especially after a copy) so we let the function return true...
        return ( exit_status == 0 || exit_status == 1 || exit_status == 2 || exit_status == 256 ) ;
diff --git a/src/fat16.cc b/src/fat16.cc
index 9e74de3..7be59b6 100644
--- a/src/fat16.cc
+++ b/src/fat16.cc
@@ -227,7 +227,11 @@ bool fat16::write_uuid( const Partition & partition, OperationDetail & operation
 
 bool fat16::create( const Partition & new_partition, OperationDetail & operationdetail )
 {
-       return ! execute_command( "mkdosfs -F16 -v -n \"" + new_partition .get_label() + "\" " + 
new_partition .get_path(), operationdetail ) ;
+       return ! execute_command( "mkdosfs -F16 -v -n \"" + new_partition .get_label() +
+                                 "\" " + new_partition .get_path(),
+                                 operationdetail,
+                                 false,
+                                 true );
 }
 
 bool fat16::resize( const Partition & partition_new, OperationDetail & operationdetail, bool fill_partition )
@@ -252,7 +256,8 @@ bool fat16::copy( const Glib::ustring & src_part_path,
 
 bool fat16::check_repair( const Partition & partition, OperationDetail & operationdetail )
 {
-       exit_status = execute_command( "dosfsck -a -w -v " + partition .get_path(), operationdetail ) ;
+       exit_status = execute_command( "dosfsck -a -w -v " + partition .get_path(), operationdetail,
+                                      false, true );
 
        return ( exit_status == 0 || exit_status == 1 || exit_status == 256 ) ;
 }
diff --git a/src/fat32.cc b/src/fat32.cc
index bdec493..5e4c689 100644
--- a/src/fat32.cc
+++ b/src/fat32.cc
@@ -218,7 +218,9 @@ bool fat32::write_uuid( const Partition & partition, OperationDetail & operation
 
 bool fat32::create( const Partition & new_partition, OperationDetail & operationdetail )
 {
-       return ! execute_command( "mkdosfs -F32 -v -n \"" + new_partition .get_label() + "\" " + 
new_partition .get_path(), operationdetail ) ;
+       return ! execute_command( "mkdosfs -F32 -v -n \"" + new_partition.get_label() +
+                                 "\" " + new_partition.get_path(), operationdetail,
+                                 false, true );
 }
 
 bool fat32::resize( const Partition & partition_new, OperationDetail & operationdetail, bool fill_partition )
@@ -243,7 +245,8 @@ bool fat32::copy( const Glib::ustring & src_part_path,
 
 bool fat32::check_repair( const Partition & partition, OperationDetail & operationdetail )
 {
-       exit_status = execute_command( "dosfsck -a -w -v " + partition .get_path(), operationdetail ) ;
+       exit_status = execute_command( "dosfsck -a -w -v " + partition.get_path(), operationdetail,
+                                      false, true );
 
        return ( exit_status == 0 || exit_status == 1 || exit_status == 256 ) ;
 }
diff --git a/src/jfs.cc b/src/jfs.cc
index 5d8cbf0..ff0d001 100644
--- a/src/jfs.cc
+++ b/src/jfs.cc
@@ -149,7 +149,9 @@ bool jfs::write_uuid( const Partition & partition, OperationDetail & operationde
 
 bool jfs::create( const Partition & new_partition, OperationDetail & operationdetail )
 {
-       return ! execute_command( "mkfs.jfs -q -L \"" + new_partition .get_label() + "\" " + new_partition 
.get_path(), operationdetail ) ;
+       return ! execute_command( "mkfs.jfs -q -L \"" + new_partition.get_label() +
+                                 "\" " + new_partition.get_path(), operationdetail,
+                                 false, true );
 }
 
 bool jfs::resize( const Partition & partition_new, OperationDetail & operationdetail, bool fill_partition )
@@ -193,7 +195,8 @@ bool jfs::copy( const Glib::ustring & src_part_path,
 
 bool jfs::check_repair( const Partition & partition, OperationDetail & operationdetail )
 {
-       exit_status = execute_command( "jfs_fsck -f " + partition .get_path(), operationdetail ) ;
+       exit_status = execute_command( "jfs_fsck -f " + partition.get_path(), operationdetail,
+                                      false, true );
 
        return ( exit_status == 0 || exit_status == 1 ) ;
 }
diff --git a/src/ntfs.cc b/src/ntfs.cc
index 2365fe5..c81d471 100644
--- a/src/ntfs.cc
+++ b/src/ntfs.cc
@@ -177,7 +177,11 @@ bool ntfs::write_uuid( const Partition & partition, OperationDetail & operationd
 
 bool ntfs::create( const Partition & new_partition, OperationDetail & operationdetail )
 {
-       return ! execute_command( "mkntfs -Q -v -L \"" + new_partition .get_label() + "\" " + new_partition 
.get_path(), operationdetail ) ;
+       return ! execute_command( "mkntfs -Q -v -L \"" + new_partition.get_label() +
+                                 "\" " + new_partition.get_path(),
+                                 operationdetail,
+                                 false,
+                                 true );
 }
 
 bool ntfs::resize( const Partition & partition_new, OperationDetail & operationdetail, bool fill_partition )
@@ -232,7 +236,10 @@ bool ntfs::copy( const Glib::ustring & src_part_path,
                 const Glib::ustring & dest_part_path, 
                 OperationDetail & operationdetail )
 {
-       return ! execute_command( "ntfsclone -f --overwrite " + dest_part_path + " " + src_part_path, 
operationdetail ) ;
+       return ! execute_command( "ntfsclone -f --overwrite " + dest_part_path + " " + src_part_path,
+                                 operationdetail,
+                                 false,
+                                 true );
 }
 
 bool ntfs::check_repair( const Partition & partition, OperationDetail & operationdetail )
diff --git a/src/reiser4.cc b/src/reiser4.cc
index 44bbb0c..4099b59 100644
--- a/src/reiser4.cc
+++ b/src/reiser4.cc
@@ -143,7 +143,9 @@ bool reiser4::write_uuid( const Partition & partition, OperationDetail & operati
 
 bool reiser4::create( const Partition & new_partition, OperationDetail & operationdetail )
 {
-       return ! execute_command( "mkfs.reiser4 --yes --label \"" + new_partition .get_label() + "\" " + 
new_partition .get_path(), operationdetail ) ;
+       return ! execute_command( "mkfs.reiser4 --yes --label \"" + new_partition.get_label() +
+                                 "\" " + new_partition.get_path(), operationdetail,
+                                 false, true );
 }
 
 bool reiser4::resize( const Partition & partition_new, OperationDetail & operationdetail, bool 
fill_partition )
@@ -168,7 +170,8 @@ bool reiser4::copy( const Glib::ustring & src_part_path,
 
 bool reiser4::check_repair( const Partition & partition, OperationDetail & operationdetail )
 {
-       return ! execute_command( "fsck.reiser4 --yes --fix --quiet " + partition .get_path(), 
operationdetail ) ;
+       return ! execute_command( "fsck.reiser4 --yes --fix --quiet " + partition.get_path(),
+                                 operationdetail, false, true );
 }
 
 bool reiser4::remove( const Partition & partition, OperationDetail & operationdetail )
diff --git a/src/reiserfs.cc b/src/reiserfs.cc
index 9a9a264..99be6d7 100644
--- a/src/reiserfs.cc
+++ b/src/reiserfs.cc
@@ -149,7 +149,9 @@ bool reiserfs::write_uuid( const Partition & partition, OperationDetail & operat
 
 bool reiserfs::create( const Partition & new_partition, OperationDetail & operationdetail )
 {
-       return ! execute_command( "mkreiserfs -f --label \"" + new_partition .get_label() + "\" " + 
new_partition .get_path(), operationdetail ) ;
+       return ! execute_command( "mkreiserfs -f --label \"" + new_partition.get_label() +
+                                 "\" " + new_partition.get_path(), operationdetail,
+                                 false, true );
 }
 
 bool reiserfs::resize( const Partition & partition_new, OperationDetail & operationdetail, bool 
fill_partition )
@@ -185,7 +187,8 @@ bool reiserfs::copy( const Glib::ustring & src_part_path,
 
 bool reiserfs::check_repair( const Partition & partition, OperationDetail & operationdetail )
 {
-       exit_status = execute_command( "reiserfsck --yes --fix-fixable --quiet " + partition .get_path(), 
operationdetail ) ;
+       exit_status = execute_command( "reiserfsck --yes --fix-fixable --quiet " + partition.get_path(),
+                                      operationdetail, false, true );
        
        return ( exit_status == 0 || exit_status == 1 || exit_status == 256 ) ;
 }
diff --git a/src/xfs.cc b/src/xfs.cc
index ab11102..d62baf3 100644
--- a/src/xfs.cc
+++ b/src/xfs.cc
@@ -164,7 +164,11 @@ bool xfs::write_uuid( const Partition & partition, OperationDetail & operationde
 
 bool xfs::create( const Partition & new_partition, OperationDetail & operationdetail )
 {
-       return ! execute_command( "mkfs.xfs -f -L \"" + new_partition .get_label() + "\" " + new_partition 
.get_path(), operationdetail ) ;
+       return ! execute_command( "mkfs.xfs -f -L \"" + new_partition.get_label() +
+                                 "\" " + new_partition.get_path(),
+                                 operationdetail,
+                                 false,
+                                 true );
 }
 
 bool xfs::resize( const Partition & partition_new, OperationDetail & operationdetail, bool fill_partition )
@@ -204,7 +208,7 @@ bool xfs::copy( const Glib::ustring & src_part_path,
 {
        bool success = true ;
 
-       success &= ! execute_command( "mkfs.xfs -f " + dest_part_path, operationdetail, true ) ;
+       success &= ! execute_command( "mkfs.xfs -f " + dest_part_path, operationdetail, true, true );
        if ( ! success )
                return false ;
 
@@ -231,7 +235,7 @@ bool xfs::copy( const Glib::ustring & src_part_path,
                {
                        success &= ! execute_command( "sh -c 'xfsdump -J - " + src_mount_point +
                                                      " | xfsrestore -J - " + dest_mount_point + "'",
-                                                     operationdetail, true );
+                                                     operationdetail, true, true );
 
                        success &= ! execute_command( "umount -v " + dest_part_path, operationdetail, true ) ;
                }
@@ -248,7 +252,8 @@ bool xfs::copy( const Glib::ustring & src_part_path,
 
 bool xfs::check_repair( const Partition & partition, OperationDetail & operationdetail )
 {
-       return ! execute_command( "xfs_repair -v " + partition .get_path(), operationdetail ) ;
+       return ! execute_command( "xfs_repair -v " + partition .get_path(), operationdetail,
+                                 false, true );
 }
 
 bool xfs::remove( const Partition & partition, OperationDetail & operationdetail )


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