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 ;^) )
This commit is contained in:
parent
08245cd08c
commit
2d7fb5700b
|
@ -1,3 +1,8 @@
|
||||||
|
2006-06-17 Bart Hakvoort <hakvoort@cvs.gnome.org>
|
||||||
|
|
||||||
|
* more cleanups in the core and the fs'es (these changelogs are
|
||||||
|
getting boring ;^) )
|
||||||
|
|
||||||
2006-06-17 Bart Hakvoort <hakvoort@cvs.gnome.org>
|
2006-06-17 Bart Hakvoort <hakvoort@cvs.gnome.org>
|
||||||
|
|
||||||
* cleanups in the core and the fs'es (resize)
|
* cleanups in the core and the fs'es (resize)
|
||||||
|
|
|
@ -70,6 +70,8 @@ private:
|
||||||
std::vector<OperationDetails> & operation_details,
|
std::vector<OperationDetails> & operation_details,
|
||||||
Sector cylinder_size = 0,
|
Sector cylinder_size = 0,
|
||||||
bool fill_partition = false ) ;
|
bool fill_partition = false ) ;
|
||||||
|
bool maximize_filesystem( const Partition & partition,
|
||||||
|
std::vector<OperationDetails> & operation_details ) ;
|
||||||
|
|
||||||
bool copy( const Partition & partition_src,
|
bool copy( const Partition & partition_src,
|
||||||
Partition & partition_dest,
|
Partition & partition_dest,
|
||||||
|
|
|
@ -908,7 +908,7 @@ bool GParted_Core::resize( const Device & device,
|
||||||
succes = false ;
|
succes = false ;
|
||||||
|
|
||||||
//expand filesystem to fit exactly in partition
|
//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 ;
|
succes = false ;
|
||||||
|
|
||||||
if ( ! check_repair( partition_new, operation_details ) )
|
if ( ! check_repair( partition_new, operation_details ) )
|
||||||
|
@ -926,15 +926,16 @@ bool GParted_Core::resize_filesystem( const Partition & partition_old,
|
||||||
Sector cylinder_size,
|
Sector cylinder_size,
|
||||||
bool fill_partition )
|
bool fill_partition )
|
||||||
{
|
{
|
||||||
if ( 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() )
|
if ( partition_new .get_length() < partition_old .get_length() )
|
||||||
operation_details .push_back( OperationDetails( _("shrink filesystem") ) ) ;
|
operation_details .push_back( OperationDetails( _("shrink filesystem") ) ) ;
|
||||||
else if ( partition_new .get_length() > partition_old .get_length() )
|
else if ( partition_new .get_length() > partition_old .get_length() )
|
||||||
operation_details .push_back( OperationDetails( _("grow filesystem") ) ) ;
|
operation_details .push_back( OperationDetails( _("grow filesystem") ) ) ;
|
||||||
else
|
else
|
||||||
operation_details .push_back(
|
operation_details .push_back(
|
||||||
OperationDetails( _("new and old partition have the same size. continuing anyway") ) ) ;
|
OperationDetails( _("new and old partition have the same size. continuing anyway") ) ) ;
|
||||||
|
}
|
||||||
|
|
||||||
set_proper_filesystem( partition_new .filesystem, cylinder_size ) ;
|
set_proper_filesystem( partition_new .filesystem, cylinder_size ) ;
|
||||||
if ( p_filesystem && p_filesystem ->Resize( partition_new, operation_details .back() .sub_details, fill_partition ) )
|
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 ;
|
return false ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool GParted_Core::maximize_filesystem( const Partition & partition,
|
||||||
|
std::vector<OperationDetails> & 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,
|
bool GParted_Core::copy( const Partition & partition_src,
|
||||||
Partition & partition_dest,
|
Partition & partition_dest,
|
||||||
|
@ -968,7 +977,6 @@ bool GParted_Core::copy( const Partition & partition_src,
|
||||||
partition_src .get_path(),
|
partition_src .get_path(),
|
||||||
partition_dest .get_path() ) ) ) ;
|
partition_dest .get_path() ) ) ) ;
|
||||||
|
|
||||||
set_proper_filesystem( partition_dest .filesystem ) ;
|
|
||||||
|
|
||||||
switch ( get_fs( partition_dest .filesystem ) .copy )
|
switch ( get_fs( partition_dest .filesystem ) .copy )
|
||||||
{
|
{
|
||||||
|
@ -984,19 +992,23 @@ bool GParted_Core::copy( const Partition & partition_src,
|
||||||
break ;
|
break ;
|
||||||
|
|
||||||
case GParted::FS::EXTERNAL :
|
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(),
|
partition_dest .get_path(),
|
||||||
operation_details ) ;
|
operation_details .back() .sub_details ) ;
|
||||||
break ;
|
break ;
|
||||||
|
|
||||||
default :
|
default :
|
||||||
succes = false ;
|
succes = false ;
|
||||||
break ;
|
break ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
operation_details .back() .status = succes ? OperationDetails::SUCCES : OperationDetails::ERROR ;
|
||||||
|
|
||||||
return ( succes &&
|
return ( succes &&
|
||||||
check_repair( partition_dest, operation_details ) &&
|
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 ) ) ;
|
check_repair( partition_dest, operation_details ) ) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
33
src/ext2.cc
33
src/ext2.cc
|
@ -75,16 +75,7 @@ void ext2::Set_Used_Sectors( Partition & partition )
|
||||||
|
|
||||||
bool ext2::Create( const Partition & new_partition, std::vector<OperationDetails> & operation_details )
|
bool ext2::Create( const Partition & new_partition, std::vector<OperationDetails> & operation_details )
|
||||||
{
|
{
|
||||||
if ( ! execute_command( "mkfs.ext2 " + new_partition .get_path(), operation_details ) )
|
return ! 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 ;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ext2::Resize( const Partition & partition_new,
|
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(
|
str_temp += " " + Utils::num_to_str( Utils::round( Utils::sector_to_unit(
|
||||||
partition_new .get_length() - cylinder_size, GParted::UNIT_MIB ) ), true ) + "M" ;
|
partition_new .get_length() - cylinder_size, GParted::UNIT_MIB ) ), true ) + "M" ;
|
||||||
|
|
||||||
if ( ! execute_command( str_temp, operation_details ) )
|
return ! execute_command( str_temp, operation_details ) ;
|
||||||
{
|
|
||||||
operation_details .back() .status = OperationDetails::SUCCES ;
|
|
||||||
return true ;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
operation_details .back() .status = OperationDetails::ERROR ;
|
|
||||||
return false ;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ext2::Copy( const Glib::ustring & src_part_path,
|
bool ext2::Copy( const Glib::ustring & src_part_path,
|
||||||
|
@ -122,16 +104,7 @@ bool ext2::Check_Repair( const Partition & partition, std::vector<OperationDetai
|
||||||
|
|
||||||
//exitstatus 256 isn't documented, but it's returned when the 'FILESYSTEM IS MODIFIED'
|
//exitstatus 256 isn't documented, but it's returned when the 'FILESYSTEM IS MODIFIED'
|
||||||
//this is quite normal (especially after a copy) so we let the function return true...
|
//this is quite normal (especially after a copy) so we let the function return true...
|
||||||
if ( exit_status == 0 || exit_status == 1 || exit_status == 2 || exit_status == 256 )
|
return ( exit_status == 0 || exit_status == 1 || exit_status == 2 || exit_status == 256 ) ;
|
||||||
{
|
|
||||||
operation_details .back() .status = OperationDetails::SUCCES ;
|
|
||||||
return true ;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
operation_details .back() .status = OperationDetails::ERROR ;
|
|
||||||
return false ;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} //GParted
|
} //GParted
|
||||||
|
|
33
src/ext3.cc
33
src/ext3.cc
|
@ -70,16 +70,7 @@ void ext3::Set_Used_Sectors( Partition & partition )
|
||||||
|
|
||||||
bool ext3::Create( const Partition & new_partition, std::vector<OperationDetails> & operation_details )
|
bool ext3::Create( const Partition & new_partition, std::vector<OperationDetails> & operation_details )
|
||||||
{
|
{
|
||||||
if ( ! execute_command( "mkfs.ext3 " + new_partition .get_path(), operation_details ) )
|
return ! 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 ;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ext3::Resize( const Partition & partition_new,
|
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(
|
str_temp += " " + Utils::num_to_str( Utils::round( Utils::sector_to_unit(
|
||||||
partition_new .get_length() - cylinder_size, GParted::UNIT_MIB ) ), true ) + "M" ;
|
partition_new .get_length() - cylinder_size, GParted::UNIT_MIB ) ), true ) + "M" ;
|
||||||
|
|
||||||
if ( ! execute_command( str_temp, operation_details ) )
|
return ! execute_command( str_temp, operation_details ) ;
|
||||||
{
|
|
||||||
operation_details .back() .status = OperationDetails::SUCCES ;
|
|
||||||
return true ;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
operation_details .back() .status = OperationDetails::ERROR ;
|
|
||||||
return false ;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ext3::Copy( const Glib::ustring & src_part_path,
|
bool ext3::Copy( const Glib::ustring & src_part_path,
|
||||||
|
@ -117,16 +99,7 @@ bool ext3::Check_Repair( const Partition & partition, std::vector<OperationDetai
|
||||||
|
|
||||||
//exitstatus 256 isn't documented, but it's returned when the 'FILESYSTEM IS MODIFIED'
|
//exitstatus 256 isn't documented, but it's returned when the 'FILESYSTEM IS MODIFIED'
|
||||||
//this is quite normal (especially after a copy) so we let the function return true...
|
//this is quite normal (especially after a copy) so we let the function return true...
|
||||||
if ( exit_status == 0 || exit_status == 1 || exit_status == 2 || exit_status == 256 )
|
return ( exit_status == 0 || exit_status == 1 || exit_status == 2 || exit_status == 256 ) ;
|
||||||
{
|
|
||||||
operation_details .back() .status = OperationDetails::SUCCES ;
|
|
||||||
return true ;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
operation_details .back() .status = OperationDetails::ERROR ;
|
|
||||||
return false ;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} //GParted
|
} //GParted
|
||||||
|
|
23
src/fat16.cc
23
src/fat16.cc
|
@ -75,16 +75,7 @@ void fat16::Set_Used_Sectors( Partition & partition )
|
||||||
|
|
||||||
bool fat16::Create( const Partition & new_partition, std::vector<OperationDetails> & operation_details )
|
bool fat16::Create( const Partition & new_partition, std::vector<OperationDetails> & operation_details )
|
||||||
{
|
{
|
||||||
if ( ! execute_command( "mkdosfs -F16 -v " + new_partition .get_path(), operation_details ) )
|
return ! 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 ;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool fat16::Resize( const Partition & partition_new,
|
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<OperationDetails> & operation_details )
|
bool fat16::Check_Repair( const Partition & partition, std::vector<OperationDetails> & operation_details )
|
||||||
{
|
{
|
||||||
exit_status = execute_command( "dosfsck -a -w -v " + partition .get_path(), operation_details ) ;
|
exit_status = execute_command( "dosfsck -a -w -v " + partition .get_path(), operation_details ) ;
|
||||||
if ( exit_status == 0 || exit_status == 1 )
|
|
||||||
{
|
return ( exit_status == 0 || exit_status == 1 ) ;
|
||||||
operation_details .back() .status = OperationDetails::SUCCES ;
|
|
||||||
return true ;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
operation_details .back() .status = OperationDetails::ERROR ;
|
|
||||||
return false ;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} //GParted
|
} //GParted
|
||||||
|
|
23
src/fat32.cc
23
src/fat32.cc
|
@ -76,16 +76,7 @@ void fat32::Set_Used_Sectors( Partition & partition )
|
||||||
|
|
||||||
bool fat32::Create( const Partition & new_partition, std::vector<OperationDetails> & operation_details )
|
bool fat32::Create( const Partition & new_partition, std::vector<OperationDetails> & operation_details )
|
||||||
{
|
{
|
||||||
if ( ! execute_command( "mkdosfs -F32 -v " + new_partition .get_path(), operation_details ) )
|
return ! 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 ;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool fat32::Resize( const Partition & partition_new,
|
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<OperationDetails> & operation_details )
|
bool fat32::Check_Repair( const Partition & partition, std::vector<OperationDetails> & operation_details )
|
||||||
{
|
{
|
||||||
exit_status = execute_command( "dosfsck -a -w -v " + partition .get_path(), operation_details ) ;
|
exit_status = execute_command( "dosfsck -a -w -v " + partition .get_path(), operation_details ) ;
|
||||||
if ( exit_status == 0 || exit_status == 1 )
|
|
||||||
{
|
return ( exit_status == 0 || exit_status == 1 ) ;
|
||||||
operation_details .back() .status = OperationDetails::SUCCES ;
|
|
||||||
return true ;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
operation_details .back() .status = OperationDetails::ERROR ;
|
|
||||||
return false ;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} //GParted
|
} //GParted
|
||||||
|
|
11
src/hfs.cc
11
src/hfs.cc
|
@ -46,16 +46,7 @@ void hfs::Set_Used_Sectors( Partition & partition )
|
||||||
|
|
||||||
bool hfs::Create( const Partition & new_partition, std::vector<OperationDetails> & operation_details )
|
bool hfs::Create( const Partition & new_partition, std::vector<OperationDetails> & operation_details )
|
||||||
{
|
{
|
||||||
if ( ! execute_command( "hformat " + new_partition .get_path(), operation_details ) )
|
return ! 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 ;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool hfs::Resize( const Partition & partition_new,
|
bool hfs::Resize( const Partition & partition_new,
|
||||||
|
|
23
src/jfs.cc
23
src/jfs.cc
|
@ -91,16 +91,7 @@ void jfs::Set_Used_Sectors( Partition & partition )
|
||||||
|
|
||||||
bool jfs::Create( const Partition & new_partition, std::vector<OperationDetails> & operation_details )
|
bool jfs::Create( const Partition & new_partition, std::vector<OperationDetails> & operation_details )
|
||||||
{
|
{
|
||||||
if ( ! execute_command( "mkfs.jfs -q " + new_partition .get_path(), operation_details ) )
|
return ! 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 ;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool jfs::Resize( const Partition & partition_new,
|
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<OperationDetails> & operation_details )
|
bool jfs::Check_Repair( const Partition & partition, std::vector<OperationDetails> & operation_details )
|
||||||
{
|
{
|
||||||
exit_status = execute_command( "jfs_fsck -f " + partition .get_path(), operation_details ) ;
|
exit_status = execute_command( "jfs_fsck -f " + partition .get_path(), operation_details ) ;
|
||||||
if ( exit_status == 0 || exit_status == 1 )
|
|
||||||
{
|
return ( exit_status == 0 || exit_status == 1 ) ;
|
||||||
operation_details .back() .status = OperationDetails::SUCCES ;
|
|
||||||
return true ;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
operation_details .back() .status = OperationDetails::ERROR ;
|
|
||||||
return false ;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} //GParted
|
} //GParted
|
||||||
|
|
|
@ -45,16 +45,7 @@ void linux_swap::Set_Used_Sectors( Partition & partition )
|
||||||
|
|
||||||
bool linux_swap::Create( const Partition & new_partition, std::vector<OperationDetails> & operation_details )
|
bool linux_swap::Create( const Partition & new_partition, std::vector<OperationDetails> & operation_details )
|
||||||
{
|
{
|
||||||
if ( ! execute_command( "mkswap " + new_partition .get_path(), operation_details ) )
|
return ! 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 ;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool linux_swap::Resize( const Partition & partition_new,
|
bool linux_swap::Resize( const Partition & partition_new,
|
||||||
|
|
34
src/ntfs.cc
34
src/ntfs.cc
|
@ -69,16 +69,7 @@ void ntfs::Set_Used_Sectors( Partition & partition )
|
||||||
|
|
||||||
bool ntfs::Create( const Partition & new_partition, std::vector<OperationDetails> & operation_details )
|
bool ntfs::Create( const Partition & new_partition, std::vector<OperationDetails> & operation_details )
|
||||||
{
|
{
|
||||||
if ( ! execute_command( "mkntfs -Q -vv " + new_partition .get_path(), operation_details ) )
|
return ! 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 ;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ntfs::Resize( const Partition & partition_new,
|
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,
|
const Glib::ustring & dest_part_path,
|
||||||
std::vector<OperationDetails> & operation_details )
|
std::vector<OperationDetails> & operation_details )
|
||||||
{
|
{
|
||||||
if ( ! execute_command( "ntfsclone -f --overwrite " + dest_part_path + " " + src_part_path,
|
return ! execute_command( "ntfsclone -f --overwrite " + dest_part_path + " " + src_part_path, operation_details ) ;
|
||||||
operation_details .back() .sub_details ) )
|
|
||||||
{
|
|
||||||
operation_details .back() .status = OperationDetails::SUCCES ;
|
|
||||||
return true ;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
operation_details .back() .status = OperationDetails::ERROR ;
|
|
||||||
return false ;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ntfs::Check_Repair( const Partition & partition, std::vector<OperationDetails> & operation_details )
|
bool ntfs::Check_Repair( const Partition & partition, std::vector<OperationDetails> & operation_details )
|
||||||
{
|
{
|
||||||
if ( ! execute_command( "ntfsresize -P -i -f -v " + partition .get_path(), operation_details ) )
|
return ! 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 ;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} //GParted
|
} //GParted
|
||||||
|
|
|
@ -68,16 +68,7 @@ void reiser4::Set_Used_Sectors( Partition & partition )
|
||||||
|
|
||||||
bool reiser4::Create( const Partition & new_partition, std::vector<OperationDetails> & operation_details )
|
bool reiser4::Create( const Partition & new_partition, std::vector<OperationDetails> & operation_details )
|
||||||
{
|
{
|
||||||
if ( ! execute_command( "mkfs.reiser4 --yes " + new_partition .get_path(), operation_details ) )
|
return ! 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 ;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool reiser4::Resize( const Partition & partition_new,
|
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<OperationDetails> & operation_details )
|
bool reiser4::Check_Repair( const Partition & partition, std::vector<OperationDetails> & operation_details )
|
||||||
{
|
{
|
||||||
if ( ! execute_command( "fsck.reiser4 --yes --fix " + partition .get_path(), operation_details ) )
|
return ! 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 ;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} //GParted
|
} //GParted
|
||||||
|
|
|
@ -73,16 +73,7 @@ void reiserfs::Set_Used_Sectors( Partition & partition )
|
||||||
|
|
||||||
bool reiserfs::Create( const Partition & new_partition, std::vector<OperationDetails> & operation_details )
|
bool reiserfs::Create( const Partition & new_partition, std::vector<OperationDetails> & operation_details )
|
||||||
{
|
{
|
||||||
if ( ! execute_command( "mkreiserfs -f " + new_partition .get_path(), operation_details ) )
|
return ! 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 ;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool reiserfs::Resize( const Partition & partition_new,
|
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 ) ;
|
exit_status = execute_command( str_temp, operation_details ) ;
|
||||||
if ( exit_status == 0 || exit_status == 256 )
|
|
||||||
{
|
return ( exit_status == 0 || exit_status == 256 ) ;
|
||||||
operation_details .back() .status = OperationDetails::SUCCES ;
|
|
||||||
return true ;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
operation_details .back() .status = OperationDetails::ERROR ;
|
|
||||||
return false ;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool reiserfs::Copy( const Glib::ustring & src_part_path,
|
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<OperationDetails> & operation_details )
|
bool reiserfs::Check_Repair( const Partition & partition, std::vector<OperationDetails> & operation_details )
|
||||||
{
|
{
|
||||||
exit_status = execute_command( "reiserfsck --y --fix-fixable " + partition .get_path(), 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 )
|
|
||||||
{
|
return ( 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 ;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} //GParted
|
} //GParted
|
||||||
|
|
100
src/xfs.cc
100
src/xfs.cc
|
@ -93,16 +93,7 @@ void xfs::Set_Used_Sectors( Partition & partition )
|
||||||
|
|
||||||
bool xfs::Create( const Partition & new_partition, std::vector<OperationDetails> & operation_details )
|
bool xfs::Create( const Partition & new_partition, std::vector<OperationDetails> & operation_details )
|
||||||
{
|
{
|
||||||
if ( ! execute_command( "mkfs.xfs -f " + new_partition .get_path(), operation_details ) )
|
return ! 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 ;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool xfs::Resize( const Partition & partition_new,
|
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..
|
//create xfs filesystem on destination..
|
||||||
Partition partition( dest_part_path ) ;
|
Partition partition( dest_part_path ) ;
|
||||||
if ( Create( partition, operation_details .back() .sub_details ) )
|
if ( Create( partition, operation_details ) )
|
||||||
{
|
{
|
||||||
//create source mountpoint...
|
//create source mountpoint...
|
||||||
operation_details .back() .sub_details .push_back(
|
operation_details .push_back(
|
||||||
OperationDetails( String::ucompose( _("create temporary mountpoint (%1)"), SRC ) ) ) ;
|
OperationDetails( String::ucompose( _("create temporary mountpoint (%1)"), SRC ) ) ) ;
|
||||||
if ( ! mkdir( SRC .c_str(), 0 ) )
|
if ( ! mkdir( SRC .c_str(), 0 ) )
|
||||||
{
|
{
|
||||||
operation_details .back() .sub_details .back() .status = OperationDetails::SUCCES ;
|
operation_details .back() .status = OperationDetails::SUCCES ;
|
||||||
|
|
||||||
//create destination mountpoint...
|
//create destination mountpoint...
|
||||||
operation_details .back() .sub_details .push_back(
|
operation_details .push_back(
|
||||||
OperationDetails( String::ucompose( _("create temporary mountpoint (%1)"), DST ) ) ) ;
|
OperationDetails( String::ucompose( _("create temporary mountpoint (%1)"), DST ) ) ) ;
|
||||||
if ( ! mkdir( DST .c_str(), 0 ) )
|
if ( ! mkdir( DST .c_str(), 0 ) )
|
||||||
{
|
{
|
||||||
operation_details .back() .sub_details .back() .status = OperationDetails::SUCCES ;
|
operation_details .back() .status = OperationDetails::SUCCES ;
|
||||||
|
|
||||||
//mount source partition
|
//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 ) ) ) ;
|
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,
|
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
|
//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 ) ) ) ;
|
OperationDetails( String::ucompose( _("mount %1 on %2"), dest_part_path, DST ) ) ) ;
|
||||||
|
|
||||||
if ( ! execute_command( "mount -v -t xfs " + 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..
|
//copy filesystem..
|
||||||
operation_details .back() .sub_details .push_back( OperationDetails( _("copy filesystem") ) ) ;
|
operation_details .push_back( OperationDetails( _("copy filesystem") ) ) ;
|
||||||
|
|
||||||
if ( ! execute_command(
|
if ( ! execute_command(
|
||||||
"xfsdump -J - " + SRC + " | xfsrestore -J - " + DST,
|
"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 ;
|
return_value = true ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
operation_details .back() .sub_details .back() .status = OperationDetails::ERROR ;
|
operation_details .back() .status = OperationDetails::ERROR ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//unmount destination partition
|
//unmount destination partition
|
||||||
operation_details .back() .sub_details .push_back(
|
operation_details .push_back(
|
||||||
OperationDetails( String::ucompose( _("unmount %1"), dest_part_path ) ) ) ;
|
OperationDetails( String::ucompose( _("unmount %1"),
|
||||||
|
dest_part_path ) ) ) ;
|
||||||
|
|
||||||
if ( ! execute_command( "umount -v " + 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
|
else
|
||||||
{
|
{
|
||||||
operation_details .back() .sub_details .back() .status = OperationDetails::ERROR ;
|
operation_details .back() .status = OperationDetails::ERROR ;
|
||||||
return_value = false ;
|
return_value = false ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
operation_details .back() .sub_details .back() .status = OperationDetails::ERROR ;
|
operation_details .back() .status = OperationDetails::ERROR ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//unmount source partition
|
//unmount source partition
|
||||||
operation_details .back() .sub_details .push_back(
|
operation_details .push_back(
|
||||||
OperationDetails( String::ucompose( _("unmount %1"), src_part_path ) ) ) ;
|
OperationDetails( String::ucompose( _("unmount %1"), src_part_path ) ) ) ;
|
||||||
|
|
||||||
if ( ! execute_command( "umount -v " + 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
|
else
|
||||||
{
|
{
|
||||||
operation_details .back() .sub_details .back() .status = OperationDetails::ERROR ;
|
operation_details .back() .status = OperationDetails::ERROR ;
|
||||||
return_value = false ;
|
return_value = false ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
operation_details .back() .sub_details .back() .status = OperationDetails::ERROR ;
|
operation_details .back() .status = OperationDetails::ERROR ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//remove destination mountpoint..
|
//remove destination mountpoint..
|
||||||
operation_details .back() .sub_details .push_back(
|
operation_details .push_back(
|
||||||
OperationDetails( String::ucompose( _("remove temporary mountpoint (%1)"), DST ) ) ) ;
|
OperationDetails( String::ucompose( _("remove temporary mountpoint (%1)"), DST ) ) ) ;
|
||||||
if ( ! rmdir( DST .c_str() ) )
|
if ( ! rmdir( DST .c_str() ) )
|
||||||
{
|
{
|
||||||
operation_details .back() .sub_details .back() .status = OperationDetails::SUCCES ;
|
operation_details .back() .status = OperationDetails::SUCCES ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
operation_details .back() .sub_details .back() .status = OperationDetails::ERROR ;
|
operation_details .back() .status = OperationDetails::ERROR ;
|
||||||
operation_details .back() .sub_details .back() .sub_details .push_back(
|
operation_details .back() .sub_details .push_back(
|
||||||
OperationDetails( Glib::strerror( errno ), OperationDetails::NONE ) ) ;
|
OperationDetails( Glib::strerror( errno ), OperationDetails::NONE ) ) ;
|
||||||
|
|
||||||
return_value = false ;
|
return_value = false ;
|
||||||
|
@ -307,22 +299,22 @@ bool xfs::Copy( const Glib::ustring & src_part_path,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
operation_details .back() .sub_details .back() .status = OperationDetails::ERROR ;
|
operation_details .back() .status = OperationDetails::ERROR ;
|
||||||
operation_details .back() .sub_details .back() .sub_details .push_back(
|
operation_details .back() .sub_details .push_back(
|
||||||
OperationDetails( Glib::strerror( errno ), OperationDetails::NONE ) ) ;
|
OperationDetails( Glib::strerror( errno ), OperationDetails::NONE ) ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//remove source mountpoint..
|
//remove source mountpoint..
|
||||||
operation_details .back() .sub_details .push_back(
|
operation_details .push_back(
|
||||||
OperationDetails( String::ucompose( _("remove temporary mountpoint (%1)"), SRC ) ) ) ;
|
OperationDetails( String::ucompose( _("remove temporary mountpoint (%1)"), SRC ) ) ) ;
|
||||||
if ( ! rmdir( SRC .c_str() ) )
|
if ( ! rmdir( SRC .c_str() ) )
|
||||||
{
|
{
|
||||||
operation_details .back() .sub_details .back() .status = OperationDetails::SUCCES ;
|
operation_details .back() .status = OperationDetails::SUCCES ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
operation_details .back() .sub_details .back() .status = OperationDetails::ERROR ;
|
operation_details .back() .status = OperationDetails::ERROR ;
|
||||||
operation_details .back() .sub_details .back() .sub_details .push_back(
|
operation_details .back() .sub_details .push_back(
|
||||||
OperationDetails( Glib::strerror( errno ), OperationDetails::NONE ) ) ;
|
OperationDetails( Glib::strerror( errno ), OperationDetails::NONE ) ) ;
|
||||||
|
|
||||||
return_value = false ;
|
return_value = false ;
|
||||||
|
@ -330,28 +322,18 @@ bool xfs::Copy( const Glib::ustring & src_part_path,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
operation_details .back() .sub_details .back() .status = OperationDetails::ERROR ;
|
operation_details .back() .status = OperationDetails::ERROR ;
|
||||||
operation_details .back() .sub_details .back() .sub_details .push_back(
|
operation_details .back() .sub_details .push_back(
|
||||||
OperationDetails( Glib::strerror( errno ), OperationDetails::NONE ) ) ;
|
OperationDetails( Glib::strerror( errno ), OperationDetails::NONE ) ) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
operation_details .back() .status = return_value ? OperationDetails::SUCCES : OperationDetails::ERROR ;
|
|
||||||
return return_value ;
|
return return_value ;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool xfs::Check_Repair( const Partition & partition, std::vector<OperationDetails> & operation_details )
|
bool xfs::Check_Repair( const Partition & partition, std::vector<OperationDetails> & operation_details )
|
||||||
{
|
{
|
||||||
if ( ! execute_command( "xfs_repair -v " + partition .get_path(), operation_details ) )
|
return ! 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 ;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} //GParted
|
} //GParted
|
||||||
|
|
Loading…
Reference in New Issue