Enhance detection for ext3, fat16, fat32, linux-swap, and hfsplus

This change is in preparation for supporting sectors sizes > 512 bytes.
This commit is contained in:
Curtis Gedak 2010-04-28 14:11:24 -06:00
parent 66355153fb
commit 6369e58bff
2 changed files with 18 additions and 5 deletions

View file

@ -1,4 +1,4 @@
/* Copyright (C) 2008, 2009 Curtis Gedak
/* Copyright (C) 2008, 2009, 2010 Curtis Gedak
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -86,12 +86,23 @@ Glib::ustring FS_Info::get_device_entry( const Glib::ustring & path )
Glib::ustring FS_Info::get_fs_type( const Glib::ustring & path )
{
Glib::ustring fs_type = "" ;
Glib::ustring fs_sec_type = "" ;
//Retrieve the line containing the device path
Glib::ustring temp = get_device_entry( path ) ;
Glib::ustring dev_path_line = get_device_entry( path ) ;
//Retrieve TYPE
fs_type = Utils::regexp_label( temp, "TYPE=\"([^\"]*)\"" ) ;
fs_type = Utils::regexp_label( dev_path_line, "[^_]TYPE=\"([^\"]*)\"" ) ;
fs_sec_type = Utils::regexp_label( dev_path_line, "SEC_TYPE=\"([^\"]*)\"" ) ;
//If vfat, decide whether fat16 or fat32
if ( fs_type == "vfat" )
{
if ( fs_sec_type == "msdos" )
fs_type = "fat16" ;
else
fs_type = "fat32" ;
}
if ( fs_type .empty() && vol_id_found )
{

View file

@ -960,7 +960,8 @@ GParted::FILESYSTEM GParted_Core::get_filesystem()
fs_type == "linux-swap(v1)" ||
fs_type == "linux-swap(new)" ||
fs_type == "linux-swap(v0)" ||
fs_type == "linux-swap(old)" )
fs_type == "linux-swap(old)" ||
fs_type == "swap" )
return GParted::FS_LINUX_SWAP ;
else if ( fs_type == "fat16" )
return GParted::FS_FAT16 ;
@ -976,7 +977,8 @@ GParted::FILESYSTEM GParted_Core::get_filesystem()
return GParted::FS_JFS ;
else if ( fs_type == "hfs" )
return GParted::FS_HFS ;
else if ( fs_type == "hfs+" )
else if ( fs_type == "hfs+" ||
fs_type == "hfsplus" )
return GParted::FS_HFSPLUS ;
else if ( fs_type == "ufs" )
return GParted::FS_UFS ;