removed cylindersize buffering during resize from the filesystems. It is

* include/FileSystem.h,
  include/GParted_Core.h,
  src/FileSystem.cc,
  src/GParted_Core.cc,
  src/ext2.cc,
  src/ext3.cc,
  src/ntfs.cc,
  src/reiserfs.cc: removed cylindersize buffering during resize from
  the filesystems. It is not needed anymore now we calculate the new
  position before calling this.
  Also added some extra progressfeedback in the core
This commit is contained in:
Bart Hakvoort 2006-07-23 18:43:15 +00:00
parent 8059d5f6d9
commit d663c3c277
9 changed files with 46 additions and 38 deletions

View File

@ -1,3 +1,17 @@
2006-07-23 Bart Hakvoort <hakvoort@cvs.gnome.org>
* include/FileSystem.h,
include/GParted_Core.h,
src/FileSystem.cc,
src/GParted_Core.cc,
src/ext2.cc,
src/ext3.cc,
src/ntfs.cc,
src/reiserfs.cc: removed cylindersize buffering during resize from
the filesystems. It is not needed anymore now we calculate the new
position before calling this.
Also added some extra progressfeedback in the core
2006-07-23 Bart Hakvoort <hakvoort@cvs.gnome.org>
* include/GParted_Core.h,

View File

@ -44,8 +44,6 @@ public:
std::vector<OperationDetails> & operation_details ) = 0 ;
virtual bool Check_Repair( const Partition & partition, std::vector<OperationDetails> & operation_details ) = 0 ;
Sector cylinder_size ; //see GParted_Core::resize()
protected:
int execute_command( const Glib::ustring & command, std::vector<OperationDetails> & operation_details ) ;

View File

