Added support for ext4 file systems

svn path=/trunk/; revision=1005
This commit is contained in:
Curtis Gedak 2008-12-18 22:13:43 +00:00
parent c020834508
commit 533eb1bc03
4 changed files with 42 additions and 16 deletions

View File

@ -1,5 +1,10 @@
2008-12-18 Curtis Gedak <gedakc@gmail.com>
* include/Utils.h,
src/GParted_Core.cc,
src/Utils.cc: Added support for ext4 file systems.
- Closes GParted bug #503112
* include/ext4.h,
include/Makefile.am,
src/ext4.cc,

View File

@ -52,22 +52,23 @@ enum FILESYSTEM
FS_EXT2 = 4,
FS_EXT3 = 5,
FS_LINUX_SWAP = 6,
FS_FAT16 = 7,
FS_FAT32 = 8,
FS_NTFS = 9,
FS_REISERFS = 10,
FS_REISER4 = 11,
FS_XFS = 12,
FS_JFS = 13,
FS_HFS = 14,
FS_HFSPLUS = 15,
FS_UFS = 16,
FS_EXT4 = 6,
FS_LINUX_SWAP = 7,
FS_FAT16 = 8,
FS_FAT32 = 9,
FS_NTFS = 10,
FS_REISERFS = 11,
FS_REISER4 = 12,
FS_XFS = 13,
FS_JFS = 14,
FS_HFS = 15,
FS_HFSPLUS = 16,
FS_UFS = 17,
FS_USED = 17,
FS_UNUSED = 18,
FS_USED = 18,
FS_UNUSED = 19,
FS_LVM2 = 19
FS_LVM2 = 20
} ;
enum SIZE_UNIT

View File

@ -27,6 +27,7 @@
#include "../include/ext2.h"
#include "../include/ext3.h"
#include "../include/ext4.h"
#include "../include/fat16.h"
#include "../include/fat32.h"
#include "../include/linux_swap.h"
@ -88,6 +89,9 @@ void GParted_Core::find_supported_filesystems()
ext3 fs_ext3;
FILESYSTEMS .push_back( fs_ext3 .get_filesystem_support() ) ;
ext4 fs_ext4;
FILESYSTEMS .push_back( fs_ext4 .get_filesystem_support() ) ;
fat16 fs_fat16;
FILESYSTEMS .push_back( fs_fat16 .get_filesystem_support() ) ;
@ -740,7 +744,19 @@ GParted::FILESYSTEM GParted_Core::get_filesystem()
else if ( Glib::ustring( lp_partition ->fs_type ->name ) == "ext2" )
return GParted::FS_EXT2 ;
else if ( Glib::ustring( lp_partition ->fs_type ->name ) == "ext3" )
{
//FIXME: Temporary code to detect ext4.
// Replace when libparted bug #188 "ext4 detected as ext3" is fixed.
// http://parted.alioth.debian.org/cgi-bin/trac.cgi/ticket/188
FS_Info fs_info ;
temp = fs_info .get_fs_type( Glib::ustring( ped_partition_get_path( lp_partition ) ) ) ;
if ( temp == "ext4" || temp == "ext4dev" )
return GParted::FS_EXT4 ;
else
return GParted::FS_EXT3 ;
}
else if ( Glib::ustring( lp_partition ->fs_type ->name ) == "ext4" )
return GParted::FS_EXT4 ;
else if ( Glib::ustring( lp_partition ->fs_type ->name ) == "linux-swap" )
return GParted::FS_LINUX_SWAP ;
else if ( Glib::ustring( lp_partition ->fs_type ->name ) == "fat16" )
@ -2272,6 +2288,7 @@ bool GParted_Core::set_proper_filesystem( const FILESYSTEM & filesystem )
{
case FS_EXT2 : p_filesystem = new ext2() ; break ;
case FS_EXT3 : p_filesystem = new ext3() ; break ;
case FS_EXT4 : p_filesystem = new ext4() ; break ;
case FS_LINUX_SWAP : p_filesystem = new linux_swap() ; break ;
case FS_FAT16 : p_filesystem = new fat16() ; break ;
case FS_FAT32 : p_filesystem = new fat32() ; break ;

View File

@ -73,6 +73,7 @@ Glib::ustring Utils::get_color( FILESYSTEM filesystem )
case FS_EXTENDED : return "#7DFCFE" ; // ~ light blue
case FS_EXT2 : return "#9DB8D2" ; //blue hilight
case FS_EXT3 : return "#7590AE" ; //blue medium
case FS_EXT4 : return "#4B6983" ; //blue dark
case FS_LINUX_SWAP : return "#C1665A" ; //red medium
case FS_FAT16 : return "#00FF00" ; //green
case FS_FAT32 : return "#18D918" ; // ~ medium green
@ -118,6 +119,7 @@ Glib::ustring Utils::get_filesystem_string( FILESYSTEM filesystem )
case FS_EXTENDED : return "extended" ;
case FS_EXT2 : return "ext2" ;
case FS_EXT3 : return "ext3" ;
case FS_EXT4 : return "ext4" ;
case FS_LINUX_SWAP : return "linux-swap" ;
case FS_FAT16 : return "fat16" ;
case FS_FAT32 : return "fat32" ;
@ -143,6 +145,7 @@ Glib::ustring Utils::get_filesystem_software( FILESYSTEM filesystem )
{
case FS_EXT2 : return "e2fsprogs" ;
case FS_EXT3 : return "e2fsprogs" ;
case FS_EXT4 : return "e2fsprogs" ;
case FS_FAT16 : return "dosfstools, mtools" ;
case FS_FAT32 : return "dosfstools, mtools" ;
case FS_HFS : return "hfsutils" ;