/ ) Also, libparted isn't able to detect reiser4 yet, a patch to fix this

* Added support for reiser4 (only creation atm, since the other functionality appears to be non-free software :/ )
  Also, libparted isn't able to detect reiser4 yet, a patch to fix this is underway, but i should probably add reiser4 detection to gparted as well.
This commit is contained in:
Bart Hakvoort 2004-12-29 00:09:58 +00:00
parent c87cba6ee5
commit eda1386b8c
7 changed files with 183 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2004-12-29 Bart Hakvoort <hakvoort@cvs.gnome.org>
* Added support for reiser4 (only creation atm, since the other functionality appears to be non-free software :/ )
Also, libparted isn't able to detect reiser4 yet, a patch to fix this is underway, but i should probably add reiser4 detection to gparted as well.
2004-12-28 Bart Hakvoort <hakvoort@cvs.gnome.org>
* The Filesystemclasses: Changed 'bool Create( const Glib::ustring & device_path, const Partition & new_partition )'

View File

@ -29,6 +29,7 @@
#include "../include/xfs.h"
#include "../include/jfs.h"
#include "../include/hfs.h"
#include "../include/reiser4.h"
#include <glibmm/ustring.h>

View File

@ -121,7 +121,8 @@ inline Glib::ustring Get_Color( const Glib::ustring & filesystem )
else if ( filesystem == "ntfs" ) return "#42E5AC" ;
//purple something..
else if ( filesystem == "reiserfs" ) return "#ADA7C8" ;
else if ( filesystem == "reiserfs" ) return "#ADA7C8" ;
else if ( filesystem == "reiser4" ) return "#887FA3" ;
//darkyellow
else if ( filesystem == "xfs" ) return "#EED680" ;

41
include/reiser4.h Normal file
View File

@ -0,0 +1,41 @@
/* Copyright (C) 2004 Bart
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef REISER4
#define REISER4
#include "../include/FileSystem.h"
namespace GParted
{
class reiser4 : public FileSystem
{
public:
FS get_filesystem_support( ) ;
void Set_Used_Sectors( Partition & partition ) ;
bool Create( const Partition & new_partition ) ;
bool Resize( const Partition & partition_new, bool fill_partition = false ) ;
bool Copy( const Glib::ustring & src_part_path, const Glib::ustring & dest_part_path ) ;
bool Check_Repair( const Partition & partition ) ;
int get_estimated_time( long MB_to_Consider ) ;
};
} //GParted
#endif //REISER4

View File

@ -42,6 +42,9 @@ void GParted_Core::find_supported_filesystems( )
linux_swap fs_linux_swap;
FILESYSTEMS .push_back( fs_linux_swap .get_filesystem_support( ) ) ;
reiser4 fs_reiser4;
FILESYSTEMS .push_back( fs_reiser4 .get_filesystem_support( ) ) ;
reiserfs fs_reiserfs;
FILESYSTEMS .push_back( fs_reiserfs .get_filesystem_support( ) ) ;
@ -717,6 +720,8 @@ void GParted_Core::set_proper_filesystem( const Glib::ustring & filesystem )
p_filesystem = new jfs( ) ;
else if ( filesystem == "linux-swap" )
p_filesystem = new linux_swap( ) ;
else if ( filesystem == "reiser4" )
p_filesystem = new reiser4( ) ;
else if ( filesystem == "reiserfs" )
p_filesystem = new reiserfs( ) ;
else if ( filesystem == "ntfs" )

View File

@ -41,6 +41,7 @@ gparted_SOURCES = \
linux_swap.cc\
main.cc\
ntfs.cc\
reiser4.cc \
reiserfs.cc\
xfs.cc

128
src/reiser4.cc Normal file
View File

@ -0,0 +1,128 @@
/* Copyright (C) 2004 Bart
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "../include/reiser4.h"
namespace GParted
{
FS reiser4::get_filesystem_support( )
{
FS fs ;
fs .filesystem = "reiser4" ;
if ( ! system( "which debugfs.reiser4 1>/dev/null 2>/dev/null" ) )
fs .read = true ;
if ( ! system( "which mkfs.reiser4 1>/dev/null 2>/dev/null" ) )
fs .create = true ;
if ( ! system( "which fsck.reiser4 1>/dev/null 2>/dev/null" ) )
fs .check = true ;
/*IT SEEMS RESIZE AND COPY AREN'T IMPLEMENTED YET IN THE TOOLS...
SEE http://marc.theaimsgroup.com/?t=109883161600003&r=1&w=2 for more information.. (it seems NameSys is getting commercial? :| )
//resizing is a delicate process ...
if ( ! system( "which resizefs.reiser4 1>/dev/null 2>/dev/null" ) && fs .check )
{
fs .grow = true ;
if ( fs .read ) //needed to determine a min filesystemsize..
fs .shrink = true ;
}
//we need to call resize_reiserfs after a copy to get proper used/unused
if ( ! system( "which cpfs.reiser4 1>/dev/null 2>/dev/null" ) && fs .grow )
fs .copy = true ;
*/
return fs ;
}
void reiser4::Set_Used_Sectors( Partition & partition )
{
char c_buf[ 512 ] ;
FILE *f ;
Glib::ustring output ;
Sector free_blocks = -1, blocksize = -1 ;
//get free blocks..
f = popen( ( "LC_ALL=C debugfs.reiser4 " + partition .partition ) .c_str( ), "r" ) ;
while ( fgets( c_buf, 512, f ) )
{
output = Glib::locale_to_utf8( c_buf ) ;
//blocksize
if ( output .find( "blksize" ) < output .length( ) )
blocksize = atoi( (output .substr( output .find( ":" ) +1, output .length( ) ) ) .c_str( ) ) ;
//free blocks
if ( output .find( "free blocks" ) < output .length( ) )
free_blocks = atoi( (output .substr( output .find( ":" ) +1, output .length( ) ) ) .c_str( ) ) ;
}
pclose( f ) ;
if ( free_blocks > -1 && blocksize > -1 )
partition .Set_Unused( free_blocks * blocksize / 512 ) ;
}
bool reiser4::Create( const Partition & new_partition )
{
return ! Execute_Command( "mkfs.reiser4 -y " + new_partition .partition ) ;
}
bool reiser4::Resize( const Partition & partition_new, bool fill_partition )
{/*
Glib::ustring str_temp = "LC_NUMERIC=C echo y | resize_reiserfs " + partition_new .partition ;
if ( ! fill_partition )
str_temp += " -s " + num_to_str( partition_new .Get_Length_MB( ) - cylinder_size ) + "M" ;
return ! Execute_Command( str_temp ) ; */
return true ;
}
bool reiser4::Copy( const Glib::ustring & src_part_path, const Glib::ustring & dest_part_path )
{
/* if ( ! Execute_Command( "ntfsclone -f --overwrite " + dest_part_path + " " + src_part_path ) )
{
Partition partition ;
partition .partition = dest_part_path ;
return Resize( partition, true ) ;
}
return false ;*/
return true ;
}
bool reiser4::Check_Repair( const Partition & partition )
{
return ! Execute_Command( "fsck.reiser4 -y --fix " + partition .partition ) ;
}
int reiser4::get_estimated_time( long MB_to_Consider )
{
return -1 ;
}
} //GParted