Add lookup for Linux kernel names of mountable file systems (#742741)

Function Utils::get_filesystem_kernel_name() returns the name of the
file system as needed for use in the mount command:
    mount -t TYPE DEVICE DIR

Needed because the kernel / mount name is 'hfsplus' where as libparted /
GParted, as reported by Utils::get_filesystem_string(), calls it 'hfs+'.
So far just added debugging when mounting a file system to test the
function works.

    # ./gartedbin
    ======================
    libparted : 2.1
    ======================
    DEBUG: (hfsplus) # mount -v /dev/sdb5 "/mnt/5"
    DEBUG: (nilfs2) # mount -v /dev/sdb1 "/mnt/1"

Bug 742741 - Nilfs2 file system is unusable on RHEL/CentOS 6
This commit is contained in:
Mike Fleetwood 2015-01-11 10:01:02 +00:00 committed by Curtis Gedak
parent 30086b2e80
commit 0bdc1fef14
3 changed files with 31 additions and 0 deletions

View File

@ -175,6 +175,7 @@ public:
static Glib::RefPtr<Gdk::Pixbuf> get_color_as_pixbuf( FILESYSTEM filesystem, int width, int height ) ;
static int get_filesystem_label_maxlength( FILESYSTEM filesystem ) ;
static Glib::ustring get_filesystem_string( FILESYSTEM filesystem ) ;
static const Glib::ustring get_filesystem_kernel_name( FILESYSTEM fstype );
static Glib::ustring get_filesystem_software( FILESYSTEM filesystem ) ;
static bool kernel_supports_fs( const Glib::ustring & fs ) ;
static bool kernel_version_at_least( int major_ver, int minor_ver, int patch_ver ) ;

View File

@ -182,6 +182,7 @@ int Utils::get_filesystem_label_maxlength( FILESYSTEM filesystem )
}
}
// Return libparted file system name / GParted display name
Glib::ustring Utils::get_filesystem_string( FILESYSTEM filesystem )
{
switch( filesystem )
@ -244,6 +245,33 @@ Glib::ustring Utils::get_filesystem_string( FILESYSTEM filesystem )
}
}
// Return Linux kernel name only for mountable file systems.
// (Identical to a subset of the libparted names except that it's hfsplus instead of hfs+).
const Glib::ustring Utils::get_filesystem_kernel_name( FILESYSTEM fstype )
{
switch ( fstype )
{
case FS_BTRFS : return "btrfs";
case FS_EXFAT : return "exfat";
case FS_EXT2 : return "ext2";
case FS_EXT3 : return "ext3";
case FS_EXT4 : return "ext4";
case FS_F2FS : return "f2fs";
case FS_FAT16 : return "fat16";
case FS_FAT32 : return "fat32";
case FS_HFS : return "hfs";
case FS_HFSPLUS : return "hfsplus";
case FS_JFS : return "jfs";
case FS_NILFS2 : return "nilfs2";
case FS_NTFS : return "ntfs";
case FS_REISER4 : return "reiser4";
case FS_REISERFS : return "reiserfs";
case FS_UFS : return "ufs";
case FS_XFS : return "xfs";
default : return "";
}
}
Glib::ustring Utils::get_filesystem_software( FILESYSTEM filesystem )
{
switch( filesystem )

View File

@ -2290,6 +2290,8 @@ void Win_GParted::activate_mount_partition( unsigned int index )
selected_partition .get_mountpoints()[ index ] ) ) ;
cmd = "mount -v " + selected_partition.get_path() +
" \"" + selected_partition.get_mountpoints()[index] + "\"";
// FIXME: Replace debugging with mount specifying file system type
std::cout << "DEBUG: (" << Utils::get_filesystem_kernel_name( selected_partition.filesystem ) << ") # " << cmd << std::endl;
success = ! Utils::execute_command( cmd, output, error );
hide_pulsebar();
if ( ! success )