Simplify ext2::get_filesystem_support() with regard ext4 support (#794253)

E2fsprogs 1.41.0 (from 10 July 2008) first included ext4 support [1].
As RHEL / CentOS 6 is now the oldest supported distribution, and that
includes e2fsprogs 1.41.12 (from 22 August 2009) [2] all the e2fs
programs support ext4 so it is no longer necessary to also depend on
finding mkfs.ext4 before enabling each supported capability for ext4.
This makes the ext2::get_filesystem_support() look like all the others
in which each supported capability only depends on the presence of the
relevant file system specific command.

[1] Release notes for the e2fsprogs package / E2fsprogs 1.41.0
    http://e2fsprogs.sourceforge.net/e2fsprogs-release.html#1.41.0

[2] pkgs.org > CentOS 6 > CentOS x86_64 > e2fsprogs
    https://centos.pkgs.org/6/centos-x86_64/e2fsprogs-1.41.12-23.el6.x86_64.rpm.html

Bug 794253 - Desupport RHEL / CentOS 5 and raise minimum required
             versions to glibmm 2.14.0 and gtkmm 2.16.0
This commit is contained in:
Mike Fleetwood 2018-03-08 11:29:10 +00:00 committed by Curtis Gedak
parent 6c4ab5dc28
commit de6e70d933
1 changed files with 56 additions and 58 deletions

View File

@ -32,17 +32,14 @@ FS ext2::get_filesystem_support()
fs .busy = FS::GPARTED ;
// Only enable functionality if the relevant mkfs.extX command is found to ensure
// that the version of e2fsprogs is new enough to support ext4. Applying to
// ext2/3 is OK as relevant mkfs.ext2/3 commands exist.
mkfs_cmd = "mkfs." + Utils::get_filesystem_string( specific_type );
bool have_64bit_feature = false;
if ( ! Glib::find_program_in_path( mkfs_cmd ).empty() )
{
fs .create = FS::EXTERNAL ;
fs .create_with_label = FS::EXTERNAL ;
// Determine mkfs.ext4 version specific capabilities.
bool have_64bit_feature = false;
force_auto_64bit = false;
if ( specific_type == FS_EXT4 )
{
@ -76,9 +73,13 @@ FS ext2::get_filesystem_support()
|| ( mke4fs_major_ver == 1 && mke4fs_minor_ver >= 42 );
}
}
}
if ( ! Glib::find_program_in_path( "dumpe2fs").empty() )
{
fs.read = FS::EXTERNAL;
fs.online_read = FS::EXTERNAL;
}
if ( ! Glib::find_program_in_path( "tune2fs" ).empty() )
{
@ -99,7 +100,7 @@ FS ext2::get_filesystem_support()
{
fs.grow = FS::EXTERNAL;
if ( fs .read ) //needed to determine a min file system size..
if ( fs.read ) // Needed to determine a min file system size..
fs.shrink = FS::EXTERNAL;
}
@ -107,10 +108,9 @@ FS ext2::get_filesystem_support()
{
fs.copy = fs.move = FS::GPARTED;
//If supported, use e2image to copy/move the file system as it
// only copies used blocks, skipping unused blocks. This is more
// efficient than copying all blocks used by GParted's internal
// method.
// If supported, use e2image to copy/move the file system as it only
// copies used blocks, skipping unused blocks. This is more efficient
// than copying all blocks used by GParted's internal method.
if ( ! Glib::find_program_in_path( "e2image" ).empty() )
{
Utils::execute_command( "e2image", output, error, true );
@ -119,25 +119,23 @@ FS ext2::get_filesystem_support()
}
}
fs .online_read = FS::EXTERNAL ;
#ifdef ENABLE_ONLINE_RESIZE
if ( specific_type != FS_EXT2 && Utils::kernel_version_at_least( 3, 6, 0 ) )
fs.online_grow = fs.grow;
#endif
// Maximum size of an ext2/3/4 volume is 2^32 - 1 blocks, except for ext4
// with 64bit feature. That is just under 16 TiB with a 4K block size.
// Maximum size of an ext2/3/4 volume is 2^32 - 1 blocks, except for ext4 with
// 64bit feature. That is just under 16 TiB with a 4K block size.
// * Ext4 Disk Layout, Blocks
// https://ext4.wiki.kernel.org/index.php/Ext4_Disk_Layout#Blocks
// FIXME: Rounding down to whole MiB here should not be necessary. The
// Copy, New and Resize/Move dialogs should limit FS correctly without
// this. See bug #766910 comment #12 onwards for further discussion.
// FIXME: Rounding down to whole MiB here should not be necessary. The Copy, New
// and Resize/Move dialogs should limit FS correctly without this. See bug
// #766910 comment #12 onwards for further discussion.
// https://bugzilla.gnome.org/show_bug.cgi?id=766910#c12
if ( specific_type == FS_EXT2 ||
specific_type == FS_EXT3 ||
( specific_type == FS_EXT4 && ! have_64bit_feature ) )
fs_limits.max_size = Utils::floor_size( 16 * TEBIBYTE - 4 * KIBIBYTE, MEBIBYTE );
}
return fs ;
}