From 7a8aabe3fdd61492db27e18bb268be7ec7ba0267 Mon Sep 17 00:00:00 2001 From: Bart Hakvoort Date: Sat, 23 Sep 2006 10:52:16 +0000 Subject: [PATCH] added support for reading of volumelabel * src/reiser4.cc src/reiserfs.cc: added support for reading of volumelabel --- ChangeLog | 5 +++++ src/reiser4.cc | 19 +++++++++++++++++++ src/reiserfs.cc | 19 +++++++++++++++++++ 3 files changed, 43 insertions(+) diff --git a/ChangeLog b/ChangeLog index 92fb3567..6e371d61 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2006-09-24 Bart Hakvoort + + * src/reiser4.cc + src/reiserfs.cc: added support for reading of volumelabel + 2006-09-23 Bart Hakvoort * src/ntfs.cc: added support for reading of volumelabel diff --git a/src/reiser4.cc b/src/reiser4.cc index 43572615..4d3207ae 100644 --- a/src/reiser4.cc +++ b/src/reiser4.cc @@ -27,7 +27,10 @@ FS reiser4::get_filesystem_support() fs .filesystem = GParted::FS_REISER4 ; if ( ! Glib::find_program_in_path( "debugfs.reiser4" ) .empty() ) + { fs .read = GParted::FS::EXTERNAL ; + fs .get_label = FS::EXTERNAL ; + } if ( ! Glib::find_program_in_path( "mkfs.reiser4" ) .empty() ) fs .create = GParted::FS::EXTERNAL ; @@ -79,6 +82,22 @@ void reiser4::set_used_sectors( Partition & partition ) void reiser4::get_label( Partition & partition ) { + if ( ! Utils::execute_command( "debugfs.reiser4 " + partition .get_path(), output, error, true ) ) + { + char buf[512] ; + index = output .find( "label" ) ; + + if ( index < output .length() && sscanf( output .substr( index ) .c_str(), "label: %512s", buf ) == 1 ) + partition .label = buf ; + } + else + { + if ( ! output .empty() ) + partition .messages .push_back( output ) ; + + if ( ! error .empty() ) + partition .messages .push_back( error ) ; + } } bool reiser4::create( const Partition & new_partition, OperationDetail & operationdetail ) diff --git a/src/reiserfs.cc b/src/reiserfs.cc index c6158781..3ea07463 100644 --- a/src/reiserfs.cc +++ b/src/reiserfs.cc @@ -27,7 +27,10 @@ FS reiserfs::get_filesystem_support() fs .filesystem = GParted::FS_REISERFS ; if ( ! Glib::find_program_in_path( "debugreiserfs" ) .empty() ) + { fs .read = GParted::FS::EXTERNAL ; + fs .get_label = FS::EXTERNAL ; + } if ( ! Glib::find_program_in_path( "mkreiserfs" ) .empty() ) fs .create = GParted::FS::EXTERNAL ; @@ -84,6 +87,22 @@ void reiserfs::set_used_sectors( Partition & partition ) void reiserfs::get_label( Partition & partition ) { + if ( ! Utils::execute_command( "debugreiserfs " + partition .get_path(), output, error, true ) ) + { + char buf[512] ; + index = output .find( "LABEL" ) ; + + if ( index < output .length() && sscanf( output .substr( index ) .c_str(), "LABEL: %512s", buf ) == 1 ) + partition .label = buf ; + } + else + { + if ( ! output .empty() ) + partition .messages .push_back( output ) ; + + if ( ! error .empty() ) + partition .messages .push_back( error ) ; + } } bool reiserfs::create( const Partition & new_partition, OperationDetail & operationdetail )