@ -101,8 +101,7 @@ private:
bool resize_move_filesystem_using_libparted( const Partition & partition_old,
const Partition & partition_new,
std::vector<OperationDetails> & operation_details ) ;
bool resize( const Device & device,
const Partition & partition_old,
bool resize( const Partition & partition_old,
const Partition & partition_new,
std::vector<OperationDetails> & operation_detail ) ;
bool resize_move_partition( const Partition & partition_old,
@ -111,7 +110,6 @@ private:
bool resize_filesystem( const Partition & partition_old,
const Partition & partition_new,
std::vector<OperationDetails> & operation_details,
Sector cylinder_size = 0,
bool fill_partition = false ) ;
bool maximize_filesystem( const Partition & partition,
std::vector<OperationDetails> & operation_details ) ;
@ -141,7 +139,7 @@ private:
Partition & partition_new,
std::vector<OperationDetails> & operation_details,
Sector min_size = -1 ) ;
void set_proper_filesystem( const FILESYSTEM & filesystem, Sector cylinder_size = 0 ) ;
void set_proper_filesystem( const FILESYSTEM & filesystem ) ;
bool wait_for_node( const Glib::ustring & node ) ;
bool erase_filesystem_signatures( const Partition & partition ) ;

View File

@ -23,7 +23,6 @@ namespace GParted
FileSystem::FileSystem()
{
cylinder_size = 0 ;
}
int FileSystem::execute_command( const Glib::ustring & command, std::vector<OperationDetails> & operation_details )

View File

@ -977,7 +977,9 @@ bool GParted_Core::create_partition( Partition & new_partition,
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() ) ) +
String::ucompose( _("size: %1 (%2)"),
new_partition .get_length(),
Utils::format_size( new_partition .get_length() ) ) +
"</i>",
OperationDetails::NONE ) ) ;
}
@ -1080,25 +1082,25 @@ bool GParted_Core::resize_move( const Device & device,
//see if we need move or resize..
if ( partition_new .sector_start == partition_old .sector_start )
return resize( device, partition_old, partition_new, operation_details ) ;
return resize( partition_old, partition_new, operation_details ) ;
else if ( partition_new .get_length() > partition_old .get_length() )
{
//first move, then grow...
Partition temp = partition_new ;
temp .sector_end = temp .sector_start + partition_old .get_length() ;
temp .sector_end = temp .sector_start + partition_old .get_length() -1 ;
return calculate_exact_geom( partition_old, temp, operation_details, temp .get_length() ) &&
move( device, partition_old, temp, operation_details ) &&
resize( device, temp, partition_new, operation_details ) ;
resize( temp, partition_new, operation_details ) ;
}
else if ( partition_new .get_length() < partition_old .get_length() )
{
//first shrink, then move..
Partition temp = partition_old ;
temp .sector_end = partition_old .sector_start + partition_new .get_length() ;
temp .sector_end = partition_old .sector_start + partition_new .get_length() -1 ;
return calculate_exact_geom( partition_old, temp, operation_details ) &&
resize( device, partition_old, temp, operation_details ) &&
resize( partition_old, temp, operation_details ) &&
calculate_exact_geom( temp, partition_new, operation_details, temp .get_length() ) &&
move( device, temp, partition_new, operation_details ) ;
}
@ -1355,8 +1357,7 @@ bool GParted_Core::resize_move_filesystem_using_libparted( const Partition & par
return return_value ;
}
bool GParted_Core::resize( const Device & device,
const Partition & partition_old,
bool GParted_Core::resize( const Partition & partition_old,
const Partition & partition_new,
std::vector<OperationDetails> & operation_details )
{
@ -1365,11 +1366,8 @@ bool GParted_Core::resize( const Device & device,
{
succes = true ;
//FIXME, find another way to resolve this cylsize problem...
//i think we don't need cylsize here anymore.. now partition_new is _exact_ we don't have to buffer
//for security.
if ( succes && partition_new .get_length() < partition_old .get_length() )
succes = resize_filesystem( partition_old, partition_new, operation_details, device .cylsize ) ;
succes = resize_filesystem( partition_old, partition_new, operation_details ) ;
if ( succes )
succes = resize_move_partition(
@ -1385,9 +1383,6 @@ bool GParted_Core::resize( const Device & device,
if ( ! maximize_filesystem( partition_new, operation_details ) )
succes = false ;
if ( ! check_repair( partition_new, operation_details ) )
succes = false ;
return succes ;
}
@ -1478,7 +1473,9 @@ bool GParted_Core::resize_move_partition( const Partition & partition_old,
"<i>" +
String::ucompose( _("old start: %1"), partition_old .sector_start ) + "\n" +
String::ucompose( _("old end: %1"), partition_old .sector_end ) + "\n" +
String::ucompose( _("old size: %1"), Utils::format_size( partition_old .get_length() ) ) +
String::ucompose( _("old size: %1 (%2)"),
partition_old .get_length(),
Utils::format_size( partition_old .get_length() ) ) +
"</i>",
OperationDetails::NONE ) ) ;
@ -1528,7 +1525,9 @@ bool GParted_Core::resize_move_partition( const Partition & partition_old,
"<i>" +
String::ucompose( _("new start: %1"), lp_partition ->geom .start ) + "\n" +
String::ucompose( _("new end: %1"), lp_partition ->geom .end ) + "\n" +
String::ucompose( _("new size: %1"), Utils::format_size( lp_partition ->geom .length ) ) +
String::ucompose( _("new size: %1 (%2)"),
lp_partition ->geom .length,
Utils::format_size( lp_partition ->geom .length ) ) +
"</i>",
OperationDetails::NONE ) ) ;
}
@ -1553,7 +1552,6 @@ bool GParted_Core::resize_move_partition( const Partition & partition_old,
bool GParted_Core::resize_filesystem( const Partition & partition_old,
const Partition & partition_new,
std::vector<OperationDetails> & operation_details,
Sector cylinder_size,
bool fill_partition )
{
//by default 'grow' to accomodate expand_filesystem()
@ -1593,7 +1591,7 @@ bool GParted_Core::resize_filesystem( const Partition & partition_old,
operation_details .back() .sub_details ) ;
break ;
case GParted::FS::EXTERNAL:
set_proper_filesystem( partition_new .filesystem, cylinder_size ) ;
set_proper_filesystem( partition_new .filesystem ) ;
succes = ( p_filesystem &&
p_filesystem ->Resize( partition_new,
operation_details .back() .sub_details,
@ -1623,7 +1621,7 @@ bool GParted_Core::maximize_filesystem( const Partition & partition,
return true ;
}
return resize_filesystem( partition, partition, operation_details, 0, true ) ;
return resize_filesystem( partition, partition, operation_details, true ) ;
}
bool GParted_Core::copy( const Partition & partition_src,
@ -1910,7 +1908,9 @@ bool GParted_Core::calculate_exact_geom( const Partition & partition_old,
"<i>" +
String::ucompose( _("requested start: %1"), partition_new .sector_start ) + "\n" +
String::ucompose( _("requested end: %1"), partition_new .sector_end ) + "\n" +
String::ucompose( _("requested size: %1"), Utils::format_size( partition_new .get_length() ) ) +
String::ucompose( _("requested size: %1 (%2)"),
partition_new .get_length(),
Utils::format_size( partition_new .get_length() ) ) +
"</i>",
OperationDetails::NONE ) ) ;
@ -1965,7 +1965,9 @@ bool GParted_Core::calculate_exact_geom( const Partition & partition_old,
"<i>" +
String::ucompose( _("new start: %1"), partition_new .sector_start ) + "\n" +
String::ucompose( _("new end: %1"), partition_new .sector_end ) + "\n" +
String::ucompose( _("new size: %1"), Utils::format_size( partition_new .get_length() ) ) +
String::ucompose( _("new size: %1 (%2)"),
partition_new .get_length(),
Utils::format_size( partition_new .get_length() ) ) +
"</i>",
OperationDetails::NONE ) ) ;
}
@ -1977,7 +1979,7 @@ bool GParted_Core::calculate_exact_geom( const Partition & partition_old,
return succes ;
}
void GParted_Core::set_proper_filesystem( const FILESYSTEM & filesystem, Sector cylinder_size )
void GParted_Core::set_proper_filesystem( const FILESYSTEM & filesystem )
{
if ( p_filesystem )
delete p_filesystem ;
@ -2000,9 +2002,6 @@ void GParted_Core::set_proper_filesystem( const FILESYSTEM & filesystem, Sector
default : p_filesystem = NULL ;
}
if ( p_filesystem )
p_filesystem ->cylinder_size = cylinder_size ;
}
bool GParted_Core::wait_for_node( const Glib::ustring & node )

View File

@ -85,7 +85,7 @@ bool ext2::Resize( const Partition & partition_new,
if ( ! fill_partition )
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(), GParted::UNIT_KIB ) ) -1, true ) + "K" ;
return ! execute_command( str_temp, operation_details ) ;
}

View File

@ -86,7 +86,7 @@ bool ext3::Resize( const Partition & partition_new,
if ( ! fill_partition )
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(), GParted::UNIT_KIB ) ) -1, true ) + "K" ;
return ! execute_command( str_temp, operation_details ) ;
}

View File

@ -86,7 +86,7 @@ bool ntfs::Resize( const Partition & partition_new,
{
str_temp += " -s " ;
str_temp += Utils::num_to_str( Utils::round( Utils::sector_to_unit(
partition_new .get_length() - cylinder_size, GParted::UNIT_BYTE ) ), true ) ;
partition_new .get_length(), GParted::UNIT_BYTE ) ) -1, true ) ;
}
//simulation..

View File

@ -91,7 +91,7 @@ bool reiserfs::Resize( const Partition & partition_new,
{
str_temp += " -s " ;
str_temp += Utils::num_to_str( Utils::round( Utils::sector_to_unit(
partition_new .get_length() - cylinder_size, GParted::UNIT_BYTE ) ), true ) ;
partition_new .get_length(), GParted::UNIT_BYTE ) ) -1, true ) ;
}
exit_status = execute_command( str_temp, operation_details ) ;