[gparted] Query and pass struct FS_Limits into Dialog_Partition_Resize_Resize_Move (#787204)
- From: Curtis Gedak <gedakc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gparted] Query and pass struct FS_Limits into Dialog_Partition_Resize_Resize_Move (#787204)
- Date: Sun, 28 Jan 2018 17:15:15 +0000 (UTC)
commit 53b7a7589455f49a9790610ff073ded046da8e96
Author: Mike Fleetwood <mike fleetwood googlemail com>
Date: Fri Jan 12 11:53:08 2018 +0000
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
include/Dialog_Partition_Resize_Move.h | 4 +++-
src/Dialog_Partition_Resize_Move.cc | 5 +++--
src/Win_GParted.cc | 19 +++++++++++++------
3 files changed, 19 insertions(+), 9 deletions(-)
---
diff --git a/include/Dialog_Partition_Resize_Move.h b/include/Dialog_Partition_Resize_Move.h
index 5645e5b..448dfe4 100644
--- a/include/Dialog_Partition_Resize_Move.h
+++ b/include/Dialog_Partition_Resize_Move.h
@@ -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();
diff --git a/src/Dialog_Partition_Resize_Move.cc b/src/Dialog_Partition_Resize_Move.cc
index e66991e..9bfa57d 100644
--- a/src/Dialog_Partition_Resize_Move.cc
+++ b/src/Dialog_Partition_Resize_Move.cc
@@ -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 );
}
diff --git a/src/Win_GParted.cc b/src/Win_GParted.cc
index 1f66c2f..a15cf4f 100644
--- a/src/Win_GParted.cc
+++ b/src/Win_GParted.cc
@@ -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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]