fixed small bug with resizing and lower limits. use
* src/Dialog_Partition_Resize_Move.cc: fixed small bug with resizing and lower limits. * src/GParted_Core.cc: use ped_file_system_clobber before creating a filesystem on a partition. * src/Win_GParted.cc: pasting is now only allowed if unallocated >= copied partition + cylindersize. Instead of dividing length device by amount of cylinders i use heads * sectors/track to get cylindersize. Changed device busy warning a bit to more decent english (adamw) * src/ntfs.cc: readded '-Q' to mkntfs. The error about an 'unknown filesystem' was related to detection problems and not to faulty creation of the filesystem. Should be solved anyway by implementing ped_file_system_clobber. Also removed ntfsfix since it didn't do anything relevant. Instead i use ntfsresize, because this contains relevant checks (szaka)
This commit is contained in:
parent
a5a0fae337
commit
3271197086
13
ChangeLog
13
ChangeLog
|
@ -1,3 +1,14 @@
|
||||||
|
2004-11-24 Bart Hakvoort <gparted@users.sf.net>
|
||||||
|
|
||||||
|
* src/Dialog_Partition_Resize_Move.cc: fixed small bug with resizing and lower limits.
|
||||||
|
* src/GParted_Core.cc: use ped_file_system_clobber before creating a filesystem on a partition.
|
||||||
|
* src/Win_GParted.cc: pasting is now only allowed if unallocated >= copied partition + cylindersize.
|
||||||
|
Instead of dividing length device by amount of cylinders i use heads * sectors/track to get cylindersize.
|
||||||
|
Changed device busy warning a bit to more decent english (adamw)
|
||||||
|
* src/ntfs.cc: readded '-Q' to mkntfs. The error about an 'unknown filesystem' was related to detection problems and not to
|
||||||
|
faulty creation of the filesystem. Should be solved anyway by implementing ped_file_system_clobber.
|
||||||
|
Also removed ntfsfix since it didn't do anything relevant. Instead i use ntfsresize, because this contains relevant checks (szaka)
|
||||||
|
|
||||||
2004-11-24 Bart Hakvoort <gparted@users.sf.net>
|
2004-11-24 Bart Hakvoort <gparted@users.sf.net>
|
||||||
|
|
||||||
* src/TreeView_Detail.cc: renamed columnheader from 'Type' to 'Filesystem'. Dunno why it was called 'Type' (maybe some PM legacy =) )
|
* src/TreeView_Detail.cc: renamed columnheader from 'Type' to 'Filesystem'. Dunno why it was called 'Type' (maybe some PM legacy =) )
|
||||||
|
@ -30,7 +41,7 @@
|
||||||
src/GParted_Core.cc,
|
src/GParted_Core.cc,
|
||||||
src/Makefile.am,
|
src/Makefile.am,
|
||||||
include/ntfs.h,
|
include/ntfs.h,
|
||||||
src/ntfs.cc: added full ntfs support. (couldn't test it very will due to the absence of a win32 box :P )
|
src/ntfs.cc: added full ntfs support. (couldn't test it very well due to the absence of a win32 box :P )
|
||||||
|
|
||||||
2004-11-22 Bart Hakvoort <gparted@users.sf.net>
|
2004-11-22 Bart Hakvoort <gparted@users.sf.net>
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,11 @@ namespace GParted
|
||||||
Dialog_Partition_Resize_Move::Dialog_Partition_Resize_Move( std::vector<FS> FILESYSTEMS, Sector cylinder_size )
|
Dialog_Partition_Resize_Move::Dialog_Partition_Resize_Move( std::vector<FS> FILESYSTEMS, Sector cylinder_size )
|
||||||
{
|
{
|
||||||
this ->FILESYSTEMS = FILESYSTEMS ;
|
this ->FILESYSTEMS = FILESYSTEMS ;
|
||||||
|
|
||||||
|
//some disk have a small cylindersize, for safetyreasons i keep this size at >=1
|
||||||
|
if ( cylinder_size < 2048 )
|
||||||
|
cylinder_size = 2048 ;
|
||||||
|
|
||||||
BUF = Sector_To_MB( cylinder_size ) *2 ;
|
BUF = Sector_To_MB( cylinder_size ) *2 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,14 +116,16 @@ void Dialog_Partition_Resize_Move::Resize_Move_Normal( const std::vector <Partit
|
||||||
|
|
||||||
//since some filesystems have upper and lower limits we need to check for this
|
//since some filesystems have upper and lower limits we need to check for this
|
||||||
long LOWER, UPPER;
|
long LOWER, UPPER;
|
||||||
if ( selected_partition.filesystem == "fat16" && selected_partition .Get_Used_MB() < 32 )
|
if ( selected_partition .filesystem == "fat16" && selected_partition .Get_Used_MB( ) < 32 )
|
||||||
LOWER = 32 +BUF ;
|
LOWER = 32 ;
|
||||||
else if ( selected_partition.filesystem == "fat32" && selected_partition .Get_Used_MB() < 256 )
|
else if ( selected_partition .filesystem == "fat32" && selected_partition .Get_Used_MB( ) < 256 )
|
||||||
LOWER = 256 +BUF;
|
LOWER = 256 ;
|
||||||
else if ( selected_partition.filesystem == "reiserfs" && selected_partition .Get_Used_MB() < 40 )
|
else if ( selected_partition .filesystem == "reiserfs" && selected_partition .Get_Used_MB( ) < 40 )
|
||||||
LOWER = 40 ;
|
LOWER = 40 ;
|
||||||
else
|
else
|
||||||
LOWER = selected_partition .Get_Used_MB() +BUF;
|
LOWER = selected_partition .Get_Used_MB( ) ;
|
||||||
|
|
||||||
|
LOWER += BUF ;
|
||||||
|
|
||||||
//in certain (rare) case LOWER is a bit too high...
|
//in certain (rare) case LOWER is a bit too high...
|
||||||
if ( LOWER > selected_partition .Get_Length_MB( ) )
|
if ( LOWER > selected_partition .Get_Length_MB( ) )
|
||||||
|
@ -139,7 +146,7 @@ void Dialog_Partition_Resize_Move::Resize_Move_Normal( const std::vector <Partit
|
||||||
|
|
||||||
//set values of spinbutton_size
|
//set values of spinbutton_size
|
||||||
spinbutton_size .set_range( LOWER, UPPER ) ;
|
spinbutton_size .set_range( LOWER, UPPER ) ;
|
||||||
spinbutton_size .set_value( selected_partition .Get_Length_MB() ) ;
|
spinbutton_size .set_value( selected_partition .Get_Length_MB( ) ) ;
|
||||||
|
|
||||||
//set values of spinbutton_after
|
//set values of spinbutton_after
|
||||||
spinbutton_after .set_range( 0, Sector_To_MB( total_length ) - LOWER ) ;
|
spinbutton_after .set_range( 0, Sector_To_MB( total_length ) - LOWER ) ;
|
||||||
|
|
|
@ -289,6 +289,17 @@ bool GParted_Core::Create( const Glib::ustring & device_path, Partition & new_pa
|
||||||
|
|
||||||
bool GParted_Core::Convert_FS( const Glib::ustring & device_path, const Partition & partition )
|
bool GParted_Core::Convert_FS( const Glib::ustring & device_path, const Partition & partition )
|
||||||
{
|
{
|
||||||
|
//remove all filesystem signatures...
|
||||||
|
if ( open_device_and_disk( device_path, device, disk ) )
|
||||||
|
{
|
||||||
|
c_partition = ped_disk_get_partition_by_sector( disk, (partition .sector_end + partition .sector_start) / 2 ) ;
|
||||||
|
|
||||||
|
if ( c_partition )
|
||||||
|
ped_file_system_clobber ( & c_partition ->geom ) ;
|
||||||
|
|
||||||
|
close_device_and_disk( device, disk ) ;
|
||||||
|
}
|
||||||
|
|
||||||
set_proper_filesystem( partition .filesystem ) ;
|
set_proper_filesystem( partition .filesystem ) ;
|
||||||
|
|
||||||
return p_filesystem ->Create( device_path, partition ) ;
|
return p_filesystem ->Create( device_path, partition ) ;
|
||||||
|
@ -470,6 +481,9 @@ int GParted_Core::Create_Empty_Partition( const Glib::ustring & device_path, Par
|
||||||
|
|
||||||
if ( ped_disk_add_partition ( disk, c_part, constraint ) && Commit( disk ) )
|
if ( ped_disk_add_partition ( disk, c_part, constraint ) && Commit( disk ) )
|
||||||
{
|
{
|
||||||
|
//remove all filesystem signatures...
|
||||||
|
ped_file_system_clobber ( & c_part ->geom ) ;
|
||||||
|
|
||||||
sleep( 1 ) ;//the OS needs some time to create the devicenode in /dev
|
sleep( 1 ) ;//the OS needs some time to create the devicenode in /dev
|
||||||
|
|
||||||
new_partition .partition = ped_partition_get_path( c_part ) ;
|
new_partition .partition = ped_partition_get_path( c_part ) ;
|
||||||
|
|
|
@ -586,8 +586,16 @@ void Win_GParted::Set_Valid_Operations()
|
||||||
allow_new( true );
|
allow_new( true );
|
||||||
|
|
||||||
//find out if there is a copied partition and if it fits inside this unallocated space
|
//find out if there is a copied partition and if it fits inside this unallocated space
|
||||||
if ( copied_partition .partition != "NONE" && copied_partition .Get_Length_MB( ) < selected_partition .Get_Length_MB( ) )
|
if ( copied_partition .partition != "NONE" )
|
||||||
allow_paste( true ) ;
|
{
|
||||||
|
//calculate cylindersize
|
||||||
|
long cylinder_size = Sector_To_MB( devices[ current_device ] .heads * devices[ current_device ] .sectors ) ;
|
||||||
|
if ( cylinder_size < 1 )
|
||||||
|
cylinder_size = 1 ;
|
||||||
|
|
||||||
|
if ( (copied_partition .Get_Length_MB( ) + cylinder_size) < selected_partition .Get_Length_MB( ) )
|
||||||
|
allow_paste( true ) ;
|
||||||
|
}
|
||||||
|
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
|
@ -846,7 +854,7 @@ void Win_GParted::activate_resize()
|
||||||
operations[ t ] .Apply_Operation_To_Visual( partitions ) ;
|
operations[ t ] .Apply_Operation_To_Visual( partitions ) ;
|
||||||
|
|
||||||
|
|
||||||
Dialog_Partition_Resize_Move dialog( gparted_core .get_fs( ), devices[ current_device ] .length / devices[ current_device ] .cylinders ) ;
|
Dialog_Partition_Resize_Move dialog( gparted_core .get_fs( ), devices[ current_device ] .heads * devices[ current_device ] .sectors ) ;
|
||||||
|
|
||||||
if ( selected_partition .type == GParted::LOGICAL )
|
if ( selected_partition .type == GParted::LOGICAL )
|
||||||
{
|
{
|
||||||
|
@ -1161,7 +1169,7 @@ void Win_GParted::activate_apply()
|
||||||
str_temp += "</span>\n\n" ;
|
str_temp += "</span>\n\n" ;
|
||||||
str_temp += _("A busy device is a device with at least one mounted partition.") ;
|
str_temp += _("A busy device is a device with at least one mounted partition.") ;
|
||||||
str_temp += "\n";
|
str_temp += "\n";
|
||||||
str_temp += _("Since making changes to a busy device may confuse the kernel it is advisable to reboot your computer.") ;
|
str_temp += _("Because making changes to a busy device may confuse the kernel, you are advised to reboot your computer.") ;
|
||||||
|
|
||||||
Gtk::MessageDialog dialog( *this, str_temp, true, Gtk::MESSAGE_WARNING, Gtk::BUTTONS_OK, true );
|
Gtk::MessageDialog dialog( *this, str_temp, true, Gtk::MESSAGE_WARNING, Gtk::BUTTONS_OK, true );
|
||||||
dialog .run( ) ;
|
dialog .run( ) ;
|
||||||
|
|
|
@ -72,7 +72,7 @@ void ntfs::Set_Used_Sectors( Partition & partition )
|
||||||
|
|
||||||
bool ntfs::Create( const Glib::ustring device_path, const Partition & new_partition )
|
bool ntfs::Create( const Glib::ustring device_path, const Partition & new_partition )
|
||||||
{
|
{
|
||||||
return Execute_Command( "mkntfs " + new_partition .partition ) ;
|
return Execute_Command( "mkntfs -Q " + new_partition .partition ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ntfs::Resize( const Partition & partition_new, bool fill_partition )
|
bool ntfs::Resize( const Partition & partition_new, bool fill_partition )
|
||||||
|
@ -95,7 +95,9 @@ bool ntfs::Copy( const Glib::ustring & src_part_path, const Glib::ustring & dest
|
||||||
|
|
||||||
bool ntfs::Check_Repair( const Partition & partition )
|
bool ntfs::Check_Repair( const Partition & partition )
|
||||||
{
|
{
|
||||||
return Execute_Command( "ntfsfix " + partition .partition ) ;
|
//according to Szaka it's best to use ntfsresize to check the partition for errors
|
||||||
|
//since --info is read-only i'll leave it out. just calling ntfsresize --force has also a tendency of fixing stuff :)
|
||||||
|
return Execute_Command( "echo y | ntfsresize -f " + partition .partition ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ntfs::get_estimated_time( long MB_to_Consider )
|
int ntfs::get_estimated_time( long MB_to_Consider )
|
||||||
|
|
Loading…
Reference in New Issue