From cb8ff87462e105367f71be79da6f262bca524768 Mon Sep 17 00:00:00 2001 From: Bart Hakvoort Date: Thu, 16 Mar 2006 13:12:01 +0000 Subject: [PATCH] changed statusmessage, fixed issue with exit_status and tested/confirmed * src/ext2.cc, src/ext3.cc, src/fat16.cc, src/fat32.cc, src/jfs.cc, src/ntfs.cc, src/reiser4.cc, src/reiserfs.cc, src/xfs.cc: changed statusmessage, fixed issue with exit_status and tested/confirmed succesfull usage of Partition::get_path() in Set_Used_Sectors() of all filesystems. --- ChangeLog | 14 ++++++++++++++ src/ext2.cc | 9 ++++++--- src/ext3.cc | 12 +++++++----- src/fat16.cc | 7 ++++--- src/fat32.cc | 4 +++- src/jfs.cc | 4 +++- src/ntfs.cc | 4 +++- src/reiser4.cc | 4 +++- src/reiserfs.cc | 5 +++-- src/xfs.cc | 6 ++++-- 10 files changed, 50 insertions(+), 19 deletions(-) diff --git a/ChangeLog b/ChangeLog index fbd58084..7a4a2580 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2006-03-16 Bart Hakvoort + + * src/ext2.cc, + src/ext3.cc, + src/fat16.cc, + src/fat32.cc, + src/jfs.cc, + src/ntfs.cc, + src/reiser4.cc, + src/reiserfs.cc, + src/xfs.cc: changed statusmessage, fixed issue with exit_status and + tested/confirmed succesfull usage of Partition::get_path() in + Set_Used_Sectors() of all filesystems. + 2006-03-15 Bart Hakvoort * include/Device.h, diff --git a/src/ext2.cc b/src/ext2.cc index 27f6b91d..3931db8b 100644 --- a/src/ext2.cc +++ b/src/ext2.cc @@ -136,10 +136,13 @@ bool ext2::Copy( const Glib::ustring & src_part_path, bool ext2::Check_Repair( const Partition & partition, std::vector & operation_details ) { - operation_details .push_back( OperationDetails( _("check filesystem for errors and (if possible) fix them") ) ) ; + operation_details .push_back( OperationDetails( + String::ucompose( _("check filesystem on %1 for errors and (if possible) fix them"), + partition .get_path() ) ) ) ; - if ( 1 >= execute_command( "e2fsck -f -y -v " + partition .get_path(), - operation_details .back() .sub_details ) >= 0 ) + exit_status = execute_command( "e2fsck -f -y -v " + partition .get_path(), + operation_details .back() .sub_details ) ; + if ( exit_status == 0 || exit_status == 1 ) { operation_details .back() .status = OperationDetails::SUCCES ; return true ; diff --git a/src/ext3.cc b/src/ext3.cc index d44dfc00..5b27d538 100644 --- a/src/ext3.cc +++ b/src/ext3.cc @@ -46,7 +46,7 @@ FS ext3::get_filesystem_support() if ( ! Glib::find_program_in_path( "dd" ) .empty() && fs .grow ) fs .copy = GParted::FS::EXTERNAL ; - + return fs ; } @@ -137,11 +137,13 @@ bool ext3::Copy( const Glib::ustring & src_part_path, bool ext3::Check_Repair( const Partition & partition, std::vector & operation_details ) { - operation_details .push_back( OperationDetails( _("check filesystem for errors and (if possible) fix them") ) ) ; - //FIXME: i still need to check if the 1 >= x >= 0 structure actually works! + operation_details .push_back( OperationDetails( + String::ucompose( _("check filesystem on %1 for errors and (if possible) fix them"), + partition .get_path() ) ) ) ; - if ( 1 >= execute_command( "e2fsck -f -y -v " + partition .get_path(), - operation_details .back() .sub_details ) >= 0 ) + exit_status = execute_command( "e2fsck -f -y -v " + partition .get_path(), + operation_details .back() .sub_details ) ; + if ( exit_status == 0 || exit_status == 1 ) { operation_details .back() .status = OperationDetails::SUCCES ; return true ; diff --git a/src/fat16.cc b/src/fat16.cc index 9a0398e0..a1efb958 100644 --- a/src/fat16.cc +++ b/src/fat16.cc @@ -54,8 +54,7 @@ void fat16::Set_Used_Sectors( Partition & partition ) { exit_status = Utils::execute_command( "dosfsck -a -v " + partition .get_path(), output, error, true ) ; if ( exit_status == 0 || exit_status == 1 ) - {//FIXME: does the output of these commands always display the path we've used for the input? - //if not, we need to check for all paths in the output.. + { //free clusters index = output .find( ",", output .find( partition .get_path() ) + partition .get_path() .length() ) +1 ; if ( index < output .length() && sscanf( output .substr( index ) .c_str(), "%Ld/%Ld", &S, &N ) == 2 ) @@ -123,7 +122,9 @@ bool fat16::Copy( const Glib::ustring & src_part_path, bool fat16::Check_Repair( const Partition & partition, std::vector & operation_details ) { - operation_details .push_back( OperationDetails( _("check filesystem for errors and (if possible) fix them") ) ) ; + operation_details .push_back( OperationDetails( + String::ucompose( _("check filesystem on %1 for errors and (if possible) fix them"), + partition .get_path() ) ) ) ; exit_status = execute_command( "dosfsck -a -w -v " + partition .get_path(), operation_details .back() .sub_details ) ; diff --git a/src/fat32.cc b/src/fat32.cc index 8068f8aa..e48f058e 100644 --- a/src/fat32.cc +++ b/src/fat32.cc @@ -121,7 +121,9 @@ bool fat32::Copy( const Glib::ustring & src_part_path, bool fat32::Check_Repair( const Partition & partition, std::vector & operation_details ) { - operation_details .push_back( OperationDetails( _("check filesystem for errors and (if possible) fix them") ) ) ; + operation_details .push_back( OperationDetails( + String::ucompose( _("check filesystem on %1 for errors and (if possible) fix them"), + partition .get_path() ) ) ) ; exit_status = execute_command( "dosfsck -a -w -v " + partition .get_path(), operation_details .back() .sub_details ) ; diff --git a/src/jfs.cc b/src/jfs.cc index e56e681a..24220c71 100644 --- a/src/jfs.cc +++ b/src/jfs.cc @@ -220,7 +220,9 @@ bool jfs::Copy( const Glib::ustring & src_part_path, bool jfs::Check_Repair( const Partition & partition, std::vector & operation_details ) { - operation_details .push_back( OperationDetails( _("check filesystem for errors and (if possible) fix them") ) ) ; + operation_details .push_back( OperationDetails( + String::ucompose( _("check filesystem on %1 for errors and (if possible) fix them"), + partition .get_path() ) ) ) ; exit_status = execute_command( "jfs_fsck -f " + partition .get_path(), operation_details .back() .sub_details ) ; if ( exit_status == 0 || exit_status == 1 ) diff --git a/src/ntfs.cc b/src/ntfs.cc index 39f7fd95..ef604e83 100644 --- a/src/ntfs.cc +++ b/src/ntfs.cc @@ -155,7 +155,9 @@ bool ntfs::Copy( const Glib::ustring & src_part_path, bool ntfs::Check_Repair( const Partition & partition, std::vector & operation_details ) { - operation_details .push_back( OperationDetails( _("check filesystem for errors and (if possible) fix them") ) ) ; + operation_details .push_back( OperationDetails( + String::ucompose( _("check filesystem on %1 for errors and (if possible) fix them"), + partition .get_path() ) ) ) ; if ( ! execute_command( "ntfsresize -P -i -f -v " + partition .get_path(), operation_details .back() .sub_details ) ) diff --git a/src/reiser4.cc b/src/reiser4.cc index 78f55278..7fb8354f 100644 --- a/src/reiser4.cc +++ b/src/reiser4.cc @@ -98,7 +98,9 @@ bool reiser4::Copy( const Glib::ustring & src_part_path, bool reiser4::Check_Repair( const Partition & partition, std::vector & operation_details ) { - operation_details .push_back( OperationDetails( _("check filesystem for errors and (if possible) fix them") ) ) ; + operation_details .push_back( OperationDetails( + String::ucompose( _("check filesystem on %1 for errors and (if possible) fix them"), + partition .get_path() ) ) ) ; if ( ! execute_command( "fsck.reiser4 --yes --fix " + partition .get_path(), operation_details .back() .sub_details ) ) diff --git a/src/reiserfs.cc b/src/reiserfs.cc index 4eca8bdc..efd68086 100644 --- a/src/reiserfs.cc +++ b/src/reiserfs.cc @@ -143,8 +143,9 @@ bool reiserfs::Copy( const Glib::ustring & src_part_path, bool reiserfs::Check_Repair( const Partition & partition, std::vector & operation_details ) { - //FIXME: change this description to 'check filesystem on /dev/blabla for er.. etc..' - operation_details .push_back( OperationDetails( _("check filesystem for errors and (if possible) fix them") ) ) ; + operation_details .push_back( OperationDetails( + String::ucompose( _("check filesystem on %1 for errors and (if possible) fix them"), + partition .get_path() ) ) ) ; exit_status = execute_command( "reiserfsck --y --fix-fixable " + partition .get_path(), operation_details .back() .sub_details ) ; diff --git a/src/xfs.cc b/src/xfs.cc index cbb1743d..7c34447d 100644 --- a/src/xfs.cc +++ b/src/xfs.cc @@ -355,9 +355,11 @@ bool xfs::Copy( const Glib::ustring & src_part_path, bool xfs::Check_Repair( const Partition & partition, std::vector & operation_details ) { - operation_details .push_back( OperationDetails( _("check filesystem for errors and (if possible) fix them") ) ) ; + operation_details .push_back( OperationDetails( + String::ucompose( _("check filesystem on %1 for errors and (if possible) fix them"), + partition .get_path() ) ) ) ; - if ( ! execute_command ( "xfs_repair -v " + partition .get_path(), operation_details .back() .sub_details ) ) + if ( ! execute_command( "xfs_repair -v " + partition .get_path(), operation_details .back() .sub_details ) ) { operation_details .back() .status = OperationDetails::SUCCES ; return true ;