From 2d7fb5700be4da994ffc9b42785d897b79e1696c Mon Sep 17 00:00:00 2001 From: Bart Hakvoort Date: Sat, 17 Jun 2006 16:38:15 +0000 Subject: [PATCH] more cleanups in the core and the fs'es (these changelogs are getting * more cleanups in the core and the fs'es (these changelogs are getting boring ;^) ) --- ChangeLog | 5 +++ include/GParted_Core.h | 2 + src/GParted_Core.cc | 42 ++++++++++------- src/ext2.cc | 33 ++------------ src/ext3.cc | 33 ++------------ src/fat16.cc | 23 ++-------- src/fat32.cc | 23 ++-------- src/hfs.cc | 11 +---- src/jfs.cc | 23 ++-------- src/linux_swap.cc | 11 +---- src/ntfs.cc | 34 ++------------ src/reiser4.cc | 22 +-------- src/reiserfs.cc | 35 +++------------ src/xfs.cc | 100 +++++++++++++++++------------------------ 14 files changed, 102 insertions(+), 295 deletions(-) diff --git a/ChangeLog b/ChangeLog index 75d818db..90b34fd7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2006-06-17 Bart Hakvoort + + * more cleanups in the core and the fs'es (these changelogs are + getting boring ;^) ) + 2006-06-17 Bart Hakvoort * cleanups in the core and the fs'es (resize) diff --git a/include/GParted_Core.h b/include/GParted_Core.h index 768cc9b0..1565deab 100644 --- a/include/GParted_Core.h +++ b/include/GParted_Core.h @@ -70,6 +70,8 @@ private: std::vector & operation_details, Sector cylinder_size = 0, bool fill_partition = false ) ; + bool maximize_filesystem( const Partition & partition, + std::vector & operation_details ) ; bool copy( const Partition & partition_src, Partition & partition_dest, diff --git a/src/GParted_Core.cc b/src/GParted_Core.cc index 4f2d6dab..9ef52afd 100644 --- a/src/GParted_Core.cc +++ b/src/GParted_Core.cc @@ -908,7 +908,7 @@ bool GParted_Core::resize( const Device & device, succes = false ; //expand filesystem to fit exactly in partition - if ( ! resize_filesystem( partition_old, partition_new, operation_details, device .cylsize, true ) ) + if ( ! maximize_filesystem( partition_new, operation_details ) ) succes = false ; if ( ! check_repair( partition_new, operation_details ) ) @@ -926,15 +926,16 @@ bool GParted_Core::resize_filesystem( const Partition & partition_old, Sector cylinder_size, bool fill_partition ) { - if ( fill_partition ) - operation_details .push_back( OperationDetails( _("grow filesystem to fill the partition") ) ) ; - else if ( partition_new .get_length() < partition_old .get_length() ) - operation_details .push_back( OperationDetails( _("shrink filesystem") ) ) ; - else if ( partition_new .get_length() > partition_old .get_length() ) - operation_details .push_back( OperationDetails( _("grow filesystem") ) ) ; - else - operation_details .push_back( - OperationDetails( _("new and old partition have the same size. continuing anyway") ) ) ; + if ( ! fill_partition ) + { + if ( partition_new .get_length() < partition_old .get_length() ) + operation_details .push_back( OperationDetails( _("shrink filesystem") ) ) ; + else if ( partition_new .get_length() > partition_old .get_length() ) + operation_details .push_back( OperationDetails( _("grow filesystem") ) ) ; + else + operation_details .push_back( + OperationDetails( _("new and old partition have the same size. continuing anyway") ) ) ; + } set_proper_filesystem( partition_new .filesystem, cylinder_size ) ; if ( p_filesystem && p_filesystem ->Resize( partition_new, operation_details .back() .sub_details, fill_partition ) ) @@ -948,6 +949,14 @@ bool GParted_Core::resize_filesystem( const Partition & partition_old, return false ; } } + +bool GParted_Core::maximize_filesystem( const Partition & partition, + std::vector & operation_details ) +{ + operation_details .push_back( OperationDetails( _("grow filesystem to fill the partition") ) ) ; + + return resize_filesystem( partition, partition, operation_details, 0, true ) ; +} bool GParted_Core::copy( const Partition & partition_src, Partition & partition_dest, @@ -968,7 +977,6 @@ bool GParted_Core::copy( const Partition & partition_src, partition_src .get_path(), partition_dest .get_path() ) ) ) ; - set_proper_filesystem( partition_dest .filesystem ) ; switch ( get_fs( partition_dest .filesystem ) .copy ) { @@ -984,19 +992,23 @@ bool GParted_Core::copy( const Partition & partition_src, break ; case GParted::FS::EXTERNAL : - succes = p_filesystem ->Copy( partition_src .get_path(), + set_proper_filesystem( partition_dest .filesystem ) ; + succes = p_filesystem && + p_filesystem ->Copy( partition_src .get_path(), partition_dest .get_path(), - operation_details ) ; + operation_details .back() .sub_details ) ; break ; default : succes = false ; break ; } - + + operation_details .back() .status = succes ? OperationDetails::SUCCES : OperationDetails::ERROR ; + return ( succes && check_repair( partition_dest, operation_details ) && - p_filesystem ->Resize( partition_dest, operation_details, true ) && + maximize_filesystem( partition_dest, operation_details ) && check_repair( partition_dest, operation_details ) ) ; } } diff --git a/src/ext2.cc b/src/ext2.cc index 330e8d31..18aaf6a6 100644 --- a/src/ext2.cc +++ b/src/ext2.cc @@ -75,16 +75,7 @@ void ext2::Set_Used_Sectors( Partition & partition ) bool ext2::Create( const Partition & new_partition, std::vector & operation_details ) { - if ( ! execute_command( "mkfs.ext2 " + new_partition .get_path(), operation_details ) ) - { - operation_details .back() .status = OperationDetails::SUCCES ; - return true ; - } - else - { - operation_details .back() .status = OperationDetails::ERROR ; - return false ; - } + return ! execute_command( "mkfs.ext2 " + new_partition .get_path(), operation_details ) ; } bool ext2::Resize( const Partition & partition_new, @@ -97,16 +88,7 @@ bool ext2::Resize( const Partition & partition_new, str_temp += " " + Utils::num_to_str( Utils::round( Utils::sector_to_unit( partition_new .get_length() - cylinder_size, GParted::UNIT_MIB ) ), true ) + "M" ; - if ( ! execute_command( str_temp, operation_details ) ) - { - operation_details .back() .status = OperationDetails::SUCCES ; - return true ; - } - else - { - operation_details .back() .status = OperationDetails::ERROR ; - return false ; - } + return ! execute_command( str_temp, operation_details ) ; } bool ext2::Copy( const Glib::ustring & src_part_path, @@ -122,16 +104,7 @@ bool ext2::Check_Repair( const Partition & partition, std::vector & operation_details ) { - if ( ! execute_command( "mkfs.ext3 " + new_partition .get_path(), operation_details ) ) - { - operation_details .back() .status = OperationDetails::SUCCES ; - return true ; - } - else - { - operation_details .back() .status = OperationDetails::ERROR ; - return false ; - } + return ! execute_command( "mkfs.ext3 " + new_partition .get_path(), operation_details ) ; } bool ext3::Resize( const Partition & partition_new, @@ -92,16 +83,7 @@ bool ext3::Resize( const Partition & partition_new, str_temp += " " + Utils::num_to_str( Utils::round( Utils::sector_to_unit( partition_new .get_length() - cylinder_size, GParted::UNIT_MIB ) ), true ) + "M" ; - if ( ! execute_command( str_temp, operation_details ) ) - { - operation_details .back() .status = OperationDetails::SUCCES ; - return true ; - } - else - { - operation_details .back() .status = OperationDetails::ERROR ; - return false ; - } + return ! execute_command( str_temp, operation_details ) ; } bool ext3::Copy( const Glib::ustring & src_part_path, @@ -117,16 +99,7 @@ bool ext3::Check_Repair( const Partition & partition, std::vector & operation_details ) { - if ( ! execute_command( "mkdosfs -F16 -v " + new_partition .get_path(), operation_details ) ) - { - operation_details .back() .status = OperationDetails::SUCCES ; - return true ; - } - else - { - operation_details .back() .status = OperationDetails::ERROR ; - return false ; - } + return ! execute_command( "mkdosfs -F16 -v " + new_partition .get_path(), operation_details ) ; } bool fat16::Resize( const Partition & partition_new, @@ -104,16 +95,8 @@ bool fat16::Copy( const Glib::ustring & src_part_path, bool fat16::Check_Repair( const Partition & partition, std::vector & operation_details ) { exit_status = execute_command( "dosfsck -a -w -v " + partition .get_path(), operation_details ) ; - if ( exit_status == 0 || exit_status == 1 ) - { - operation_details .back() .status = OperationDetails::SUCCES ; - return true ; - } - else - { - operation_details .back() .status = OperationDetails::ERROR ; - return false ; - } + + return ( exit_status == 0 || exit_status == 1 ) ; } } //GParted diff --git a/src/fat32.cc b/src/fat32.cc index c3769e08..85f330ea 100644 --- a/src/fat32.cc +++ b/src/fat32.cc @@ -76,16 +76,7 @@ void fat32::Set_Used_Sectors( Partition & partition ) bool fat32::Create( const Partition & new_partition, std::vector & operation_details ) { - if ( ! execute_command( "mkdosfs -F32 -v " + new_partition .get_path(), operation_details ) ) - { - operation_details .back() .status = OperationDetails::SUCCES ; - return true ; - } - else - { - operation_details .back() .status = OperationDetails::ERROR ; - return false ; - } + return ! execute_command( "mkdosfs -F32 -v " + new_partition .get_path(), operation_details ) ; } bool fat32::Resize( const Partition & partition_new, @@ -105,16 +96,8 @@ bool fat32::Copy( const Glib::ustring & src_part_path, bool fat32::Check_Repair( const Partition & partition, std::vector & operation_details ) { exit_status = execute_command( "dosfsck -a -w -v " + partition .get_path(), operation_details ) ; - if ( exit_status == 0 || exit_status == 1 ) - { - operation_details .back() .status = OperationDetails::SUCCES ; - return true ; - } - else - { - operation_details .back() .status = OperationDetails::ERROR ; - return false ; - } + + return ( exit_status == 0 || exit_status == 1 ) ; } } //GParted diff --git a/src/hfs.cc b/src/hfs.cc index 8024c1fd..fe4492d8 100644 --- a/src/hfs.cc +++ b/src/hfs.cc @@ -46,16 +46,7 @@ void hfs::Set_Used_Sectors( Partition & partition ) bool hfs::Create( const Partition & new_partition, std::vector & operation_details ) { - if ( ! execute_command( "hformat " + new_partition .get_path(), operation_details ) ) - { - operation_details .back() .status = OperationDetails::SUCCES ; - return true ; - } - else - { - operation_details .back() .status = OperationDetails::ERROR ; - return false ; - } + return ! execute_command( "hformat " + new_partition .get_path(), operation_details ) ; } bool hfs::Resize( const Partition & partition_new, diff --git a/src/jfs.cc b/src/jfs.cc index c57fb685..e7315ee6 100644 --- a/src/jfs.cc +++ b/src/jfs.cc @@ -91,16 +91,7 @@ void jfs::Set_Used_Sectors( Partition & partition ) bool jfs::Create( const Partition & new_partition, std::vector & operation_details ) { - if ( ! execute_command( "mkfs.jfs -q " + new_partition .get_path(), operation_details ) ) - { - operation_details .back() .status = OperationDetails::SUCCES ; - return true ; - } - else - { - operation_details .back() .status = OperationDetails::ERROR ; - return false ; - } + return ! execute_command( "mkfs.jfs -q " + new_partition .get_path(), operation_details ) ; } bool jfs::Resize( const Partition & partition_new, @@ -200,16 +191,8 @@ bool jfs::Copy( const Glib::ustring & src_part_path, bool jfs::Check_Repair( const Partition & partition, std::vector & operation_details ) { exit_status = execute_command( "jfs_fsck -f " + partition .get_path(), operation_details ) ; - if ( exit_status == 0 || exit_status == 1 ) - { - operation_details .back() .status = OperationDetails::SUCCES ; - return true ; - } - else - { - operation_details .back() .status = OperationDetails::ERROR ; - return false ; - } + + return ( exit_status == 0 || exit_status == 1 ) ; } } //GParted diff --git a/src/linux_swap.cc b/src/linux_swap.cc index 7dad99aa..646b1401 100644 --- a/src/linux_swap.cc +++ b/src/linux_swap.cc @@ -45,16 +45,7 @@ void linux_swap::Set_Used_Sectors( Partition & partition ) bool linux_swap::Create( const Partition & new_partition, std::vector & operation_details ) { - if ( ! execute_command( "mkswap " + new_partition .get_path(), operation_details ) ) - { - operation_details .back() .status = OperationDetails::SUCCES ; - return true ; - } - else - { - operation_details .back() .status = OperationDetails::ERROR ; - return false ; - } + return ! execute_command( "mkswap " + new_partition .get_path(), operation_details ) ; } bool linux_swap::Resize( const Partition & partition_new, diff --git a/src/ntfs.cc b/src/ntfs.cc index 719715ab..f59caae9 100644 --- a/src/ntfs.cc +++ b/src/ntfs.cc @@ -69,16 +69,7 @@ void ntfs::Set_Used_Sectors( Partition & partition ) bool ntfs::Create( const Partition & new_partition, std::vector & operation_details ) { - if ( ! execute_command( "mkntfs -Q -vv " + new_partition .get_path(), operation_details ) ) - { - operation_details .back() .status = OperationDetails::SUCCES ; - return true ; - } - else - { - operation_details .back() .status = OperationDetails::ERROR ; - return false ; - } + return ! execute_command( "mkntfs -Q -vv " + new_partition .get_path(), operation_details ) ; } bool ntfs::Resize( const Partition & partition_new, @@ -127,31 +118,12 @@ bool ntfs::Copy( const Glib::ustring & src_part_path, const Glib::ustring & dest_part_path, std::vector & operation_details ) { - if ( ! execute_command( "ntfsclone -f --overwrite " + dest_part_path + " " + src_part_path, - operation_details .back() .sub_details ) ) - { - operation_details .back() .status = OperationDetails::SUCCES ; - return true ; - } - else - { - operation_details .back() .status = OperationDetails::ERROR ; - return false ; - } + return ! execute_command( "ntfsclone -f --overwrite " + dest_part_path + " " + src_part_path, operation_details ) ; } bool ntfs::Check_Repair( const Partition & partition, std::vector & operation_details ) { - if ( ! execute_command( "ntfsresize -P -i -f -v " + partition .get_path(), operation_details ) ) - { - operation_details .back() .status = OperationDetails::SUCCES ; - return true ; - } - else - { - operation_details .back() .status = OperationDetails::ERROR ; - return false ; - } + return ! execute_command( "ntfsresize -P -i -f -v " + partition .get_path(), operation_details ) ; } } //GParted diff --git a/src/reiser4.cc b/src/reiser4.cc index 7fca06e0..7f69c3c1 100644 --- a/src/reiser4.cc +++ b/src/reiser4.cc @@ -68,16 +68,7 @@ void reiser4::Set_Used_Sectors( Partition & partition ) bool reiser4::Create( const Partition & new_partition, std::vector & operation_details ) { - if ( ! execute_command( "mkfs.reiser4 --yes " + new_partition .get_path(), operation_details ) ) - { - operation_details .back() .status = OperationDetails::SUCCES ; - return true ; - } - else - { - operation_details .back() .status = OperationDetails::ERROR ; - return false ; - } + return ! execute_command( "mkfs.reiser4 --yes " + new_partition .get_path(), operation_details ) ; } bool reiser4::Resize( const Partition & partition_new, @@ -96,16 +87,7 @@ bool reiser4::Copy( const Glib::ustring & src_part_path, bool reiser4::Check_Repair( const Partition & partition, std::vector & operation_details ) { - if ( ! execute_command( "fsck.reiser4 --yes --fix " + partition .get_path(), operation_details ) ) - { - operation_details .back() .status = OperationDetails::SUCCES ; - return true ; - } - else - { - operation_details .back() .status = OperationDetails::ERROR ; - return false ; - } + return ! execute_command( "fsck.reiser4 --yes --fix " + partition .get_path(), operation_details ) ; } } //GParted diff --git a/src/reiserfs.cc b/src/reiserfs.cc index 29bdd9e6..4b62c761 100644 --- a/src/reiserfs.cc +++ b/src/reiserfs.cc @@ -73,16 +73,7 @@ void reiserfs::Set_Used_Sectors( Partition & partition ) bool reiserfs::Create( const Partition & new_partition, std::vector & operation_details ) { - if ( ! execute_command( "mkreiserfs -f " + new_partition .get_path(), operation_details ) ) - { - operation_details .back() .status = OperationDetails::SUCCES ; - return true ; - } - else - { - operation_details .back() .status = OperationDetails::ERROR ; - return false ; - } + return ! execute_command( "mkreiserfs -f " + new_partition .get_path(), operation_details ) ; } bool reiserfs::Resize( const Partition & partition_new, @@ -99,16 +90,8 @@ bool reiserfs::Resize( const Partition & partition_new, } exit_status = execute_command( str_temp, operation_details ) ; - if ( exit_status == 0 || exit_status == 256 ) - { - operation_details .back() .status = OperationDetails::SUCCES ; - return true ; - } - else - { - operation_details .back() .status = OperationDetails::ERROR ; - return false ; - } + + return ( exit_status == 0 || exit_status == 256 ) ; } bool reiserfs::Copy( const Glib::ustring & src_part_path, @@ -121,16 +104,8 @@ bool reiserfs::Copy( const Glib::ustring & src_part_path, bool reiserfs::Check_Repair( const Partition & partition, std::vector & operation_details ) { exit_status = execute_command( "reiserfsck --y --fix-fixable " + partition .get_path(), operation_details ) ; - if ( exit_status == 0 || exit_status == 1 || exit_status == 256 ) - { - operation_details .back() .status = OperationDetails::SUCCES ; - return true ; - } - else - { - operation_details .back() .status = OperationDetails::ERROR ; - return false ; - } + + return ( exit_status == 0 || exit_status == 1 || exit_status == 256 ) ; } } //GParted diff --git a/src/xfs.cc b/src/xfs.cc index ef12630e..80bf399e 100644 --- a/src/xfs.cc +++ b/src/xfs.cc @@ -93,16 +93,7 @@ void xfs::Set_Used_Sectors( Partition & partition ) bool xfs::Create( const Partition & new_partition, std::vector & operation_details ) { - if ( ! execute_command( "mkfs.xfs -f " + new_partition .get_path(), operation_details ) ) - { - operation_details .back() .status = OperationDetails::SUCCES ; - return true ; - } - else - { - operation_details .back() .status = OperationDetails::ERROR ; - return false ; - } + return ! execute_command( "mkfs.xfs -f " + new_partition .get_path(), operation_details ) ; } bool xfs::Resize( const Partition & partition_new, @@ -200,106 +191,107 @@ bool xfs::Copy( const Glib::ustring & src_part_path, //create xfs filesystem on destination.. Partition partition( dest_part_path ) ; - if ( Create( partition, operation_details .back() .sub_details ) ) + if ( Create( partition, operation_details ) ) { //create source mountpoint... - operation_details .back() .sub_details .push_back( + operation_details .push_back( OperationDetails( String::ucompose( _("create temporary mountpoint (%1)"), SRC ) ) ) ; if ( ! mkdir( SRC .c_str(), 0 ) ) { - operation_details .back() .sub_details .back() .status = OperationDetails::SUCCES ; + operation_details .back() .status = OperationDetails::SUCCES ; //create destination mountpoint... - operation_details .back() .sub_details .push_back( + operation_details .push_back( OperationDetails( String::ucompose( _("create temporary mountpoint (%1)"), DST ) ) ) ; if ( ! mkdir( DST .c_str(), 0 ) ) { - operation_details .back() .sub_details .back() .status = OperationDetails::SUCCES ; + operation_details .back() .status = OperationDetails::SUCCES ; //mount source partition - operation_details .back() .sub_details .push_back( + operation_details .push_back( OperationDetails( String::ucompose( _("mount %1 on %2"), src_part_path, SRC ) ) ) ; if ( ! execute_command( "mount -v -t xfs -o noatime,ro " + src_part_path + " " + SRC, - operation_details .back() .sub_details .back() .sub_details ) ) + operation_details .back() .sub_details ) ) { - operation_details .back() .sub_details .back() .status = OperationDetails::SUCCES ; + operation_details .back() .status = OperationDetails::SUCCES ; //mount destination partition - operation_details .back() .sub_details .push_back( + operation_details .push_back( OperationDetails( String::ucompose( _("mount %1 on %2"), dest_part_path, DST ) ) ) ; if ( ! execute_command( "mount -v -t xfs " + dest_part_path + " " + DST, - operation_details .back() .sub_details .back() .sub_details ) ) + operation_details .back() .sub_details ) ) { - operation_details .back() .sub_details .back() .status = OperationDetails::SUCCES ; + operation_details .back() .status = OperationDetails::SUCCES ; //copy filesystem.. - operation_details .back() .sub_details .push_back( OperationDetails( _("copy filesystem") ) ) ; + operation_details .push_back( OperationDetails( _("copy filesystem") ) ) ; if ( ! execute_command( "xfsdump -J - " + SRC + " | xfsrestore -J - " + DST, - operation_details .back() .sub_details .back() .sub_details ) ) + operation_details .back() .sub_details ) ) { - operation_details .back() .sub_details .back() .status = OperationDetails::SUCCES ; + operation_details .back() .status = OperationDetails::SUCCES ; return_value = true ; } else { - operation_details .back() .sub_details .back() .status = OperationDetails::ERROR ; + operation_details .back() .status = OperationDetails::ERROR ; } //unmount destination partition - operation_details .back() .sub_details .push_back( - OperationDetails( String::ucompose( _("unmount %1"), dest_part_path ) ) ) ; + operation_details .push_back( + OperationDetails( String::ucompose( _("unmount %1"), + dest_part_path ) ) ) ; if ( ! execute_command( "umount -v " + dest_part_path, - operation_details .back() .sub_details .back() .sub_details ) ) + operation_details .back() .sub_details ) ) { - operation_details .back() .sub_details .back() .status = OperationDetails::SUCCES ; + operation_details .back() .status = OperationDetails::SUCCES ; } else { - operation_details .back() .sub_details .back() .status = OperationDetails::ERROR ; + operation_details .back() .status = OperationDetails::ERROR ; return_value = false ; } } else { - operation_details .back() .sub_details .back() .status = OperationDetails::ERROR ; + operation_details .back() .status = OperationDetails::ERROR ; } //unmount source partition - operation_details .back() .sub_details .push_back( + operation_details .push_back( OperationDetails( String::ucompose( _("unmount %1"), src_part_path ) ) ) ; if ( ! execute_command( "umount -v " + src_part_path, - operation_details .back() .sub_details .back() .sub_details ) ) + operation_details .back() .sub_details ) ) { - operation_details .back() .sub_details .back() .status = OperationDetails::SUCCES ; + operation_details .back() .status = OperationDetails::SUCCES ; } else { - operation_details .back() .sub_details .back() .status = OperationDetails::ERROR ; + operation_details .back() .status = OperationDetails::ERROR ; return_value = false ; } } else { - operation_details .back() .sub_details .back() .status = OperationDetails::ERROR ; + operation_details .back() .status = OperationDetails::ERROR ; } //remove destination mountpoint.. - operation_details .back() .sub_details .push_back( + operation_details .push_back( OperationDetails( String::ucompose( _("remove temporary mountpoint (%1)"), DST ) ) ) ; if ( ! rmdir( DST .c_str() ) ) { - operation_details .back() .sub_details .back() .status = OperationDetails::SUCCES ; + operation_details .back() .status = OperationDetails::SUCCES ; } else { - operation_details .back() .sub_details .back() .status = OperationDetails::ERROR ; - operation_details .back() .sub_details .back() .sub_details .push_back( + operation_details .back() .status = OperationDetails::ERROR ; + operation_details .back() .sub_details .push_back( OperationDetails( Glib::strerror( errno ), OperationDetails::NONE ) ) ; return_value = false ; @@ -307,22 +299,22 @@ bool xfs::Copy( const Glib::ustring & src_part_path, } else { - operation_details .back() .sub_details .back() .status = OperationDetails::ERROR ; - operation_details .back() .sub_details .back() .sub_details .push_back( + operation_details .back() .status = OperationDetails::ERROR ; + operation_details .back() .sub_details .push_back( OperationDetails( Glib::strerror( errno ), OperationDetails::NONE ) ) ; } //remove source mountpoint.. - operation_details .back() .sub_details .push_back( + operation_details .push_back( OperationDetails( String::ucompose( _("remove temporary mountpoint (%1)"), SRC ) ) ) ; if ( ! rmdir( SRC .c_str() ) ) { - operation_details .back() .sub_details .back() .status = OperationDetails::SUCCES ; + operation_details .back() .status = OperationDetails::SUCCES ; } else { - operation_details .back() .sub_details .back() .status = OperationDetails::ERROR ; - operation_details .back() .sub_details .back() .sub_details .push_back( + operation_details .back() .status = OperationDetails::ERROR ; + operation_details .back() .sub_details .push_back( OperationDetails( Glib::strerror( errno ), OperationDetails::NONE ) ) ; return_value = false ; @@ -330,28 +322,18 @@ bool xfs::Copy( const Glib::ustring & src_part_path, } else { - operation_details .back() .sub_details .back() .status = OperationDetails::ERROR ; - operation_details .back() .sub_details .back() .sub_details .push_back( + operation_details .back() .status = OperationDetails::ERROR ; + operation_details .back() .sub_details .push_back( OperationDetails( Glib::strerror( errno ), OperationDetails::NONE ) ) ; } } - operation_details .back() .status = return_value ? OperationDetails::SUCCES : OperationDetails::ERROR ; return return_value ; } bool xfs::Check_Repair( const Partition & partition, std::vector & operation_details ) { - if ( ! execute_command( "xfs_repair -v " + partition .get_path(), operation_details ) ) - { - operation_details .back() .status = OperationDetails::SUCCES ; - return true ; - } - else - { - operation_details .back() .status = OperationDetails::ERROR ; - return false ; - } + return ! execute_command( "xfs_repair -v " + partition .get_path(), operation_details ) ; } } //GParted