added support for reading of volumelabel

* src/reiser4.cc
  src/reiserfs.cc: added support for reading of volumelabel
This commit is contained in:
Bart Hakvoort 2006-09-23 10:52:16 +00:00
parent d106a71822
commit 7a8aabe3fd
3 changed files with 43 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2006-09-24 Bart Hakvoort <hakvoort@cvs.gnome.org>
* src/reiser4.cc
src/reiserfs.cc: added support for reading of volumelabel
2006-09-23 Bart Hakvoort <hakvoort@cvs.gnome.org>
* src/ntfs.cc: added support for reading of volumelabel

View File

@ -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 )

View File

@ -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 )