mirror of
https://gitlab.gnome.org/GNOME/gparted
synced 2024-08-27 11:40:03 +00:00
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:
parent
6c4ab5dc28
commit
de6e70d933
114
src/ext2.cc
114
src/ext2.cc
|
@ -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,68 +73,69 @@ 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 ;
|
||||
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() )
|
||||
if ( ! Glib::find_program_in_path( "tune2fs" ).empty() )
|
||||
{
|
||||
fs.read_uuid = FS::EXTERNAL;
|
||||
fs.write_uuid = FS::EXTERNAL;
|
||||
}
|
||||
|
||||
if ( ! Glib::find_program_in_path( "e2label" ).empty() )
|
||||
{
|
||||
fs.read_label = FS::EXTERNAL;
|
||||
fs.write_label = FS::EXTERNAL;
|
||||
}
|
||||
|
||||
if ( ! Glib::find_program_in_path( "e2fsck" ).empty() )
|
||||
fs.check = FS::EXTERNAL;
|
||||
|
||||
if ( ! Glib::find_program_in_path( "resize2fs" ).empty() )
|
||||
{
|
||||
fs.grow = FS::EXTERNAL;
|
||||
|
||||
if ( fs.read ) // Needed to determine a min file system size..
|
||||
fs.shrink = FS::EXTERNAL;
|
||||
}
|
||||
|
||||
if ( fs.check )
|
||||
{
|
||||
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 ( ! Glib::find_program_in_path( "e2image" ).empty() )
|
||||
{
|
||||
fs .read_uuid = FS::EXTERNAL ;
|
||||
fs .write_uuid = FS::EXTERNAL ;
|
||||
Utils::execute_command( "e2image", output, error, true );
|
||||
if ( Utils::regexp_label( error, "(-o src_offset)" ) == "-o src_offset" )
|
||||
fs.copy = fs.move = FS::EXTERNAL;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! Glib::find_program_in_path( "e2label" ).empty() )
|
||||
{
|
||||
fs .read_label = FS::EXTERNAL ;
|
||||
fs .write_label = FS::EXTERNAL ;
|
||||
}
|
||||
|
||||
if ( ! Glib::find_program_in_path( "e2fsck" ).empty() )
|
||||
fs .check = FS::EXTERNAL ;
|
||||
|
||||
if ( ! Glib::find_program_in_path( "resize2fs" ).empty() )
|
||||
{
|
||||
fs .grow = FS::EXTERNAL ;
|
||||
|
||||
if ( fs .read ) //needed to determine a min file system size..
|
||||
fs .shrink = FS::EXTERNAL ;
|
||||
}
|
||||
|
||||
if ( fs .check )
|
||||
{
|
||||
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 ( ! Glib::find_program_in_path( "e2image" ).empty() )
|
||||
{
|
||||
Utils::execute_command( "e2image", output, error, true ) ;
|
||||
if ( Utils::regexp_label( error, "(-o src_offset)" ) == "-o src_offset" )
|
||||
fs.copy = fs.move = FS::EXTERNAL ;
|
||||
}
|
||||
}
|
||||
|
||||
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 ;
|
||||
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.
|
||||
// * 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.
|
||||
// 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 );
|
||||
}
|
||||
// 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.
|
||||
// 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 ;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue