mirror of
https://gitlab.gnome.org/GNOME/gparted
synced 2024-10-12 10:52:59 +00:00
Query and pass struct FS_Limits into Dialog_Partition_Resize_Resize_Move (#787204)
Refactor Win_GParted::activate_resize() to query the file system size limits using the new get_filesystem_limits() method and pass those limits into the dialog class as struct FS_Limits. Bug 787204 - Minimum and maximum size of the UDF partition/disk
This commit is contained in:
parent
fe7b734792
commit
53b7a75894
|
@ -20,6 +20,7 @@
|
|||
#include "Dialog_Base_Partition.h"
|
||||
#include "Partition.h"
|
||||
#include "PartitionVector.h"
|
||||
#include "Utils.h"
|
||||
|
||||
namespace GParted
|
||||
{
|
||||
|
@ -27,7 +28,8 @@ namespace GParted
|
|||
class Dialog_Partition_Resize_Move : public Dialog_Base_Partition
|
||||
{
|
||||
public:
|
||||
Dialog_Partition_Resize_Move( const FS & fs, const Partition & selected_partition,
|
||||
Dialog_Partition_Resize_Move( const FS & fs, const FS_Limits & fs_limits,
|
||||
const Partition & selected_partition,
|
||||
const PartitionVector & partitions );
|
||||
~Dialog_Partition_Resize_Move();
|
||||
|
||||
|
|
|
@ -24,11 +24,12 @@
|
|||
namespace GParted
|
||||
{
|
||||
|
||||
Dialog_Partition_Resize_Move::Dialog_Partition_Resize_Move( const FS & fs, const Partition & selected_partition,
|
||||
Dialog_Partition_Resize_Move::Dialog_Partition_Resize_Move( const FS & fs, const FS_Limits & fs_limits,
|
||||
const Partition & selected_partition,
|
||||
const PartitionVector & partitions )
|
||||
{
|
||||
this ->fs = fs ;
|
||||
fs_limits = FS_Limits( fs.MIN, fs.MAX );
|
||||
this->fs_limits = fs_limits;
|
||||
set_data( selected_partition, partitions );
|
||||
}
|
||||
|
||||
|
|
|
@ -1793,8 +1793,14 @@ void Win_GParted::activate_resize()
|
|||
display_partitions_ptr = &display_partitions[index_extended].logicals;
|
||||
}
|
||||
|
||||
FS fs_cap = gparted_core.get_fs( selected_partition_ptr->get_filesystem_partition().filesystem );
|
||||
Partition * working_ptn;
|
||||
const FILESYSTEM fstype = selected_partition_ptr->get_filesystem_partition().filesystem;
|
||||
FS fs_cap = gparted_core.get_fs( fstype );
|
||||
const FileSystem *filesystem_object = gparted_core.get_filesystem_object( fstype );
|
||||
FS_Limits fs_limits;
|
||||
if ( filesystem_object != NULL )
|
||||
fs_limits = filesystem_object->get_filesystem_limits();
|
||||
|
||||
if ( selected_partition_ptr->filesystem == FS_LUKS && selected_partition_ptr->busy )
|
||||
{
|
||||
const FS & enc_cap = gparted_core.get_fs( FS_LUKS );
|
||||
|
@ -1818,19 +1824,20 @@ void Win_GParted::activate_resize()
|
|||
fs_cap.shrink = FS::NONE;
|
||||
fs_cap.online_shrink = FS::NONE;
|
||||
}
|
||||
|
||||
// Adjust file system size limits accounting for LUKS encryption overhead.
|
||||
Sector luks_header_size = static_cast<const PartitionLUKS *>( selected_partition_ptr )->get_header_size();
|
||||
fs_cap.MIN = luks_header_size * working_ptn->sector_size +
|
||||
( fs_cap.MIN < MEBIBYTE ) ? MEBIBYTE : fs_cap.MIN;
|
||||
if ( fs_cap.MAX > 0 )
|
||||
fs_cap.MAX += luks_header_size * working_ptn->sector_size;
|
||||
fs_limits.min_size = luks_header_size * working_ptn->sector_size +
|
||||
( fs_limits.min_size < MEBIBYTE ) ? MEBIBYTE : fs_limits.min_size;
|
||||
if ( fs_limits.max_size > 0 )
|
||||
fs_limits.max_size += luks_header_size * working_ptn->sector_size;
|
||||
}
|
||||
else
|
||||
{
|
||||
working_ptn = selected_partition_ptr->clone();
|
||||
}
|
||||
|
||||
Dialog_Partition_Resize_Move dialog( fs_cap, *working_ptn, *display_partitions_ptr );
|
||||
Dialog_Partition_Resize_Move dialog( fs_cap, fs_limits, *working_ptn, *display_partitions_ptr );
|
||||
dialog .set_transient_for( *this ) ;
|
||||
|
||||
delete working_ptn;
|
||||
|
|
Loading…
Reference in a new issue