Replaced boolean 'resize' with 'shrink' and 'grow'. It seems some
* Replaced boolean 'resize' with 'shrink' and 'grow'. It seems some filesystems only support growing (e.g. xfs) so i need two flags to control the behaviour of the filesystemclasses.
This commit is contained in:
parent
47f357a8c4
commit
4815b17153
|
@ -1,3 +1,8 @@
|
|||
2004-12-13 Bart Hakvoort <gparted@users.sf.net>
|
||||
|
||||
* Replaced boolean 'resize' with 'shrink' and 'grow'. It seems some filesystems only support growing (e.g. xfs) so i need
|
||||
two flags to control the behaviour of the filesystemclasses.
|
||||
|
||||
2004-12-13 Bart Hakvoort <gparted@users.sf.net>
|
||||
|
||||
* include/GParted_Core.h,
|
||||
|
|
|
@ -45,7 +45,8 @@ struct FS
|
|||
Glib::ustring filesystem ;
|
||||
bool read ; //can we get the amount of used sectors?
|
||||
bool create ;
|
||||
bool resize ; //only endpoint
|
||||
bool grow ;
|
||||
bool shrink ;
|
||||
bool move ; //startpoint and endpoint
|
||||
bool check ; //some checktool available?
|
||||
bool copy ;
|
||||
|
@ -54,7 +55,7 @@ struct FS
|
|||
|
||||
FS( )
|
||||
{
|
||||
read = create = resize = move = check = copy = false ;
|
||||
read = create = grow = shrink = move = check = copy = false ;
|
||||
MIN = 0 ;
|
||||
MAX = 0 ;
|
||||
}
|
||||
|
|
|
@ -174,7 +174,8 @@ private:
|
|||
bool any_logic,any_extended;//used in some checks (e.g. see optionmenu_devices_changed()
|
||||
unsigned short primary_count ;//primary_count checks for max. of 4 pimary partitions
|
||||
unsigned short new_count;//new_count keeps track of the new created partitions
|
||||
Glib::ustring str_temp ; //mostly used for constructing dialogmessages
|
||||
Glib::ustring str_temp ; //mostly used for constructing dialogmessages
|
||||
FS fs ;
|
||||
|
||||
GParted_Core gparted_core ;
|
||||
GParted::Device *temp_device ;
|
||||
|
|
|
@ -111,21 +111,23 @@ void Dialog_Partition_Resize_Move::Resize_Move_Normal( const std::vector <Partit
|
|||
frame_resizer_base ->set_x_end( ( Round( (double) (selected_partition.sector_end - selected_partition.sector_start) / ( (double)total_length/500) )) + frame_resizer_base ->get_x_start() ) ;
|
||||
frame_resizer_base ->set_used( Round( (double) selected_partition.sectors_used / ( (double)total_length/500) ) ) ;
|
||||
|
||||
//since some filesystems have upper and lower limits we need to check for this
|
||||
if ( selected_partition .Get_Used_MB( ) > fs .MIN )
|
||||
fs .MIN = selected_partition .Get_Used_MB( ) ;
|
||||
|
||||
//if fs. MIN is 0 here (means used == 0 as well) it's safe to have BUF / 2
|
||||
fs .MIN += fs .MIN ? BUF : BUF/2 ;
|
||||
|
||||
//in certain (rare) cases fs .MIN is a bit too high...
|
||||
if ( fs .MIN > selected_partition .Get_Length_MB( ) )
|
||||
if ( fs .shrink )
|
||||
{
|
||||
//since some filesystems have lower limits we need to check for this
|
||||
if ( selected_partition .Get_Used_MB( ) > fs .MIN )
|
||||
fs .MIN = selected_partition .Get_Used_MB( ) ;
|
||||
|
||||
//if fs. MIN is 0 here (means used == 0 as well) it's safe to have BUF / 2
|
||||
fs .MIN += fs .MIN ? BUF : BUF/2 ;
|
||||
|
||||
//in certain (rare) cases fs .MIN is a bit too high...
|
||||
if ( fs .MIN > selected_partition .Get_Length_MB( ) )
|
||||
fs .MIN = selected_partition .Get_Length_MB( ) ;
|
||||
}
|
||||
else //only grow..
|
||||
fs .MIN = selected_partition .Get_Length_MB( ) ;
|
||||
|
||||
if ( ! fs .MAX )
|
||||
fs .MAX = TOTAL_MB ;
|
||||
|
||||
if ( fs .MAX > TOTAL_MB )
|
||||
|
||||
if ( ! fs .MAX || fs .MAX > TOTAL_MB )
|
||||
fs .MAX = TOTAL_MB ;
|
||||
|
||||
//set values of spinbutton_before
|
||||
|
|
|
@ -617,14 +617,13 @@ void Win_GParted::Set_Valid_Operations()
|
|||
allow_convert( true ) ;
|
||||
|
||||
//find out if resizing/moving and copying is possible
|
||||
if ( Get_FS( selected_partition .filesystem, gparted_core .get_fs( ) ) .resize && ! devices[ current_device ] .readonly )
|
||||
fs = Get_FS( selected_partition .filesystem, gparted_core .get_fs( ) ) ;
|
||||
if ( (fs .grow || fs .shrink) && ! devices[ current_device ] .readonly )
|
||||
{
|
||||
allow_resize( true ) ;
|
||||
|
||||
//only allow copying of real partitions
|
||||
if ( selected_partition .status != GParted::STAT_NEW &&
|
||||
selected_partition .status != GParted::STAT_COPY &&
|
||||
Get_FS( selected_partition .filesystem, gparted_core .get_fs( ) ) .copy )
|
||||
if ( selected_partition .status != GParted::STAT_NEW && selected_partition .status != GParted::STAT_COPY && fs .copy )
|
||||
allow_copy( true ) ;
|
||||
}
|
||||
|
||||
|
@ -801,8 +800,7 @@ void Win_GParted::mouse_click( GdkEventButton *event, const Partition & partitio
|
|||
{
|
||||
selected_partition = partition;
|
||||
|
||||
Set_Valid_Operations () ;
|
||||
|
||||
Set_Valid_Operations( ) ;
|
||||
|
||||
treeview_detail .Set_Selected( partition );
|
||||
vbox_visual_disk ->Set_Selected( partition );
|
||||
|
@ -858,7 +856,7 @@ void Win_GParted::activate_resize()
|
|||
hbox_resize_move .pack_start( * mk_label( _("Resize/Move") ), Gtk::PACK_SHRINK ) ;
|
||||
button_resize_move .add( hbox_resize_move ) ;
|
||||
|
||||
dialog .add_action_widget ( button_resize_move, Gtk::RESPONSE_OK ) ;
|
||||
dialog .add_action_widget( button_resize_move, Gtk::RESPONSE_OK ) ;
|
||||
dialog .show_all_children( ) ;
|
||||
|
||||
if ( dialog.run( ) == Gtk::RESPONSE_CANCEL )
|
||||
|
@ -1076,7 +1074,7 @@ void Win_GParted::activate_convert( const Glib::ustring & new_fs )
|
|||
dialog .hide( ) ;//i want to be sure the dialog is gone _before_ operationslist shows up (only matters if first operation)
|
||||
|
||||
//check for some limits...
|
||||
FS fs = Get_FS( new_fs, gparted_core .get_fs( ) ) ;
|
||||
fs = Get_FS( new_fs, gparted_core .get_fs( ) ) ;
|
||||
|
||||
if ( selected_partition .Get_Length_MB( ) < fs .MIN || ( fs .MAX && selected_partition .Get_Length_MB( ) > fs .MAX ) )
|
||||
{
|
||||
|
|
|
@ -37,7 +37,7 @@ FS ext2::get_filesystem_support( )
|
|||
|
||||
//resizing is a delicate process which requires 3 commands..
|
||||
if ( ! system( "which resize2fs 1>/dev/null 2>/dev/null" ) && fs .read && fs .check )
|
||||
fs .resize = true ;
|
||||
fs .grow = fs .shrink = true ;
|
||||
|
||||
if ( ! system( "which dd 1>/dev/null 2>/dev/null" ) )
|
||||
fs .copy = true ;
|
||||
|
|
|
@ -37,7 +37,7 @@ FS ext3::get_filesystem_support( )
|
|||
|
||||
//resizing is a delicate process which requires 3 commands..
|
||||
if ( ! system( "which resize2fs 1>/dev/null 2>/dev/null" ) && fs .read && fs .check )
|
||||
fs .resize = true ;
|
||||
fs .grow = fs .shrink = true ;
|
||||
|
||||
if ( ! system( "which dd 1>/dev/null 2>/dev/null" ) )
|
||||
fs .copy = true ;
|
||||
|
|
|
@ -36,7 +36,8 @@ FS fat16::get_filesystem_support( )
|
|||
fs .check = true ;
|
||||
|
||||
//resizing of start and endpoint are provided by libparted
|
||||
fs .resize = true ;
|
||||
fs .grow = true ;
|
||||
fs .shrink = true ;
|
||||
fs .move = true ;
|
||||
|
||||
if ( ! system( "which dd 1>/dev/null 2>/dev/null" ) )
|
||||
|
|
|
@ -36,7 +36,8 @@ FS fat32::get_filesystem_support( )
|
|||
fs .check = true ;
|
||||
|
||||
//resizing of start and endpoint are provided by libparted
|
||||
fs .resize = true ;
|
||||
fs .grow = true ;
|
||||
fs .shrink = true ;
|
||||
fs .move = true ;
|
||||
|
||||
if ( ! system( "which dd 1>/dev/null 2>/dev/null" ) )
|
||||
|
|
|
@ -28,7 +28,8 @@ FS linux_swap::get_filesystem_support( )
|
|||
fs .filesystem = "linux-swap" ;
|
||||
fs .read = false ; //used/unused isn't relevant for swapspace
|
||||
fs .create = true ;
|
||||
fs .resize = true ;
|
||||
fs .grow = true ;
|
||||
fs .shrink = true ;
|
||||
fs .move = true ;
|
||||
|
||||
if ( ! system( "which dd 1>/dev/null 2>/dev/null" ) )
|
||||
|
|
|
@ -37,10 +37,10 @@ FS ntfs::get_filesystem_support( )
|
|||
|
||||
//resizing is a delicate process which requires 3 commands..
|
||||
if ( ! system( "which ntfsresize 1>/dev/null 2>/dev/null" ) && fs .read && fs .check )
|
||||
fs .resize = true ;
|
||||
fs .grow = fs .shrink = true ;
|
||||
|
||||
//we need resize to set correct used/unused after cloning
|
||||
if ( ! system( "which ntfsclone 1>/dev/null 2>/dev/null" ) && fs .resize )
|
||||
//we need ntfsresize to set correct used/unused after cloning
|
||||
if ( ! system( "which ntfsclone 1>/dev/null 2>/dev/null" ) && fs .grow )
|
||||
fs .copy = true ;
|
||||
|
||||
return fs ;
|
||||
|
|
|
@ -38,10 +38,10 @@ FS reiserfs::get_filesystem_support( )
|
|||
|
||||
//resizing is a delicate process which requires 3 commands..
|
||||
if ( ! system( "which resize_reiserfs 1>/dev/null 2>/dev/null" ) && fs .read && fs .check )
|
||||
fs .resize = true ;
|
||||
fs .grow = fs .shrink = true ;
|
||||
|
||||
//we need to call resize_reiserfs after a copy to get proper used/unused
|
||||
if ( ! system( "which dd 1>/dev/null 2>/dev/null" ) && fs .resize )
|
||||
if ( ! system( "which dd 1>/dev/null 2>/dev/null" ) && fs .grow )
|
||||
fs .copy = true ;
|
||||
|
||||
fs .MIN = 32 ;
|
||||
|
|
Loading…
Reference in New Issue