Added detection of btrfs file system
svn path=/trunk/; revision=1075
This commit is contained in:
parent
b9778d7894
commit
dc1ab54d8f
7
AUTHORS
7
AUTHORS
|
@ -1,7 +1,7 @@
|
|||
This file is part of GParted
|
||||
Copyright (C) 2004, 2005, 2006, 2007, 2008
|
||||
Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009
|
||||
Bart Hakvoort
|
||||
Portions Copyright (C) 2008
|
||||
Portions Copyright (C) 2008, 2009
|
||||
Curtis Gedak
|
||||
|
||||
This file may be modified and/or distributed without restriction. This is
|
||||
|
@ -26,6 +26,9 @@ Curtis Gedak <gedakc@users.sourceforge.net>
|
|||
* Created OperationLabelPartition.h, OperationLabelPartition.cc
|
||||
* Maintained from official 0.3.5 release onward
|
||||
|
||||
Luca Bruno <lucab@debian.org>
|
||||
* Wrote patch for initial btrfs support.
|
||||
|
||||
Michael Monreal <michael.monreal@gmx.net>
|
||||
* Wrote small patch to implement themed app icon in hicolor
|
||||
|
||||
|
|
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
|||
2009-02-23 Curtis Gedak <gedakc@gmail.com>
|
||||
|
||||
* include/Utils.h,
|
||||
src/Dialog_Partition_New.cc,
|
||||
src/DialogFeatures.cc,
|
||||
src/GParted_Core.cc,
|
||||
src/Utils.cc,
|
||||
src/Win_GParted.cc: Added detection of btrfs file system.
|
||||
- Thanks to Luca Bruno for the original btrfs patch that I adapted.
|
||||
- Related to GParted bug #571170
|
||||
|
||||
2009-02-20 Curtis Gedak <gedakc@gmail.com>
|
||||
|
||||
* src/Win_GParted.cc: Fixed compiler warning regarding parentheses.
|
||||
|
|
|
@ -68,8 +68,9 @@ enum FILESYSTEM
|
|||
FS_USED = 18,
|
||||
FS_UNUSED = 19,
|
||||
|
||||
FS_LVM2 = 20,
|
||||
FS_LUKS = 21
|
||||
FS_BTRFS = 20, /* FIXME: Move this higher up list when full support added */
|
||||
FS_LVM2 = 21,
|
||||
FS_LUKS = 22
|
||||
} ;
|
||||
|
||||
enum SIZE_UNIT
|
||||
|
|
|
@ -104,8 +104,9 @@ void DialogFeatures::load_filesystems( const std::vector<FS> & FILESYSTEMS )
|
|||
//fill the features chart with valid file systems
|
||||
for ( unsigned short t = 0; t < FILESYSTEMS .size() ; t++ )
|
||||
{
|
||||
//Skip luks, lvm2, and unknown because these are not file systems
|
||||
if ( FILESYSTEMS[ t ] .filesystem == GParted::FS_LUKS ||
|
||||
//Skip btrfs, luks, lvm2, and unknown because these are not file systems
|
||||
if ( FILESYSTEMS[ t ] .filesystem == GParted::FS_BTRFS ||
|
||||
FILESYSTEMS[ t ] .filesystem == GParted::FS_LUKS ||
|
||||
FILESYSTEMS[ t ] .filesystem == GParted::FS_LVM2 ||
|
||||
FILESYSTEMS[ t ] .filesystem == GParted::FS_UNKNOWN
|
||||
)
|
||||
|
|
|
@ -50,7 +50,8 @@ void Dialog_Partition_New::Set_Data( const Partition & partition,
|
|||
{
|
||||
if ( this ->FILESYSTEMS[ t ] .filesystem == GParted::FS_UNKNOWN ||
|
||||
this ->FILESYSTEMS[ t ] .filesystem == GParted::FS_LVM2 ||
|
||||
this ->FILESYSTEMS[ t ] .filesystem == GParted::FS_LUKS
|
||||
this ->FILESYSTEMS[ t ] .filesystem == GParted::FS_LUKS ||
|
||||
this ->FILESYSTEMS[ t ] .filesystem == GParted::FS_BTRFS
|
||||
)
|
||||
this ->FILESYSTEMS .erase( this->FILESYSTEMS .begin() + t ) ;
|
||||
}
|
||||
|
@ -289,7 +290,7 @@ void Dialog_Partition_New::Build_Filesystems_Menu( bool only_unformatted )
|
|||
//fill the file system menu with the file systems (except for extended)
|
||||
for ( unsigned int t = 0 ; t < FILESYSTEMS .size( ) ; t++ )
|
||||
{
|
||||
//skip extended (luks, lvm2, and unknown removed in Set_Data())
|
||||
//skip extended (btrfs, luks, lvm2, and unknown removed in Set_Data())
|
||||
if( FILESYSTEMS[ t ] .filesystem == GParted::FS_EXTENDED )
|
||||
continue ;
|
||||
menu_filesystem .items() .push_back(
|
||||
|
|
|
@ -126,6 +126,11 @@ void GParted_Core::find_supported_filesystems()
|
|||
FILESYSTEMS .push_back( fs_xfs .get_filesystem_support() ) ;
|
||||
|
||||
FS *fs ;
|
||||
//btrfs FIXME: Add full support when on-disk-format stabilized
|
||||
fs = new( FS ) ;
|
||||
fs ->filesystem = GParted::FS_BTRFS ;
|
||||
FILESYSTEMS .push_back( * fs ) ;
|
||||
|
||||
//lvm2 physical volume -- not a file system
|
||||
fs = new( FS ) ;
|
||||
fs ->filesystem = GParted::FS_LVM2 ;
|
||||
|
@ -746,6 +751,8 @@ GParted::FILESYSTEM GParted_Core::get_filesystem()
|
|||
{
|
||||
if ( Glib::ustring( lp_partition ->fs_type ->name ) == "extended" )
|
||||
return GParted::FS_EXTENDED ;
|
||||
else if ( Glib::ustring( lp_partition ->fs_type ->name ) == "btrfs" )
|
||||
return GParted::FS_BTRFS ;
|
||||
else if ( Glib::ustring( lp_partition ->fs_type ->name ) == "ext2" )
|
||||
return GParted::FS_EXT2 ;
|
||||
else if ( Glib::ustring( lp_partition ->fs_type ->name ) == "ext3" )
|
||||
|
@ -836,6 +843,29 @@ GParted::FILESYSTEM GParted_Core::get_filesystem()
|
|||
return GParted::FS_LUKS ;
|
||||
}
|
||||
|
||||
//btrfs
|
||||
#define BTRFS_SUPER_INFO_SIZE 4096
|
||||
#define BTRFS_SUPER_INFO_OFFSET (64 * 1024)
|
||||
#define BTRFS_SIGNATURE "_BHRfS_M"
|
||||
|
||||
char buf_btrfs[BTRFS_SUPER_INFO_SIZE] ;
|
||||
|
||||
ped_device_open( lp_device ) ;
|
||||
ped_geometry_read( & lp_partition ->geom, buf_btrfs, \
|
||||
(BTRFS_SUPER_INFO_OFFSET / 512), \
|
||||
(BTRFS_SUPER_INFO_SIZE / 512)
|
||||
) ;
|
||||
strncpy(magic, buf_btrfs+64, strlen(BTRFS_SIGNATURE)) ; magic[strlen(BTRFS_SIGNATURE)] = '\0' ; //set and terminate string
|
||||
ped_device_close( lp_device ) ;
|
||||
|
||||
if ( magic == Glib::ustring(BTRFS_SIGNATURE) )
|
||||
{
|
||||
temp = _( "BTRFS is not yet supported." ) ;
|
||||
temp += "\n" ;
|
||||
partition_temp .messages .push_back( temp ) ;
|
||||
return GParted::FS_BTRFS ;
|
||||
}
|
||||
|
||||
//no file system found....
|
||||
temp = _( "Unable to detect file system! Possible reasons are:" ) ;
|
||||
temp += "\n-";
|
||||
|
@ -927,7 +957,8 @@ void GParted_Core::set_mountpoints( std::vector<Partition> & partitions )
|
|||
) &&
|
||||
partitions[ t ] .filesystem != GParted::FS_LINUX_SWAP &&
|
||||
partitions[ t ] .filesystem != GParted::FS_LVM2 &&
|
||||
partitions[ t ] .filesystem != GParted::FS_LUKS
|
||||
partitions[ t ] .filesystem != GParted::FS_LUKS &&
|
||||
partitions[ t ] .filesystem != GParted::FS_BTRFS
|
||||
)
|
||||
{
|
||||
if ( partitions[ t ] .busy )
|
||||
|
@ -968,6 +999,7 @@ void GParted_Core::set_used_sectors( std::vector<Partition> & partitions )
|
|||
for ( unsigned int t = 0 ; t < partitions .size() ; t++ )
|
||||
{
|
||||
if ( partitions[ t ] .filesystem != GParted::FS_LINUX_SWAP &&
|
||||
partitions[ t ] .filesystem != GParted::FS_BTRFS &&
|
||||
partitions[ t ] .filesystem != GParted::FS_LUKS &&
|
||||
partitions[ t ] .filesystem != GParted::FS_LVM2 &&
|
||||
partitions[ t ] .filesystem != GParted::FS_UNKNOWN
|
||||
|
|
|
@ -71,6 +71,7 @@ Glib::ustring Utils::get_color( FILESYSTEM filesystem )
|
|||
case FS_UNKNOWN : return "#000000" ; //black
|
||||
case FS_UNFORMATTED : return "#000000" ; //black
|
||||
case FS_EXTENDED : return "#7DFCFE" ; // ~ light blue
|
||||
case FS_BTRFS : return "#FF9955" ; //orange
|
||||
case FS_EXT2 : return "#9DB8D2" ; //blue hilight
|
||||
case FS_EXT3 : return "#7590AE" ; //blue medium
|
||||
case FS_EXT4 : return "#4B6983" ; //blue dark
|
||||
|
@ -118,6 +119,7 @@ Glib::ustring Utils::get_filesystem_string( FILESYSTEM filesystem )
|
|||
case FS_UNKNOWN : return _("unknown") ;
|
||||
case FS_UNFORMATTED : return _("unformatted") ;
|
||||
case FS_EXTENDED : return "extended" ;
|
||||
case FS_BTRFS : return "btrfs" ;
|
||||
case FS_EXT2 : return "ext2" ;
|
||||
case FS_EXT3 : return "ext3" ;
|
||||
case FS_EXT4 : return "ext4" ;
|
||||
|
|
|
@ -385,8 +385,9 @@ Gtk::Menu * Win_GParted::create_format_menu()
|
|||
|
||||
for ( unsigned int t =0; t < gparted_core .get_filesystems() .size() ; t++ )
|
||||
{
|
||||
//Skip luks, lvm2, and unknown because these are not file systems
|
||||
if ( gparted_core .get_filesystems()[ t ] .filesystem == GParted::FS_LUKS ||
|
||||
//Skip btrfs, luks, lvm2, and unknown because these are not file systems
|
||||
if ( gparted_core .get_filesystems()[ t ] .filesystem == GParted::FS_BTRFS ||
|
||||
gparted_core .get_filesystems()[ t ] .filesystem == GParted::FS_LUKS ||
|
||||
gparted_core .get_filesystems()[ t ] .filesystem == GParted::FS_LVM2 ||
|
||||
gparted_core .get_filesystems()[ t ] .filesystem == GParted::FS_UNKNOWN
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue