Use ped_device_read and ped_device_write instead of 'dd' to copy

* Use ped_device_read and ped_device_write instead of 'dd' to copy
  filesystems.
  Modified progressdetails to provide more detailed feedback about a
  process.
  Basicly these were all changes to the infrastructure to make the
  incorporation of the 'move-code' a bit easier.

  ( sorry, not in the mood to list all affected files ;)
This commit is contained in:
Bart Hakvoort 2006-05-23 21:17:34 +00:00
parent aef704c242
commit 7bb7e8a84f
19 changed files with 257 additions and 222 deletions

View File

@ -1,3 +1,14 @@
2006-05-23 Bart Hakvoort <hakvoort@cvs.gnome.org>
* Use ped_device_read and ped_device_write instead of 'dd' to copy
filesystems.
Modified progressdetails to provide more detailed feedback about a
process.
Basicly these were all changes to the infrastructure to make the
incorporation of the 'move-code' a bit easier.
( sorry, not in the mood to list all affected files ;)
2006-05-13 Bart Hakvoort <hakvoort@cvs.gnome.org>
* configure.in: bumped to gparted-0.2.5

View File

@ -56,6 +56,7 @@ private:
bool on_delete_event( GdkEventAny * event ) ;
Gtk::Label label_current ;
Gtk::Label label_current_sub ;
Gtk::ProgressBar progressbar_all, progressbar_current ;
Gtk::TreeView treeview_operations ;
Gtk::TreeRow treerow ;
@ -86,7 +87,7 @@ private:
treeview_operations_Columns treeview_operations_columns;
std::vector<Operation *> operations ;
bool pulse, succes, cancel ;
bool running, succes, cancel, pulse ;
pthread_t pthread ;
double fraction ;
unsigned int t ;

View File

@ -48,7 +48,7 @@ public:
const Partition & partition_old,
const Partition & partition_new,
std::vector<OperationDetails> & operation_detail ) ;
bool copy( const Glib::ustring & src_part_path,
bool copy( const Partition & partition_src,
Partition & partition_dest,
Sector min_size,
std::vector<OperationDetails> & operation_details ) ;
@ -91,6 +91,10 @@ private:
const Partition & partition_new,
std::vector<OperationDetails> & operation_details ) ;
bool copy_filesystem( const Partition & partition_src,
const Partition & partition_dest,
std::vector<OperationDetails> & operation_details ) ;
void set_proper_filesystem( const FILESYSTEM & filesystem ) ;
bool set_partition_type( const Partition & partition,
std::vector<OperationDetails> & operation_details ) ;

View File

@ -43,16 +43,21 @@ struct OperationDetails
OperationDetails()
{
status = NONE ;
fraction = -1 ;
}
OperationDetails( const Glib::ustring & description, Status status = EXECUTE )
{
this ->description = description ;
this ->status = status ;
fraction = -1 ;
}
Glib::ustring description ;
Status status ;
double fraction ;
Glib::ustring progress_text ;
std::vector<OperationDetails> sub_details ;
};

View File

@ -84,8 +84,9 @@ struct FS
enum Support
{
NONE = 0,
LIBPARTED = 1,
EXTERNAL = 2
GPARTED = 1,
LIBPARTED = 2,
EXTERNAL = 3
};
FILESYSTEM filesystem ;

View File

