removed ':' from Blocksize scan. dumped progsreiserfs. From now on gparted
* src/ext2.cc, src/ext3.cc: removed ':' from Blocksize scan. * src/reiserfs.cc: dumped progsreiserfs. From now on gparted uses the official namesystools (reiserfsprogs) this resulted in much more reliable creation en resizing of reiserfs filesystems.
This commit is contained in:
parent
bd02bca613
commit
ebcb8f07cf
|
@ -1,3 +1,10 @@
|
||||||
|
2004-11-22 Bart Hakvoort <gparted@users.sf.net>
|
||||||
|
|
||||||
|
* src/ext2.cc,
|
||||||
|
src/ext3.cc: removed ':' from Blocksize scan.
|
||||||
|
* src/reiserfs.cc: dumped progsreiserfs. From now on gparted uses the official namesystools (reiserfsprogs)
|
||||||
|
this resulted in much more reliable creation en resizing of reiserfs filesystems.
|
||||||
|
|
||||||
2004-11-21 Bart Hakvoort <gparted@users.sf.net>
|
2004-11-21 Bart Hakvoort <gparted@users.sf.net>
|
||||||
|
|
||||||
* Again way too many chances to create a detailed entry (i'm glad i'm the only dev atm :P ).
|
* Again way too many chances to create a detailed entry (i'm glad i'm the only dev atm :P ).
|
||||||
|
|
|
@ -64,7 +64,7 @@ void ext2::Set_Used_Sectors( Partition & partition )
|
||||||
free_blocks = atoi( (output .substr( output .find( ":" ) +1, output .length( ) ) ) .c_str( ) ) ;
|
free_blocks = atoi( (output .substr( output .find( ":" ) +1, output .length( ) ) ) .c_str( ) ) ;
|
||||||
|
|
||||||
//blocksize
|
//blocksize
|
||||||
if ( output .find( "Block size:" ) < output .length( ) )
|
if ( output .find( "Block size" ) < output .length( ) )
|
||||||
blocksize = atoi( (output .substr( output .find( ":" ) +1, output .length( ) ) ) .c_str( ) ) ;
|
blocksize = atoi( (output .substr( output .find( ":" ) +1, output .length( ) ) ) .c_str( ) ) ;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,7 +64,7 @@ void ext3::Set_Used_Sectors( Partition & partition )
|
||||||
free_blocks = atoi( (output .substr( output .find( ":" ) +1, output .length( ) ) ) .c_str( ) ) ;
|
free_blocks = atoi( (output .substr( output .find( ":" ) +1, output .length( ) ) ) .c_str( ) ) ;
|
||||||
|
|
||||||
//blocksize
|
//blocksize
|
||||||
if ( output .find( "Block size:" ) < output .length( ) )
|
if ( output .find( "Block size" ) < output .length( ) )
|
||||||
blocksize = atoi( (output .substr( output .find( ":" ) +1, output .length( ) ) ) .c_str( ) ) ;
|
blocksize = atoi( (output .substr( output .find( ":" ) +1, output .length( ) ) ) .c_str( ) ) ;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,16 +27,18 @@ FS reiserfs::get_filesystem_support( )
|
||||||
|
|
||||||
fs .filesystem = "reiserfs" ;
|
fs .filesystem = "reiserfs" ;
|
||||||
|
|
||||||
static void * test_handle = NULL ;
|
if ( ! system( "which debugreiserfs 1>/dev/null 2>/dev/null" ) )
|
||||||
if ( (test_handle = dlopen("libreiserfs.so", RTLD_NOW)) )
|
|
||||||
{
|
|
||||||
fs .read = true ;
|
fs .read = true ;
|
||||||
fs .create = true ;
|
|
||||||
fs .resize = true ;
|
|
||||||
|
|
||||||
dlclose( test_handle ) ;
|
if ( ! system( "which mkfs.reiserfs 1>/dev/null 2>/dev/null" ) )
|
||||||
test_handle = NULL ;
|
fs .create = true ;
|
||||||
}
|
|
||||||
|
if ( ! system( "which reiserfsck 1>/dev/null 2>/dev/null" ) )
|
||||||
|
fs .check = true ;
|
||||||
|
|
||||||
|
//resizing is a delicate process which requires 3 commands..
|
||||||
|
if ( ! system( "which resize_reiserfs 1>/dev/null 2>/dev/null" ) && fs .read && fs .check )
|
||||||
|
fs .resize = true ;
|
||||||
|
|
||||||
if ( ! system( "which dd 1>/dev/null 2>/dev/null" ) )
|
if ( ! system( "which dd 1>/dev/null 2>/dev/null" ) )
|
||||||
fs .copy = true ;
|
fs .copy = true ;
|
||||||
|
@ -46,69 +48,45 @@ FS reiserfs::get_filesystem_support( )
|
||||||
|
|
||||||
void reiserfs::Set_Used_Sectors( Partition & partition )
|
void reiserfs::Set_Used_Sectors( Partition & partition )
|
||||||
{
|
{
|
||||||
PedFileSystem *fs = NULL;
|
char c_buf[ 512 ] ;
|
||||||
PedConstraint *constraint = NULL;
|
FILE *f ;
|
||||||
PedPartition *c_part = NULL ;
|
|
||||||
|
|
||||||
if ( disk )
|
Glib::ustring output ;
|
||||||
{
|
Sector free_blocks = -1, blocksize = -1 ;
|
||||||
c_part = ped_disk_get_partition_by_sector( disk, (partition .sector_end + partition .sector_start) / 2 ) ;
|
|
||||||
if ( c_part )
|
|
||||||
{
|
|
||||||
fs = ped_file_system_open( & c_part ->geom );
|
|
||||||
|
|
||||||
if ( fs )
|
//get free blocks..
|
||||||
|
f = popen( ( "debugreiserfs " + partition .partition ) .c_str( ), "r" ) ;
|
||||||
|
while ( fgets( c_buf, 512, f ) )
|
||||||
{
|
{
|
||||||
constraint = ped_file_system_get_resize_constraint ( fs ) ;
|
output = Glib::locale_to_utf8( c_buf ) ;
|
||||||
if ( constraint )
|
|
||||||
{
|
|
||||||
partition .Set_Unused( (partition .sector_end - partition .sector_start) - constraint ->min_size ) ;
|
|
||||||
|
|
||||||
ped_constraint_destroy ( constraint );
|
//blocksize
|
||||||
}
|
if ( output .find( "Blocksize" ) < output .length( ) )
|
||||||
|
blocksize = atoi( (output .substr( output .find( ":" ) +1, output .length( ) ) ) .c_str( ) ) ;
|
||||||
|
|
||||||
ped_file_system_close( fs ) ;
|
//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 reiserfs::Create( const Glib::ustring device_path, const Partition & new_partition )
|
bool reiserfs::Create( const Glib::ustring device_path, const Partition & new_partition )
|
||||||
{
|
{
|
||||||
bool return_value = false ;
|
return Execute_Command( "mkfs.reiserfs -q " + new_partition .partition ) ;
|
||||||
|
|
||||||
if ( open_device_and_disk( device_path, device, disk ) )
|
|
||||||
{
|
|
||||||
PedPartition *c_part = NULL ;
|
|
||||||
PedFileSystemType *fs_type = NULL ;
|
|
||||||
PedFileSystem *fs = NULL ;
|
|
||||||
|
|
||||||
c_part = ped_disk_get_partition_by_sector( disk, (new_partition .sector_end + new_partition .sector_start) / 2 ) ;
|
|
||||||
if ( c_part )
|
|
||||||
{
|
|
||||||
fs_type = ped_file_system_type_get( "reiserfs" ) ;
|
|
||||||
if ( fs_type )
|
|
||||||
{
|
|
||||||
fs = ped_file_system_create( & c_part ->geom, fs_type, NULL );
|
|
||||||
if ( fs )
|
|
||||||
{
|
|
||||||
if ( ped_partition_set_system(c_part, fs_type ) )
|
|
||||||
return_value = Commit( disk ) ;
|
|
||||||
|
|
||||||
ped_file_system_close( fs );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
close_device_and_disk( device, disk ) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
return return_value ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool reiserfs::Resize( const Partition & partition_new, bool fill_partition )
|
bool reiserfs::Resize( const Partition & partition_new, bool fill_partition )
|
||||||
{
|
{
|
||||||
return false ;
|
Glib::ustring str_temp = "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 ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool reiserfs::Copy( const Glib::ustring & src_part_path, const Glib::ustring & dest_part_path )
|
bool reiserfs::Copy( const Glib::ustring & src_part_path, const Glib::ustring & dest_part_path )
|
||||||
|
@ -118,12 +96,12 @@ bool reiserfs::Copy( const Glib::ustring & src_part_path, const Glib::ustring &
|
||||||
|
|
||||||
bool reiserfs::Check_Repair( const Partition & partition )
|
bool reiserfs::Check_Repair( const Partition & partition )
|
||||||
{
|
{
|
||||||
return false ;
|
return Execute_Command( "reiserfsck -y --fix-fixable " + partition .partition ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
int reiserfs::get_estimated_time( long MB_to_Consider )
|
int reiserfs::get_estimated_time( long MB_to_Consider )
|
||||||
{
|
{
|
||||||
return 1 + MB_to_Consider / 1000 ;
|
return -1 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue