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:
parent
e4210ba08d
commit
a92380b503
|
@ -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; };
|
||||
|
|
|
@ -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 ) ;
|
||||
};
|
||||
|
||||
|
|
|
@ -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 ) ;
|
||||
|
||||
|
|
|
@ -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 ) ;
|
||||
};
|
||||
|
|
|
@ -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 ;
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 );
|
||||
|
|
14
src/xfs.cc
14
src/xfs.cc
|
@ -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 ) ;
|
||||
|
|
Loading…
Reference in New Issue