[gparted/psusi/refactor] fixup! Reduce threading (#685740)



commit 2271ca67e5f75b4d7288f133bc67b9e9c07ac54c
Author: Phillip Susi <psusi ubuntu com>
Date:   Thu Feb 28 19:38:06 2013 -0500

    fixup! Reduce threading (#685740)
    
    Shrinking a partition containing a reiserfs file system was actually
    corrupting it.  It was first maximising the file system to fill the
    initial larger size and then shrinking the partition.  Example command:
    
        # sh -c 'echo y | resize_resierfs /dev/sda8' -s 1073741823
    
    Fix by including the size specification inside the single quoted command
    passed to the shell to execute.  Also move the size option to before the
    device parameter to match the ordering documented in the manual page.
    Example fixed command:
    
        # sh -c 'echo y | resize_resierfs -s 1073741823 /dev/sda8'

 src/reiserfs.cc |   11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)
---
diff --git a/src/reiserfs.cc b/src/reiserfs.cc
index b546646..50a35ba 100644
--- a/src/reiserfs.cc
+++ b/src/reiserfs.cc
@@ -156,16 +156,15 @@ bool reiserfs::create( const Partition & new_partition, OperationDetail & operat
 
 bool reiserfs::resize( const Partition & partition_new, OperationDetail & operationdetail, bool 
fill_partition )
 { 
-       Glib::ustring str_temp = "sh -c 'echo y | resize_reiserfs " + partition_new.get_path() + "'";
-       
+       Glib::ustring size = "" ;
        if ( ! fill_partition )
        {
-               str_temp += " -s " ;
-               str_temp += Utils::num_to_str( Utils::round( Utils::sector_to_unit(
-                               partition_new .get_sector_length(), partition_new .sector_size, UNIT_BYTE ) ) 
-1 ) ;
+               size = " -s " + Utils::num_to_str( Utils::round( Utils::sector_to_unit(
+                                  partition_new .get_sector_length(), partition_new .sector_size, UNIT_BYTE 
) ) -1 ) ;
        }
+       Glib::ustring cmd = "sh -c 'echo y | resize_reiserfs" + size + " " + partition_new .get_path() + "'" ;
 
-       exit_status = execute_command( str_temp, operationdetail ) ;
+       exit_status = execute_command( cmd, operationdetail ) ;
 
        return ( exit_status == 0 || exit_status == 256 ) ;
 }


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