@ -45,13 +45,14 @@ Dialog_Progress::Dialog_Progress( const std::vector<Operation *> & operations )
str_temp += "\n";
this ->get_vbox() ->pack_start( * Utils::mk_label( str_temp ), Gtk::PACK_SHRINK );
this ->get_vbox() ->pack_start( * Utils::mk_label( "<b>" + static_cast<Glib::ustring>( _("Current Operation:") ) + "</b>" ), Gtk::PACK_SHRINK );
label_current .set_alignment( Gtk::ALIGN_LEFT );
this ->get_vbox() ->pack_start( label_current, Gtk::PACK_SHRINK ) ;
progressbar_current .set_pulse_step( 0.01 ) ;
this->get_vbox() ->pack_start( progressbar_current, Gtk::PACK_SHRINK );
label_current .set_alignment( Gtk::ALIGN_LEFT );
this ->get_vbox() ->pack_start( label_current, Gtk::PACK_SHRINK );
label_current_sub .set_alignment( Gtk::ALIGN_LEFT );
this ->get_vbox() ->pack_start( label_current_sub, Gtk::PACK_SHRINK );
this ->get_vbox() ->pack_start( * Utils::mk_label( "<b>" + static_cast<Glib::ustring>( _("Completed Operations:") ) + "</b>" ), Gtk::PACK_SHRINK );
this ->get_vbox() ->pack_start( progressbar_all, Gtk::PACK_SHRINK );
@ -146,6 +147,19 @@ void Dialog_Progress::update_operation_details( const Gtk::TreeRow & treerow,
}
}
//check description and update if necessary
if ( operation_details .description != treerow[ treeview_operations_columns .operation_description ] )
treerow[ treeview_operations_columns .operation_description ] = operation_details .description ;
if ( operation_details .fraction >= 0 )
{
pulse = false ;
progressbar_current .set_fraction( operation_details .fraction ) ;
progressbar_current .set_text( operation_details .progress_text ) ;
}
else
pulse = true ;
//and update the children..
for ( unsigned int t = 0 ; t < operation_details .sub_details .size() ; t++ )
update_operation_details( treerow .children()[ t ], operation_details .sub_details[ t ] ) ;
@ -155,7 +169,7 @@ void Dialog_Progress::on_signal_show()
{
for ( t = 0 ; t < operations .size() && succes && ! cancel ; t++ )
{
label_current .set_markup( "<i>" + operations[ t ] ->description + "</i>\n" ) ;
label_current .set_markup( "<b>" + operations[ t ] ->description + "</b>" ) ;
progressbar_all .set_text( String::ucompose( _("%1 of %2 operations completed"), t, operations .size() ) ) ;
progressbar_all .set_fraction( fraction * t ) ;
@ -170,19 +184,30 @@ void Dialog_Progress::on_signal_show()
treeview_operations .set_cursor( static_cast<Gtk::TreePath>( treerow ) ) ;
//and start..
pulse = true ;
running = true ;
pthread_create( & pthread, NULL, Dialog_Progress::static_pthread_apply_operation, this );
while ( pulse )
{
update_operation_details( treerow, operations[ t ] ->operation_details ) ;
progressbar_current .pulse() ;
int ms = 200 ;
while ( running )
{
if ( ms >= 200 )
{
update_operation_details( treerow, operations[ t ] ->operation_details ) ;
if ( operations[ t ] ->operation_details .sub_details .size() > 0 )
label_current_sub .set_markup(
"<i>" +
operations[ t ] ->operation_details .sub_details .back() .description +
"</i>\n" ) ;
ms = 0 ;
}
if ( pulse )
progressbar_current .pulse() ;
while ( Gtk::Main::events_pending() )
Gtk::Main::iteration();
usleep( 10000 ) ;
ms += 10 ;
}
//set status (succes/error) for this operation
@ -207,10 +232,9 @@ void Dialog_Progress::on_signal_show()
else
{
//hide 'current operation' stuff
children = this ->get_vbox() ->get_children() ;
children[ 1 ] ->hide() ;
progressbar_current .hide() ;
label_current .hide() ;
progressbar_current .hide() ;
label_current_sub .hide() ;
}
//deal with succes/error...
@ -260,7 +284,7 @@ void * Dialog_Progress::static_pthread_apply_operation( void * p_dialog_progress
dp ->succes = dp ->signal_apply_operation .emit( dp ->operations[ dp ->t ] ) ;
dp ->pulse = false ;
dp ->running = false ;
return NULL ;
}
@ -283,7 +307,7 @@ void Dialog_Progress::on_cancel()
{
pthread_cancel( pthread ) ;
cancel = true ;
pulse = false ;
running = false ;
succes = false ;
}
}

View File

@ -651,7 +651,7 @@ bool GParted_Core::apply_operation_to_disk( Operation * operation )
return format( operation ->partition_new, operation ->operation_details .sub_details ) ;
case COPY:
operation ->partition_new .add_path( operation ->partition_original .get_path(), true ) ;
return copy( static_cast<OperationCopy*>( operation ) ->partition_copied .get_path(),
return copy( static_cast<OperationCopy*>( operation ) ->partition_copied,
operation ->partition_new,
static_cast<OperationCopy*>( operation ) ->partition_copied .get_length(),
operation ->operation_details .sub_details ) ;
@ -782,26 +782,53 @@ bool GParted_Core::resize( const Device & device,
return false ;
}
bool GParted_Core::copy( const Glib::ustring & src_part_path,
bool GParted_Core::copy( const Partition & partition_src,
Partition & partition_dest,
Sector min_size,
std::vector<OperationDetails> & operation_details )
{
//FIXME: some filesystems (e.g. fat*) can be copied using libparted..
set_proper_filesystem( partition_dest .filesystem ) ;
if ( p_filesystem && p_filesystem ->Check_Repair( Partition( src_part_path ), operation_details ) )
if ( p_filesystem && p_filesystem ->Check_Repair( partition_src, operation_details ) )
{
bool succes = true ;
if ( partition_dest .status == GParted::STAT_NEW )
succes = create_empty_partition( partition_dest, operation_details, min_size ) ;
return ( succes &&
set_partition_type( partition_dest, operation_details ) &&
p_filesystem ->Copy( src_part_path, partition_dest .get_path(), operation_details ) &&
p_filesystem ->Check_Repair( partition_dest, operation_details ) &&
p_filesystem ->Resize( partition_dest, operation_details, true ) &&
p_filesystem ->Check_Repair( partition_dest, operation_details ) ) ;
if ( succes && set_partition_type( partition_dest, operation_details ) )
{
operation_details .push_back( OperationDetails(
String::ucompose( _("copy filesystem of %1 to %2"),
partition_src .get_path(),
partition_dest .get_path() ) ) ) ;
switch ( get_fs( partition_dest .filesystem ) .copy )
{
case GParted::FS::GPARTED :
succes = copy_filesystem( partition_src,
partition_dest,
operation_details ) ;
break ;
case GParted::FS::LIBPARTED :
//FIXME: see if copying through libparted has any advantages
break ;
case GParted::FS::EXTERNAL :
succes = p_filesystem ->Copy( partition_src .get_path(),
partition_dest .get_path(),
operation_details ) ;
break ;
default :
succes = false ;
break ;
}
return ( succes &&
p_filesystem ->Check_Repair( partition_dest, operation_details ) &&
p_filesystem ->Resize( partition_dest, operation_details, true ) &&
p_filesystem ->Check_Repair( partition_dest, operation_details ) ) ;
}
}
return false ;
@ -1027,19 +1054,17 @@ bool GParted_Core::create_empty_partition( Partition & new_partition,
free( lp_path ) ;
new_partition .partition_number = lp_partition ->num ;
Sector start = lp_partition ->geom .start ;
Sector end = lp_partition ->geom .end ;
new_partition .sector_start = lp_partition ->geom .start ;
new_partition .sector_end = lp_partition ->geom .end ;
operation_details .back() .sub_details .push_back(
OperationDetails(
"<i>" +
String::ucompose( _("path: %1"), new_partition .get_path() ) + "\n" +
String::ucompose( _("start: %1"), start ) + "\n" +
String::ucompose( _("end: %1"), end ) + "\n" +
String::ucompose( _("size: %1"), Utils::format_size( end - start + 1 ) ) +
"</i>",
OperationDetails::NONE ) ) ;
operation_details .back() .sub_details .push_back( OperationDetails(
"<i>" +
String::ucompose( _("path: %1"), new_partition .get_path() ) + "\n" +
String::ucompose( _("start: %1"), new_partition .sector_start ) + "\n" +
String::ucompose( _("end: %1"), new_partition .sector_end ) + "\n" +
String::ucompose( _("size: %1"), Utils::format_size( new_partition .get_length() ) ) +
"</i>",
OperationDetails::NONE ) ) ;
}
ped_constraint_destroy( constraint );
@ -1231,6 +1256,112 @@ bool GParted_Core::resize_normal_using_libparted( const Partition & partition_ol
return return_value ;
}
bool GParted_Core::copy_filesystem( const Partition & partition_src,
const Partition & partition_dest,
std::vector<OperationDetails> & operation_details )
{//FIXME: try to increase speed by copying more sectors at once, this should probably become a userspace setting
bool succes = false ;
char buf[1024] ;
PedDevice *lp_device_src, *lp_device_dest ;
//FIXME: adapt open_device() so we don't have to call ped_device_get() here
//(same goes for close_device() and ped_device_destroy()
lp_device_src = ped_device_get( partition_src .device_path .c_str() );
if ( partition_src .device_path != partition_dest .device_path )
lp_device_dest = ped_device_get( partition_dest .device_path .c_str() );
else
lp_device_dest = lp_device_src ;
if ( lp_device_src && lp_device_dest && ped_device_open( lp_device_src ) && ped_device_open( lp_device_dest ) )
{
ped_device_sync( lp_device_dest ) ;
//add an empty sub which we will constantly update in the loop
operation_details .back() .sub_details .push_back(
OperationDetails( "", OperationDetails::NONE ) ) ;
Glib::ustring error_message ;
Sector t = 0 ;
for ( ; t < partition_src .get_length() ; t++ )
{
if ( ! ped_device_read( lp_device_src, buf, partition_src .sector_start + t, 1 ) )
{
error_message = "<i>" + String::ucompose( _("Error while reading sector %1"),
partition_src .sector_start + t ) + "</i>" ;
break ;
}
if ( ! ped_device_write( lp_device_dest, buf, partition_dest .sector_start + t, 1 ) )
{
error_message = "<i>" + String::ucompose( _("Error while writing sector %1"),
partition_src .sector_start + t ) + "</i>" ;
break ;
}
if ( t % MEBIBYTE == 0 )
{
operation_details .back() .sub_details .back() .progress_text =
String::ucompose( _("%1 of %2 copied"),
Utils::format_size( t +1 ),
Utils::format_size( partition_src .get_length() ) ) ;
operation_details .back() .sub_details .back() .description =
"<i>" + operation_details .back() .sub_details .back() .progress_text + "</i>" ;
operation_details .back() .sub_details .back() .fraction =
t / static_cast<double>( partition_src .get_length() ) ;
}
}
//final description
operation_details .back() .sub_details .back() .description =
"<i>" +
String::ucompose( _("%1 of %2 copied"),
Utils::format_size( t +1 ),
Utils::format_size( partition_src .get_length() ) ) +
"</i>" ;
//reset fraction to -1 to make room for a new one (or a pulsebar)
operation_details .back() .sub_details .back() .fraction = -1 ;
if ( t == partition_src .get_length() )
{
succes = true ;
}
else
{
if ( ! error_message .empty() )
operation_details .back() .sub_details .push_back(
OperationDetails( error_message, OperationDetails::NONE ) ) ;
if ( ! ped_error .empty() )
operation_details .back() .sub_details .push_back(
OperationDetails( "<i>" + ped_error + "</i>", OperationDetails::NONE ) ) ;
}
//close the devices..
ped_device_close( lp_device_src ) ;
if ( partition_src .device_path != partition_dest .device_path )
ped_device_close( lp_device_dest ) ;
//detroy the devices..
ped_device_destroy( lp_device_src ) ;
if ( partition_src .device_path != partition_dest .device_path )
ped_device_destroy( lp_device_dest ) ;
}
else
operation_details .back() .sub_details .push_back(
OperationDetails( _("An error occured while opening the devices"), OperationDetails::NONE ) ) ;
operation_details .back() .status = succes ? OperationDetails::SUCCES : OperationDetails::ERROR ;
return succes ;
}
void GParted_Core::set_flags( Partition & partition )
{
for ( unsigned int t = 0 ; t < flags .size() ; t++ )
@ -1344,7 +1475,8 @@ bool GParted_Core::erase_filesystem_signatures( const Partition & partition )
return return_value ;
}
//FIXME open_device( _and_disk) and the close functions should take an PedDevice * and PedDisk * as argument
//basicly we should get rid of these global lp_device and lp_disk
bool GParted_Core::open_device( const Glib::ustring & device_path )
{
lp_device = ped_device_get( device_path .c_str() );

View File

@ -34,18 +34,15 @@ FS ext2::get_filesystem_support()
if ( ! Glib::find_program_in_path( "e2fsck" ) .empty() )
fs .check = GParted::FS::EXTERNAL ;
//resizing is a delicate process ...
if ( ! Glib::find_program_in_path( "resize2fs" ) .empty() && fs .check )
{
fs .grow = GParted::FS::EXTERNAL ;
fs .copy = GParted::FS::GPARTED ;
if ( fs .read ) //needed to determine a min filesystemsize..
fs .shrink = GParted::FS::EXTERNAL ;
}
if ( ! Glib::find_program_in_path( "dd" ) .empty() && fs .grow )
fs .copy = GParted::FS::EXTERNAL ;
return fs ;
}
@ -119,20 +116,7 @@ bool ext2::Copy( const Glib::ustring & src_part_path,
const Glib::ustring & dest_part_path,
std::vector<OperationDetails> & operation_details )
{
operation_details .push_back( OperationDetails(
String::ucompose( _("copy contents of %1 to %2"), src_part_path, dest_part_path ) ) ) ;
if ( ! execute_command( "dd bs=8192 if=" + src_part_path + " of=" + dest_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 true ;
}
bool ext2::Check_Repair( const Partition & partition, std::vector<OperationDetails> & operation_details )
@ -143,7 +127,10 @@ bool ext2::Check_Repair( const Partition & partition, std::vector<OperationDetai
exit_status = execute_command( "e2fsck -f -y -v " + partition .get_path(),
operation_details .back() .sub_details ) ;
if ( exit_status >= 0 && exit_status <= 2 )
//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...
if ( exit_status == 0 || exit_status == 1 || exit_status == 2 || exit_status == 256 )
{
operation_details .back() .status = OperationDetails::SUCCES ;
return true ;

View File

@ -35,18 +35,15 @@ FS ext3::get_filesystem_support()
if ( ! Glib::find_program_in_path( "e2fsck" ) .empty() )
fs .check = GParted::FS::EXTERNAL ;
//resizing is a delicate process ...
if ( ! Glib::find_program_in_path( "resize2fs" ) .empty() && fs .check )
{
fs .grow = GParted::FS::EXTERNAL ;
fs .copy = GParted::FS::GPARTED ;
if ( fs .read ) //needed to determine a min filesystemsize..
fs .shrink = GParted::FS::EXTERNAL ;
}
if ( ! Glib::find_program_in_path( "dd" ) .empty() && fs .grow )
fs .copy = GParted::FS::EXTERNAL ;
return fs ;
}
@ -120,20 +117,7 @@ bool ext3::Copy( const Glib::ustring & src_part_path,
const Glib::ustring & dest_part_path,
std::vector<OperationDetails> & operation_details )
{
operation_details .push_back( OperationDetails(
String::ucompose( _("copy contents of %1 to %2"), src_part_path, dest_part_path ) ) ) ;
if ( ! execute_command( "dd bs=8192 if=" + src_part_path + " of=" + dest_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 true ;
}
bool ext3::Check_Repair( const Partition & partition, std::vector<OperationDetails> & operation_details )
@ -144,7 +128,10 @@ bool ext3::Check_Repair( const Partition & partition, std::vector<OperationDetai
exit_status = execute_command( "e2fsck -f -y -v " + partition .get_path(),
operation_details .back() .sub_details ) ;
if ( exit_status >= 0 && exit_status <= 2 )
//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...
if ( exit_status == 0 || exit_status == 1 || exit_status == 2 || exit_status == 256 )
{
operation_details .back() .status = OperationDetails::SUCCES ;
return true ;

View File

@ -41,8 +41,7 @@ FS fat16::get_filesystem_support()
fs .shrink = GParted::FS::LIBPARTED ;
fs .move = GParted::FS::LIBPARTED ;
if ( ! Glib::find_program_in_path( "dd" ) .empty() )
fs .copy = GParted::FS::EXTERNAL ;
fs .copy = GParted::FS::GPARTED ;
fs .MIN = 16 * MEBIBYTE ;
fs .MAX = 4096 * MEBIBYTE ;
@ -103,20 +102,7 @@ bool fat16::Copy( const Glib::ustring & src_part_path,
const Glib::ustring & dest_part_path,
std::vector<OperationDetails> & operation_details )
{
operation_details .push_back( OperationDetails(
String::ucompose( _("copy contents of %1 to %2"), src_part_path, dest_part_path ) ) ) ;
if ( ! execute_command( "dd bs=8192 if=" + src_part_path + " of=" + dest_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 true ;
}
bool fat16::Check_Repair( const Partition & partition, std::vector<OperationDetails> & operation_details )

View File

@ -41,8 +41,9 @@ FS fat32::get_filesystem_support()
fs .shrink = GParted::FS::LIBPARTED ;
fs .move = GParted::FS::LIBPARTED ;
if ( ! Glib::find_program_in_path( "dd" ) .empty() )
fs .copy = GParted::FS::EXTERNAL ;
//FIXME: find a way to decouple FS and partitionresizing when using libparted..
//this is especially important while copying fat* FS's
fs .copy = GParted::FS::GPARTED ;
fs .MIN = 32 * MEBIBYTE ; //smaller fs'es will cause windows scandisk to fail..
@ -102,20 +103,7 @@ bool fat32::Copy( const Glib::ustring & src_part_path,
const Glib::ustring & dest_part_path,
std::vector<OperationDetails> & operation_details )
{
operation_details .push_back( OperationDetails(
String::ucompose( _("copy contents of %1 to %2"), src_part_path, dest_part_path ) ) ) ;
if ( ! execute_command( "dd bs=8192 if=" + src_part_path + " of=" + dest_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 true ;
}
bool fat32::Check_Repair( const Partition & partition, std::vector<OperationDetails> & operation_details )

View File

@ -33,8 +33,7 @@ FS hfs::get_filesystem_support()
if ( ! Glib::find_program_in_path( "hformat" ) .empty() )
fs .create = GParted::FS::EXTERNAL ;
if ( ! Glib::find_program_in_path( "dd" ) .empty() )
fs .copy = GParted::FS::EXTERNAL ;
fs .copy = GParted::FS::GPARTED ;
fs .MAX = 2048 * MEBIBYTE ;
@ -74,20 +73,7 @@ bool hfs::Copy( const Glib::ustring & src_part_path,
const Glib::ustring & dest_part_path,
std::vector<OperationDetails> & operation_details )
{
operation_details .push_back( OperationDetails(
String::ucompose( _("copy contents of %1 to %2"), src_part_path, dest_part_path ) ) ) ;
if ( ! execute_command( "dd bs=8192 if=" + src_part_path + " of=" + dest_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 true ;
}
bool hfs::Check_Repair( const Partition & partition, std::vector<OperationDetails> & operation_details )

View File

@ -30,8 +30,7 @@ FS hfsplus::get_filesystem_support( )
fs .read = GParted::FS::LIBPARTED ;
fs .shrink = GParted::FS::LIBPARTED ;
if ( ! Glib::find_program_in_path( "dd" ) .empty() )
fs .copy = GParted::FS::EXTERNAL ;
fs .copy = GParted::FS::GPARTED ;
return fs ;
}
@ -56,20 +55,7 @@ bool hfsplus::Copy( const Glib::ustring & src_part_path,
const Glib::ustring & dest_part_path,
std::vector<OperationDetails> & operation_details )
{
operation_details .push_back( OperationDetails(
String::ucompose( _("copy contents of %1 to %2"), src_part_path, dest_part_path ) ) ) ;
if ( ! execute_command( "dd bs=8192 if=" + src_part_path + " of=" + dest_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 true ;
}
bool hfsplus::Check_Repair( const Partition & partition, std::vector<OperationDetails> & operation_details )

View File

@ -57,9 +57,9 @@ FS jfs::get_filesystem_support()
input .close() ;
}
}
if ( ! Glib::find_program_in_path( "dd" ) .empty() && fs .grow )
fs .copy = GParted::FS::EXTERNAL ;
if ( fs .grow )
fs .copy = GParted::FS::GPARTED ;
fs .MIN = 16 * MEBIBYTE ;
@ -203,21 +203,7 @@ bool jfs::Copy( const Glib::ustring & src_part_path,
const Glib::ustring & dest_part_path,
std::vector<OperationDetails> & operation_details )
{
operation_details .push_back( OperationDetails(
String::ucompose( _("copy contents of %1 to %2"), src_part_path, dest_part_path ) ) ) ;
if ( ! execute_command( "dd bs=8192 if=" + src_part_path + " of=" + dest_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 true ;
}
bool jfs::Check_Repair( const Partition & partition, std::vector<OperationDetails> & operation_details )

View File

@ -34,8 +34,7 @@ FS linux_swap::get_filesystem_support()
fs .move = GParted::FS::EXTERNAL ;
}
if ( ! Glib::find_program_in_path( "dd" ) .empty() )
fs .copy = GParted::FS::EXTERNAL ;
fs .copy = GParted::FS::GPARTED ;
return fs ;
}
@ -74,20 +73,7 @@ bool linux_swap::Copy( const Glib::ustring & src_part_path,
const Glib::ustring & dest_part_path,
std::vector<OperationDetails> & operation_details )
{
operation_details .push_back( OperationDetails(
String::ucompose( _("copy contents of %1 to %2"), src_part_path, dest_part_path ) ) ) ;
if ( ! execute_command( "dd bs=8192 if=" + src_part_path + " of=" + dest_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 true ;
}
bool linux_swap::Check_Repair( const Partition & partition, std::vector<OperationDetails> & operation_details )

View File

@ -138,9 +138,6 @@ bool ntfs::Copy( const Glib::ustring & src_part_path,
const Glib::ustring & dest_part_path,
std::vector<OperationDetails> & operation_details )
{
operation_details .push_back( OperationDetails(
String::ucompose( _("copy contents of %1 to %2"), src_part_path, dest_part_path ) ) ) ;
if ( ! execute_command( "ntfsclone -f --overwrite " + dest_part_path + " " + src_part_path,
operation_details .back() .sub_details ) )
{

View File

@ -35,8 +35,7 @@ FS reiser4::get_filesystem_support()
if ( ! Glib::find_program_in_path( "fsck.reiser4" ) .empty() )
fs .check = GParted::FS::EXTERNAL ;
if ( ! Glib::find_program_in_path( "dd" ) .empty() )
fs .copy = GParted::FS::EXTERNAL ;
fs .copy = GParted::FS::GPARTED ;
/*
* IT SEEMS RESIZE AND COPY AREN'T IMPLEMENTED YET IN THE TOOLS...
@ -96,20 +95,7 @@ bool reiser4::Copy( const Glib::ustring & src_part_path,
const Glib::ustring & dest_part_path,
std::vector<OperationDetails> & operation_details )
{
operation_details .push_back( OperationDetails(
String::ucompose( _("copy contents of %1 to %2"), src_part_path, dest_part_path ) ) ) ;
if ( ! execute_command( "dd bs=8192 if=" + src_part_path + " of=" + dest_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 true ;
}
bool reiser4::Check_Repair( const Partition & partition, std::vector<OperationDetails> & operation_details )

View File

@ -39,15 +39,12 @@ FS reiserfs::get_filesystem_support()
if ( ! Glib::find_program_in_path( "resize_reiserfs" ) .empty() && fs .check )
{
fs .grow = GParted::FS::EXTERNAL ;
fs .copy = GParted::FS::GPARTED ;
if ( fs .read ) //needed to determine a min filesystemsize..
fs .shrink = GParted::FS::EXTERNAL ;
}
//we need to call resize_reiserfs after a copy to get proper used/unused
if ( ! Glib::find_program_in_path( "dd" ) .empty() && fs .grow )
fs .copy = GParted::FS::EXTERNAL ;
fs .MIN = 32 * MEBIBYTE ;
return fs ;
@ -109,8 +106,9 @@ bool reiserfs::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_BYTE ) ), true ) ;
}
if ( ! execute_command( str_temp, operation_details .back() .sub_details ) )
exit_status = execute_command( str_temp, operation_details .back() .sub_details ) ;
if ( exit_status == 0 || exit_status == 256 )
{
operation_details .back() .status = OperationDetails::SUCCES ;
return true ;
@ -126,20 +124,7 @@ bool reiserfs::Copy( const Glib::ustring & src_part_path,
const Glib::ustring & dest_part_path,
std::vector<OperationDetails> & operation_details )
{
operation_details .push_back( OperationDetails(
String::ucompose( _("copy contents of %1 to %2"), src_part_path, dest_part_path ) ) ) ;
if ( ! execute_command( "dd bs=8192 if=" + src_part_path + " of=" + dest_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 true ;
}
bool reiserfs::Check_Repair( const Partition & partition, std::vector<OperationDetails> & operation_details )

View File

@ -203,9 +203,6 @@ bool xfs::Copy( const Glib::ustring & src_part_path,
const Glib::ustring & dest_part_path,
std::vector<OperationDetails> & operation_details )
{
operation_details .push_back( OperationDetails(
String::ucompose( _("copy contents of %1 to %2"), src_part_path, dest_part_path ) ) ) ;
bool return_value = false ;
Glib::ustring error ;
Glib::ustring SRC = Glib::get_tmp_dir() + "/gparted_tmp_xfs_src_mountpoint" ;