diff --git a/ChangeLog b/ChangeLog index ddc9144b..6cabd56b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2004-12-15 Bart Hakvoort + + * Refined checks for functionality a bit. e.g. even if a filesystem can't be read, it's still possible to grow it + (but shrinking gets disabled). Also removed that stupid grow_only flag from Utils.h and reordered Win_GParted::Set_Valid_Operations() + 2004-12-14 Bart Hakvoort * added support for jfs (create, copy, grow) and hfs (create, copy) diff --git a/include/Utils.h b/include/Utils.h index b77af5be..1fbd3fa4 100644 --- a/include/Utils.h +++ b/include/Utils.h @@ -50,13 +50,12 @@ struct FS bool move ; //startpoint and endpoint bool check ; //some checktool available? bool copy ; - bool grow_only ; //xfs,jfs (only used in Parted_Core::set_device_partitions) int MIN ; int MAX ; FS( ) { - read = create = grow = shrink = move = check = copy = grow_only = false ; + read = create = grow = shrink = move = check = copy = false ; MIN = 0 ; MAX = 0 ; } diff --git a/src/Dialog_Partition_Resize_Move.cc b/src/Dialog_Partition_Resize_Move.cc index e86113d9..6ef2e4d1 100644 --- a/src/Dialog_Partition_Resize_Move.cc +++ b/src/Dialog_Partition_Resize_Move.cc @@ -65,6 +65,8 @@ void Dialog_Partition_Resize_Move::Set_Data( const Partition & selected_partitio void Dialog_Partition_Resize_Move::Resize_Move_Normal( const std::vector & partitions ) { fs = Get_FS( selected_partition .filesystem, FILESYSTEMS ) ; + if ( ! selected_partition .error .empty( ) ) + fs .shrink = false ; //see if we need a fixed_start if ( fs .move ) diff --git a/src/GParted_Core.cc b/src/GParted_Core.cc index 3ca9dd68..b2ecc363 100644 --- a/src/GParted_Core.cc +++ b/src/GParted_Core.cc @@ -182,20 +182,13 @@ void GParted_Core::set_device_partitions( Device & device, bool deep_scan ) if ( partition_temp .sectors_used == -1 && partition_temp .error .empty( ) ) { partition_temp .error = _("Unable to read the contents of this filesystem!") ; - - fs = Get_FS( partition_temp .filesystem, FILESYSTEMS ) ; - - if ( ! fs .grow_only ) - { - partition_temp .error += "\n" ; - partition_temp .error += ("As a result you won't be able to resize this partition.") ; - } + partition_temp .error += "\n" ; + partition_temp .error += _("Because of this some operations may be unavailable.") ; } } partition_temp .flags = Get_Flags( c_partition ) ; - if ( partition_temp .busy ) device .busy = true ; diff --git a/src/Win_GParted.cc b/src/Win_GParted.cc index 95a3896c..93f0c970 100644 --- a/src/Win_GParted.cc +++ b/src/Win_GParted.cc @@ -603,9 +603,9 @@ void Win_GParted::Set_Valid_Operations() } //EXTENDED - else if ( selected_partition .type == GParted::EXTENDED ) + if ( selected_partition .type == GParted::EXTENDED ) { - if ( ! any_logic ) //deletion is only allowed when there are nog logical partitions inside. + if ( ! any_logic ) //deletion is only allowed when there are no logical partitions inside. allow_delete( true ) ; if ( ! devices[ current_device ] .readonly ) @@ -614,31 +614,11 @@ void Win_GParted::Set_Valid_Operations() return ; } - fs = Get_FS( selected_partition .filesystem, gparted_core .get_fs( ) ) ; - - //FIXME too much redundacy here (just not in the mood to fix it now :P ) - //if there was an error reading the filesystem we allow delete and convert ( see also Device::Get_Used_Sectors() ) - //since growing doesn't affect the space already in use, we allow resinzing of 'grow-only' filesystems - if ( ! selected_partition .error .empty( ) ) - { - allow_delete( true ) ; - allow_convert( true ) ; - - 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 && fs .copy ) - allow_copy( true ) ; - } - - return; - } - //PRIMARY and LOGICAL - if ( selected_partition .type != GParted::EXTENDED ) + if ( selected_partition .type == GParted::PRIMARY || selected_partition .type == GParted::LOGICAL ) { + fs = Get_FS( selected_partition .filesystem, gparted_core .get_fs( ) ) ; + allow_delete( true ) ; allow_convert( true ) ; @@ -648,7 +628,7 @@ void Win_GParted::Set_Valid_Operations() allow_resize( true ) ; //only allow copying of real partitions - if ( selected_partition .status != GParted::STAT_NEW && selected_partition .status != GParted::STAT_COPY && fs .copy ) + if ( selected_partition .status == GParted::STAT_REAL && fs .copy ) allow_copy( true ) ; } @@ -872,9 +852,8 @@ void Win_GParted::activate_resize() dialog .add_action_widget( button_resize_move, Gtk::RESPONSE_OK ) ; dialog .show_all_children( ) ; - if ( dialog.run( ) == Gtk::RESPONSE_CANCEL ) + if ( dialog .run( ) == Gtk::RESPONSE_CANCEL ) return ; - } std::vector partitions = devices[ current_device ] .device_partitions ; @@ -885,7 +864,7 @@ void Win_GParted::activate_resize() operations[ t ] .Apply_Operation_To_Visual( partitions ) ; - Dialog_Partition_Resize_Move dialog( gparted_core .get_fs( ), devices[ current_device ] .heads * devices[ current_device ] .sectors ) ; + Dialog_Partition_Resize_Move dialog( gparted_core .get_fs( ), devices[ current_device ] .heads * devices[ current_device ] .sectors ) ; if ( selected_partition .type == GParted::LOGICAL ) { @@ -898,30 +877,29 @@ void Win_GParted::activate_resize() dialog .set_transient_for( *this ) ; - if ( dialog.run() == Gtk::RESPONSE_OK ) + if ( dialog .run( ) == Gtk::RESPONSE_OK ) { - dialog.hide() ;//i want to be sure the dialog is gone _before_ operationslist shows up (only matters if first operation) + dialog .hide( ) ;//i want to be sure the dialog is gone _before_ operationslist shows up (only matters if first operation) //if selected_partition is NEW we simply remove the NEW operation from the list and add it again with the new size and position ( unless it's an EXTENDED ) if ( selected_partition .status == GParted::STAT_NEW && selected_partition.type != GParted::EXTENDED ) { //remove operation which creates this partition - for ( unsigned int t=0;t/dev/null 2>/dev/null" ) ) fs .check = true ; - //resizing is a delicate process which requires 3 commands.. - if ( ! system( "which resize2fs 1>/dev/null 2>/dev/null" ) && fs .read && fs .check ) - fs .grow = fs .shrink = true ; + //resizing is a delicate process ... + if ( ! system( "which resize2fs 1>/dev/null 2>/dev/null" ) && fs .check ) + { + fs .grow = true ; + + if ( fs .read ) //needed to determine a min filesystemsize.. + fs .shrink = true ; + } if ( ! system( "which dd 1>/dev/null 2>/dev/null" ) ) fs .copy = true ; diff --git a/src/ext3.cc b/src/ext3.cc index b9547390..65287916 100644 --- a/src/ext3.cc +++ b/src/ext3.cc @@ -35,9 +35,14 @@ FS ext3::get_filesystem_support( ) if ( ! system( "which e2fsck 1>/dev/null 2>/dev/null" ) ) fs .check = true ; - //resizing is a delicate process which requires 3 commands.. - if ( ! system( "which resize2fs 1>/dev/null 2>/dev/null" ) && fs .read && fs .check ) - fs .grow = fs .shrink = true ; + //resizing is a delicate process ... + if ( ! system( "which resize2fs 1>/dev/null 2>/dev/null" ) && fs .check ) + { + fs .grow = true ; + + if ( fs .read ) //needed to determine a min filesystemsize.. + fs .shrink = true ; + } if ( ! system( "which dd 1>/dev/null 2>/dev/null" ) ) fs .copy = true ; diff --git a/src/jfs.cc b/src/jfs.cc index 6a50a8d7..e8db23f9 100644 --- a/src/jfs.cc +++ b/src/jfs.cc @@ -26,8 +26,7 @@ FS jfs::get_filesystem_support( ) FS fs ; fs .filesystem = "jfs" ; - fs .grow_only = true ; - + // if ( ! system( "which xfs_db 1>/dev/null 2>/dev/null" ) ) // fs .read = true ; diff --git a/src/ntfs.cc b/src/ntfs.cc index 471b5ca7..15ef3a4b 100644 --- a/src/ntfs.cc +++ b/src/ntfs.cc @@ -35,9 +35,14 @@ FS ntfs::get_filesystem_support( ) if ( ! system( "which ntfsfix 1>/dev/null 2>/dev/null" ) ) fs .check = true ; - //resizing is a delicate process which requires 3 commands.. - if ( ! system( "which ntfsresize 1>/dev/null 2>/dev/null" ) && fs .read && fs .check ) - fs .grow = fs .shrink = true ; + //resizing is a delicate process ... + if ( ! system( "which ntfsresize 1>/dev/null 2>/dev/null" ) && fs .check ) + { + fs .grow = true ; + + if ( fs .read ) //needed to determine a min filesystemsize.. + fs .shrink = true ; + } //we need ntfsresize to set correct used/unused after cloning if ( ! system( "which ntfsclone 1>/dev/null 2>/dev/null" ) && fs .grow ) diff --git a/src/reiserfs.cc b/src/reiserfs.cc index fbcfe9ba..e9d1f191 100644 --- a/src/reiserfs.cc +++ b/src/reiserfs.cc @@ -36,9 +36,14 @@ FS reiserfs::get_filesystem_support( ) if ( ! system( "which reiserfsck 1>/dev/null 2>/dev/null" ) ) fs .check = true ; - //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 .grow = fs .shrink = true ; + //resizing is a delicate process ... + if ( ! system( "which resize_reiserfs 1>/dev/null 2>/dev/null" ) && fs .check ) + { + fs .grow = true ; + + if ( fs .read ) //needed to determine a min filesystemsize.. + 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 .grow ) diff --git a/src/xfs.cc b/src/xfs.cc index 88fce1d4..f33abc33 100644 --- a/src/xfs.cc +++ b/src/xfs.cc @@ -26,8 +26,7 @@ FS xfs::get_filesystem_support( ) FS fs ; fs .filesystem = "xfs" ; - fs .grow_only = true ; - + if ( ! system( "which xfs_db 1>/dev/null 2>/dev/null" ) ) fs .read = true ;