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.
This commit is contained in:
Bart Hakvoort 2006-03-16 13:12:01 +00:00
parent 1906a3ece8
commit cb8ff87462
10 changed files with 50 additions and 19 deletions

View File

@ -1,3 +1,17 @@
2006-03-16 Bart Hakvoort <hakvoort@cvs.gnome.org>
* 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 <hakvoort@cvs.gnome.org> 2006-03-15 Bart Hakvoort <hakvoort@cvs.gnome.org>
* include/Device.h, * include/Device.h,

View File

@ -136,10 +136,13 @@ bool ext2::Copy( const Glib::ustring & src_part_path,
bool ext2::Check_Repair( const Partition & partition, std::vector<OperationDetails> & operation_details ) bool ext2::Check_Repair( const Partition & partition, std::vector<OperationDetails> & 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(), exit_status = execute_command( "e2fsck -f -y -v " + partition .get_path(),
operation_details .back() .sub_details ) >= 0 ) operation_details .back() .sub_details ) ;
if ( exit_status == 0 || exit_status == 1 )
{ {
operation_details .back() .status = OperationDetails::SUCCES ; operation_details .back() .status = OperationDetails::SUCCES ;
return true ; return true ;

View File

@ -46,7 +46,7 @@ FS ext3::get_filesystem_support()
if ( ! Glib::find_program_in_path( "dd" ) .empty() && fs .grow ) if ( ! Glib::find_program_in_path( "dd" ) .empty() && fs .grow )
fs .copy = GParted::FS::EXTERNAL ; fs .copy = GParted::FS::EXTERNAL ;
return fs ; return fs ;
} }
@ -137,11 +137,13 @@ bool ext3::Copy( const Glib::ustring & src_part_path,
bool ext3::Check_Repair( const Partition & partition, std::vector<OperationDetails> & operation_details ) bool ext3::Check_Repair( const Partition & partition, std::vector<OperationDetails> & operation_details )
{ {
operation_details .push_back( OperationDetails( _("check filesystem for errors and (if possible) fix them") ) ) ; operation_details .push_back( OperationDetails(
//FIXME: i still need to check if the 1 >= x >= 0 structure actually works! 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(), exit_status = execute_command( "e2fsck -f -y -v " + partition .get_path(),
operation_details .back() .sub_details ) >= 0 ) operation_details .back() .sub_details ) ;
if ( exit_status == 0 || exit_status == 1 )
{ {
operation_details .back() .status = OperationDetails::SUCCES ; operation_details .back() .status = OperationDetails::SUCCES ;
return true ; return true ;

View File

@ -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 ) ; exit_status = Utils::execute_command( "dosfsck -a -v " + partition .get_path(), output, error, true ) ;
if ( exit_status == 0 || exit_status == 1 ) 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 //free clusters
index = output .find( ",", output .find( partition .get_path() ) + partition .get_path() .length() ) +1 ; 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 ) 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<OperationDetails> & operation_details ) bool fat16::Check_Repair( const Partition & partition, std::vector<OperationDetails> & 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(), exit_status = execute_command( "dosfsck -a -w -v " + partition .get_path(),
operation_details .back() .sub_details ) ; operation_details .back() .sub_details ) ;

View File

@ -121,7 +121,9 @@ bool fat32::Copy( const Glib::ustring & src_part_path,
bool fat32::Check_Repair( const Partition & partition, std::vector<OperationDetails> & operation_details ) bool fat32::Check_Repair( const Partition & partition, std::vector<OperationDetails> & 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(), exit_status = execute_command( "dosfsck -a -w -v " + partition .get_path(),
operation_details .back() .sub_details ) ; operation_details .back() .sub_details ) ;

View File

@ -220,7 +220,9 @@ bool jfs::Copy( const Glib::ustring & src_part_path,
bool jfs::Check_Repair( const Partition & partition, std::vector<OperationDetails> & operation_details ) bool jfs::Check_Repair( const Partition & partition, std::vector<OperationDetails> & 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 ) ; exit_status = execute_command( "jfs_fsck -f " + partition .get_path(), operation_details .back() .sub_details ) ;
if ( exit_status == 0 || exit_status == 1 ) if ( exit_status == 0 || exit_status == 1 )

View File

@ -155,7 +155,9 @@ bool ntfs::Copy( const Glib::ustring & src_part_path,
bool ntfs::Check_Repair( const Partition & partition, std::vector<OperationDetails> & operation_details ) bool ntfs::Check_Repair( const Partition & partition, std::vector<OperationDetails> & 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(), if ( ! execute_command( "ntfsresize -P -i -f -v " + partition .get_path(),
operation_details .back() .sub_details ) ) operation_details .back() .sub_details ) )

View File

@ -98,7 +98,9 @@ bool reiser4::Copy( const Glib::ustring & src_part_path,
bool reiser4::Check_Repair( const Partition & partition, std::vector<OperationDetails> & operation_details ) bool reiser4::Check_Repair( const Partition & partition, std::vector<OperationDetails> & 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(), if ( ! execute_command( "fsck.reiser4 --yes --fix " + partition .get_path(),
operation_details .back() .sub_details ) ) operation_details .back() .sub_details ) )

View File

@ -143,8 +143,9 @@ bool reiserfs::Copy( const Glib::ustring & src_part_path,
bool reiserfs::Check_Repair( const Partition & partition, std::vector<OperationDetails> & operation_details ) bool reiserfs::Check_Repair( const Partition & partition, std::vector<OperationDetails> & operation_details )
{ {
//FIXME: change this description to 'check filesystem on /dev/blabla for er.. etc..' operation_details .push_back( OperationDetails(
operation_details .push_back( OperationDetails( _("check filesystem for errors and (if possible) fix them") ) ) ; 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(), exit_status = execute_command( "reiserfsck --y --fix-fixable " + partition .get_path(),
operation_details .back() .sub_details ) ; operation_details .back() .sub_details ) ;

View File

@ -355,9 +355,11 @@ bool xfs::Copy( const Glib::ustring & src_part_path,
bool xfs::Check_Repair( const Partition & partition, std::vector<OperationDetails> & operation_details ) bool xfs::Check_Repair( const Partition & partition, std::vector<OperationDetails> & 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 ; operation_details .back() .status = OperationDetails::SUCCES ;
return true ; return true ;