use mkdir instead of wrapping CLI tool
* include/FileSystem.h, src/jfs.cc, src/xfs.cc: use mkdir instead of wrapping CLI tool
This commit is contained in:
parent
7f57bb1090
commit
93300e2b32
|
@ -1,3 +1,9 @@
|
||||||
|
2005-12-14 Bart Hakvoort <hakvoort@cvs.gnome.org>
|
||||||
|
|
||||||
|
* include/FileSystem.h,
|
||||||
|
src/jfs.cc,
|
||||||
|
src/xfs.cc: use mkdir instead of wrapping CLI tool
|
||||||
|
|
||||||
2005-12-14 Bart Hakvoort <hakvoort@cvs.gnome.org>
|
2005-12-14 Bart Hakvoort <hakvoort@cvs.gnome.org>
|
||||||
|
|
||||||
* include/Utils.h,
|
* include/Utils.h,
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
|
|
||||||
#include <parted/parted.h>
|
#include <parted/parted.h>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
|
||||||
namespace GParted
|
namespace GParted
|
||||||
{
|
{
|
||||||
|
|
|
@ -103,13 +103,13 @@ bool jfs::Resize( const Partition & partition_new, bool fill_partition )
|
||||||
Glib::ustring TEMP_MP = "/tmp/gparted_tmp_jfs_mountpoint" ;
|
Glib::ustring TEMP_MP = "/tmp/gparted_tmp_jfs_mountpoint" ;
|
||||||
|
|
||||||
//jfs kan only grow if the partition is mounted..
|
//jfs kan only grow if the partition is mounted..
|
||||||
system( ("mkdir " + TEMP_MP) .c_str() ) ;
|
mkdir( TEMP_MP .c_str(), 0 ) ;
|
||||||
if ( Utils::mount( partition_new .partition, TEMP_MP, "jfs", error ) )
|
if ( Utils::mount( partition_new .partition, TEMP_MP, "jfs", error ) )
|
||||||
{
|
{
|
||||||
return_value = Utils::mount( partition_new .partition, TEMP_MP, "jfs", error, MS_REMOUNT, "resize" ) ;
|
return_value = Utils::mount( partition_new .partition, TEMP_MP, "jfs", error, MS_REMOUNT, "resize" ) ;
|
||||||
Utils::unmount( partition_new .partition, TEMP_MP, error ) ;
|
Utils::unmount( partition_new .partition, TEMP_MP, error ) ;
|
||||||
}
|
}
|
||||||
system( ("rmdir " + TEMP_MP) .c_str() ) ;
|
rmdir( TEMP_MP .c_str() ) ;
|
||||||
|
|
||||||
return return_value ;
|
return return_value ;
|
||||||
}
|
}
|
||||||
|
|
11
src/xfs.cc
11
src/xfs.cc
|
@ -100,13 +100,13 @@ bool xfs::Resize( const Partition & partition_new, bool fill_partition )
|
||||||
Glib::ustring TEMP_MP = "/tmp/gparted_tmp_xfs_mountpoint" ;
|
Glib::ustring TEMP_MP = "/tmp/gparted_tmp_xfs_mountpoint" ;
|
||||||
|
|
||||||
//xfs kan only grow if the partition is mounted..
|
//xfs kan only grow if the partition is mounted..
|
||||||
system( ("mkdir " + TEMP_MP) .c_str() ) ;
|
mkdir( TEMP_MP .c_str(), 0 ) ;
|
||||||
if ( Utils::mount( partition_new .partition, TEMP_MP, "xfs", error ) )
|
if ( Utils::mount( partition_new .partition, TEMP_MP, "xfs", error ) )
|
||||||
{
|
{
|
||||||
return_value = ! Execute_Command( "xfs_growfs " + TEMP_MP ) ;
|
return_value = ! Execute_Command( "xfs_growfs " + TEMP_MP ) ;
|
||||||
Utils::unmount( partition_new .partition, TEMP_MP, error ) ;
|
Utils::unmount( partition_new .partition, TEMP_MP, error ) ;
|
||||||
}
|
}
|
||||||
system( ("rmdir " + TEMP_MP) .c_str() ) ;
|
rmdir( TEMP_MP .c_str() ) ;
|
||||||
|
|
||||||
return return_value ;
|
return return_value ;
|
||||||
}
|
}
|
||||||
|
@ -118,7 +118,8 @@ bool xfs::Copy( const Glib::ustring & src_part_path, const Glib::ustring & dest_
|
||||||
Glib::ustring SRC = "/tmp/gparted_tmp_xfs_src_mountpoint" ;
|
Glib::ustring SRC = "/tmp/gparted_tmp_xfs_src_mountpoint" ;
|
||||||
Glib::ustring DST = "/tmp/gparted_tmp_xfs_dest_mountpoint" ;
|
Glib::ustring DST = "/tmp/gparted_tmp_xfs_dest_mountpoint" ;
|
||||||
|
|
||||||
system( ("mkdir " + SRC + " " + DST) .c_str() ) ;
|
mkdir( SRC .c_str(), 0 ) ;
|
||||||
|
mkdir( DST .c_str(), 0 ) ;
|
||||||
|
|
||||||
if ( ! Execute_Command( "mkfs.xfs -f " + dest_part_path ) &&
|
if ( ! Execute_Command( "mkfs.xfs -f " + dest_part_path ) &&
|
||||||
Utils::mount( src_part_path, SRC, "xfs", error, MS_NOATIME | MS_RDONLY ) &&
|
Utils::mount( src_part_path, SRC, "xfs", error, MS_NOATIME | MS_RDONLY ) &&
|
||||||
|
@ -128,7 +129,9 @@ bool xfs::Copy( const Glib::ustring & src_part_path, const Glib::ustring & dest_
|
||||||
|
|
||||||
Utils::unmount( src_part_path, SRC, error ) ;
|
Utils::unmount( src_part_path, SRC, error ) ;
|
||||||
Utils::unmount( dest_part_path, DST, error ) ;
|
Utils::unmount( dest_part_path, DST, error ) ;
|
||||||
system( ("rmdir " + SRC + " " + DST) .c_str() ) ;
|
|
||||||
|
rmdir( SRC .c_str() ) ;
|
||||||
|
rmdir( DST .c_str() ) ;
|
||||||
|
|
||||||
return return_value ;
|
return return_value ;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue