Pass Partition instead of just its path to FileSystem::copy()

Other operations get the Partition object and can look up the path or other
attributes they need.  The copy method should be no different.
This commit is contained in:
Phillip Susi 2013-01-30 21:35:52 -05:00 committed by Curtis Gedak
parent e4210ba08d
commit a92380b503
8 changed files with 22 additions and 22 deletions

View file

@ -52,8 +52,8 @@ public:
, const Partition & partition_old
, OperationDetail & operationdetail
) { return false; };
virtual bool copy( const Glib::ustring & src_part_path,
const Glib::ustring & dest_part_path,
virtual bool copy( const Partition & src_part,
Partition & dest_part,
OperationDetail & operationdetail ) { return false; };
virtual bool check_repair( const Partition & partition, OperationDetail & operationdetail ) { return false; };
virtual bool remove( const Partition & partition, OperationDetail & operationdetail ) { return true; };

View file

@ -41,8 +41,8 @@ public:
, const Partition & partition_old
, OperationDetail & operationdetail
) ;
bool copy( const Glib::ustring & src_part_path,
const Glib::ustring & dest_part_path,
bool copy( const Partition & src_part,
Partition & dest_part,
OperationDetail & operationdetail ) ;
};

View file

@ -37,8 +37,8 @@ public:
bool write_uuid( const Partition & partition, OperationDetail & operationdetail ) ;
bool create( const Partition & new_partition, OperationDetail & operationdetail ) ;
bool resize( const Partition & partition_new, OperationDetail & operationdetail, bool fill_partition = false ) ;
bool copy( const Glib::ustring & src_part_path,
const Glib::ustring & dest_part_path,
bool copy( const Partition & src_part,
Partition & dest_part,
OperationDetail & operationdetail ) ;
bool check_repair( const Partition & partition, OperationDetail & operationdetail ) ;

View file

@ -36,8 +36,8 @@ public:
bool write_uuid( const Partition & partition, OperationDetail & operationdetail ) ;
bool create( const Partition & new_partition, OperationDetail & operationdetail ) ;
bool resize( const Partition & partition_new, OperationDetail & operationdetail, bool fill_partition = false ) ;
bool copy( const Glib::ustring & src_part_path,
const Glib::ustring & dest_part_path,
bool copy( const Partition & src_part,
Partition & dest_part,
OperationDetail & operationdetail ) ;
bool check_repair( const Partition & partition, OperationDetail & operationdetail ) ;
};

View file

@ -2616,8 +2616,8 @@ bool GParted_Core::copy( const Partition & partition_src,
case GParted::FS::EXTERNAL :
succes = ( p_filesystem = set_proper_filesystem( partition_dst .filesystem ) ) &&
p_filesystem ->copy( partition_src .get_path(),
partition_dst .get_path(),
p_filesystem ->copy( partition_src,
partition_dst,
operationdetail .get_last_child() ) ;
break ;

View file

@ -149,8 +149,8 @@ bool linux_swap::move( const Partition & partition_new
return true ;
}
bool linux_swap::copy( const Glib::ustring & src_part_path,
const Glib::ustring & dest_part_path,
bool linux_swap::copy( const Partition & src_part,
Partition & dest_part,
OperationDetail & operationdetail )
{
//Since linux-swap does not contain data, do not actually copy the partition

View file

@ -224,11 +224,11 @@ bool ntfs::resize( const Partition & partition_new, OperationDetail & operationd
return return_value ;
}
bool ntfs::copy( const Glib::ustring & src_part_path,
const Glib::ustring & dest_part_path,
bool ntfs::copy( const Partition & src_part,
Partition & dest_part,
OperationDetail & operationdetail )
{
return ! execute_command( "ntfsclone -f --overwrite " + dest_part_path + " " + src_part_path,
return ! execute_command( "ntfsclone -f --overwrite " + dest_part.get_path() + " " + src_part.get_path(),
operationdetail,
false,
true );

View file

@ -194,13 +194,13 @@ bool xfs::resize( const Partition & partition_new, OperationDetail & operationde
return success ;
}
bool xfs::copy( const Glib::ustring & src_part_path,
const Glib::ustring & dest_part_path,
bool xfs::copy( const Partition & src_part,
Partition & dest_part,
OperationDetail & operationdetail )
{
bool success = true ;
success &= ! execute_command( "mkfs.xfs -f " + dest_part_path, operationdetail, true, true );
success &= ! execute_command( "mkfs.xfs -f " + dest_part.get_path(), operationdetail, true, true );
if ( ! success )
return false ;
@ -215,12 +215,12 @@ bool xfs::copy( const Glib::ustring & src_part_path,
return false ;
}
success &= ! execute_command( "mount -v -t xfs -o noatime,ro " + src_part_path +
success &= ! execute_command( "mount -v -t xfs -o noatime,ro " + src_part.get_path() +
" " + src_mount_point, operationdetail, true ) ;
if ( success )
{
success &= ! execute_command( "mount -v -t xfs " + dest_part_path +
success &= ! execute_command( "mount -v -t xfs " + dest_part.get_path() +
" " + dest_mount_point, operationdetail, true ) ;
if ( success )
@ -229,10 +229,10 @@ bool xfs::copy( const Glib::ustring & src_part_path,
" | xfsrestore -J - " + dest_mount_point + "'",
operationdetail, true, true );
success &= ! execute_command( "umount -v " + dest_part_path, operationdetail, true ) ;
success &= ! execute_command( "umount -v " + dest_part.get_path(), operationdetail, true ) ;
}
success &= ! execute_command( "umount -v " + src_part_path, operationdetail, true ) ;
success &= ! execute_command( "umount -v " + src_part.get_path(), operationdetail, true ) ;
}
rm_temp_dir( dest_mount_point, operationdetail ) ;