From b839708add881e218e901b0b6b00a138f8529bcd Mon Sep 17 00:00:00 2001 From: Bart Hakvoort Date: Wed, 29 Dec 2004 16:38:45 +0000 Subject: [PATCH] As explained in the previous entry i've decided to add reiser4 detection * include/GParted_Core.h, src/GParted_Core.cc: As explained in the previous entry i've decided to add reiser4 detection to gparted as well.. --- ChangeLog | 5 +++++ include/GParted_Core.h | 1 + src/GParted_Core.cc | 46 ++++++++++++++++++++++++++++-------------- 3 files changed, 37 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index d8e10555..c0cc4602 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2004-12-29 Bart Hakvoort + + * include/GParted_Core.h, + src/GParted_Core.cc: As explained in the previous entry i've decided to add reiser4 detection to gparted as well.. + 2004-12-29 Bart Hakvoort * Added support for reiser4 (only creation atm, since the other functionality appears to be non-free software :/ ) diff --git a/include/GParted_Core.h b/include/GParted_Core.h index 72da6a2b..30282b0a 100644 --- a/include/GParted_Core.h +++ b/include/GParted_Core.h @@ -63,6 +63,7 @@ public: Glib::RefPtr get_textbuffer( ) ; private: + Glib::ustring Get_Filesystem( ) ; //temporary function.. asa new checks ripple through in libparted i'll remove it. void set_device_partitions( Device & device ) ; void Insert_Unallocated( std::vector & partitions, Sector start, Sector end, bool inside_extended ) ; Glib::ustring get_sym_path( const Glib::ustring & real_path ) ; diff --git a/src/GParted_Core.cc b/src/GParted_Core.cc index e3152021..1b13d215 100644 --- a/src/GParted_Core.cc +++ b/src/GParted_Core.cc @@ -134,6 +134,36 @@ void GParted_Core::get_devices( std::vector & devices ) } } +Glib::ustring GParted_Core::Get_Filesystem( ) +{ + //standard libparted filesystems.. + if ( c_partition ->fs_type ) + return c_partition ->fs_type ->name ; + + //other filesystems libparted couldn't detect (i've send patches for these filesystems to the parted guys) + char buf[512] ; + ped_device_open( device ); + + //reiser4 + ped_geometry_read ( & c_partition ->geom, buf, 128, 1) ; + strcpy( buf, strcmp( buf, "ReIsEr4" ) == 0 ? "reiser4" : "" ) ; + + ped_device_close( device ); + if ( strlen( buf ) ) + return buf ; + + //no filesystem found.... + partition_temp .error = _( "Unable to detect filesystem! Possible reasons are:" ) ; + partition_temp .error += "\n-"; + partition_temp .error += _( "The filesystem is damaged" ) ; + partition_temp .error += "\n-" ; + partition_temp .error += _( "The filesystem is unknown to libparted" ) ; + partition_temp .error += "\n-"; + partition_temp .error += _( "There is no filesystem available (unformatted)" ) ; + + return _("unknown") ; +} + void GParted_Core::set_device_partitions( Device & device ) { int EXT_INDEX = -1 ; @@ -150,24 +180,10 @@ void GParted_Core::set_device_partitions( Device & device ) { case PED_PARTITION_NORMAL: case PED_PARTITION_LOGICAL: - if ( c_partition ->fs_type ) - temp = c_partition ->fs_type ->name ; - else - { - temp = _("unknown") ; - partition_temp .error = _( "Unable to detect filesystem! Possible reasons are:" ) ; - partition_temp .error += "\n-"; - partition_temp .error += _( "The filesystem is damaged" ) ; - partition_temp .error += "\n-" ; - partition_temp .error += _( "The filesystem is unknown to libparted" ) ; - partition_temp .error += "\n-"; - partition_temp .error += _( "There is no filesystem available (unformatted)" ) ; - - } partition_temp .Set( device .path + num_to_str( c_partition ->num ), c_partition ->num, c_partition ->type == 0 ? GParted::PRIMARY : GParted::LOGICAL , - temp, c_partition ->geom .start, + Get_Filesystem( ), c_partition ->geom .start, c_partition ->geom .end, c_partition ->type, ped_partition_is_busy( c_partition ) );