2009-11-05 11:08:32 -07:00
|
|
|
/* Copyright (C) 2004 Bart
|
2010-04-26 13:40:38 -06:00
|
|
|
* Copyright (C) 2008, 2009, 2010 Curtis Gedak
|
2004-12-13 14:24:12 -07:00
|
|
|
*
|
|
|
|
* 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/xfs.h"
|
|
|
|
|
2006-01-19 16:30:17 -07:00
|
|
|
#include <cerrno>
|
|
|
|
|
2004-12-13 14:24:12 -07:00
|
|
|
namespace GParted
|
|
|
|
{
|
|
|
|
|
2006-02-25 05:25:18 -07:00
|
|
|
FS xfs::get_filesystem_support()
|
2004-12-13 14:24:12 -07:00
|
|
|
{
|
|
|
|
FS fs ;
|
2005-12-07 04:21:27 -07:00
|
|
|
fs .filesystem = GParted::FS_XFS ;
|
2006-01-24 05:31:58 -07:00
|
|
|
|
|
|
|
if ( ! Glib::find_program_in_path( "xfs_db" ) .empty() )
|
2006-10-01 07:08:57 -06:00
|
|
|
{
|
2005-11-26 17:57:11 -07:00
|
|
|
fs .read = GParted::FS::EXTERNAL ;
|
2008-11-08 16:55:17 -07:00
|
|
|
fs .read_label = FS::EXTERNAL ;
|
2006-10-01 07:08:57 -06:00
|
|
|
}
|
2008-04-07 13:41:18 -06:00
|
|
|
|
|
|
|
if ( ! Glib::find_program_in_path( "xfs_admin" ) .empty() )
|
2008-11-08 16:55:17 -07:00
|
|
|
fs .write_label = FS::EXTERNAL ;
|
2008-04-07 13:41:18 -06:00
|
|
|
|
2006-01-24 05:31:58 -07:00
|
|
|
if ( ! Glib::find_program_in_path( "mkfs.xfs" ) .empty() )
|
2005-11-26 17:57:11 -07:00
|
|
|
fs .create = GParted::FS::EXTERNAL ;
|
2004-12-13 14:24:12 -07:00
|
|
|
|
2006-01-24 05:31:58 -07:00
|
|
|
if ( ! Glib::find_program_in_path( "xfs_repair" ) .empty() )
|
2005-11-26 17:57:11 -07:00
|
|
|
fs .check = GParted::FS::EXTERNAL ;
|
2004-12-13 14:24:12 -07:00
|
|
|
|
2006-02-15 09:05:26 -07:00
|
|
|
//resizing of xfs requires xfs_growfs, xfs_repair, mount, umount and xfs support in the kernel
|
|
|
|
if ( ! Glib::find_program_in_path( "xfs_growfs" ) .empty() &&
|
|
|
|
! Glib::find_program_in_path( "mount" ) .empty() &&
|
|
|
|
! Glib::find_program_in_path( "umount" ) .empty() &&
|
|
|
|
fs .check )
|
2004-12-13 14:24:12 -07:00
|
|
|
{
|
|
|
|
Glib::ustring line ;
|
|
|
|
std::ifstream input( "/proc/filesystems" ) ;
|
|
|
|
while ( input >> line )
|
|
|
|
if ( line == "xfs" )
|
|
|
|
{
|
2005-11-26 17:57:11 -07:00
|
|
|
fs .grow = GParted::FS::EXTERNAL ;
|
2004-12-13 14:24:12 -07:00
|
|
|
break ;
|
|
|
|
}
|
|
|
|
|
|
|
|
input .close( ) ;
|
|
|
|
}
|
|
|
|
|
2006-01-24 05:31:58 -07:00
|
|
|
if ( ! Glib::find_program_in_path( "xfsdump" ) .empty() &&
|
|
|
|
! Glib::find_program_in_path( "xfsrestore" ) .empty() &&
|
2006-02-15 09:05:26 -07:00
|
|
|
! Glib::find_program_in_path( "mount" ) .empty() &&
|
|
|
|
! Glib::find_program_in_path( "umount" ) .empty() &&
|
2006-01-24 05:31:58 -07:00
|
|
|
fs .check && fs .create )
|
2005-11-26 17:57:11 -07:00
|
|
|
fs .copy = GParted::FS::EXTERNAL ;
|
2004-12-13 14:24:12 -07:00
|
|
|
|
2006-07-19 14:12:46 -06:00
|
|
|
if ( fs .check )
|
|
|
|
fs .move = GParted::FS::GPARTED ;
|
|
|
|
|
2010-04-26 13:40:38 -06:00
|
|
|
fs .MIN = 32 * MEBIBYTE ;//official minsize = 16MB, but the smallest xfs_repair can handle is 32MB...
|
2004-12-13 14:24:12 -07:00
|
|
|
|
|
|
|
return fs ;
|
|
|
|
}
|
|
|
|
|
2006-08-20 03:33:54 -06:00
|
|
|
void xfs::set_used_sectors( Partition & partition )
|
2004-12-13 14:24:12 -07:00
|
|
|
{
|
2006-02-15 09:05:26 -07:00
|
|
|
if ( ! Utils::execute_command(
|
2006-03-14 14:37:47 -07:00
|
|
|
"xfs_db -c 'sb 0' -c 'print blocksize' -c 'print fdblocks' -r " + partition .get_path(),
|
2006-02-15 09:05:26 -07:00
|
|
|
output,
|
|
|
|
error,
|
|
|
|
true ) )
|
2004-12-13 14:24:12 -07:00
|
|
|
{
|
2006-01-22 06:23:58 -07:00
|
|
|
//blocksize
|
|
|
|
if ( sscanf( output .c_str(), "blocksize = %Ld", &S ) != 1 )
|
|
|
|
S = -1 ;
|
2005-12-28 09:43:06 -07:00
|
|
|
|
2006-01-22 06:23:58 -07:00
|
|
|
//free blocks
|
2006-07-19 11:26:42 -06:00
|
|
|
index = output .find( "fdblocks" ) ;
|
|
|
|
if ( index > output .length() ||
|
|
|
|
sscanf( output .substr( index ) .c_str(), "fdblocks = %Ld", &N ) != 1 )
|
2006-01-22 06:23:58 -07:00
|
|
|
N = -1 ;
|
2005-12-28 09:43:06 -07:00
|
|
|
|
2006-01-22 06:23:58 -07:00
|
|
|
if ( N > -1 && S > -1 )
|
2010-04-28 13:25:57 -06:00
|
|
|
partition .Set_Unused( Utils::round( N * ( S / double(partition .sector_size) ) ) ) ;
|
2006-01-22 06:23:58 -07:00
|
|
|
}
|
2006-02-25 05:25:18 -07:00
|
|
|
else
|
2006-09-08 14:51:31 -06:00
|
|
|
{
|
|
|
|
if ( ! output .empty() )
|
|
|
|
partition .messages .push_back( output ) ;
|
|
|
|
|
|
|
|
if ( ! error .empty() )
|
|
|
|
partition .messages .push_back( error ) ;
|
|
|
|
}
|
2004-12-13 14:24:12 -07:00
|
|
|
}
|
|
|
|
|
2008-11-08 16:55:17 -07:00
|
|
|
void xfs::read_label( Partition & partition )
|
2006-09-12 14:34:33 -06:00
|
|
|
{
|
2008-04-07 13:41:18 -06:00
|
|
|
if ( ! Utils::execute_command( "xfs_db -r -c 'label' " + partition .get_path(), output, error, true ) )
|
2006-10-01 07:08:57 -06:00
|
|
|
{
|
2008-04-07 13:41:18 -06:00
|
|
|
partition .label = Utils::regexp_label( output, "^label = \"(.*)\"" ) ;
|
2006-10-01 07:08:57 -06:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ( ! output .empty() )
|
|
|
|
partition .messages .push_back( output ) ;
|
|
|
|
|
|
|
|
if ( ! error .empty() )
|
|
|
|
partition .messages .push_back( error ) ;
|
|
|
|
}
|
2008-04-07 13:41:18 -06:00
|
|
|
}
|
2006-10-01 07:08:57 -06:00
|
|
|
|
2008-11-08 16:55:17 -07:00
|
|
|
bool xfs::write_label( const Partition & partition, OperationDetail & operationdetail )
|
2008-04-07 13:41:18 -06:00
|
|
|
{
|
|
|
|
Glib::ustring cmd = "" ;
|
|
|
|
if( partition .label .empty() )
|
|
|
|
cmd = String::ucompose( "xfs_admin -L -- %1", partition .get_path() ) ;
|
|
|
|
else
|
|
|
|
cmd = String::ucompose( "xfs_admin -L \"%1\" %2", partition .label, partition .get_path() ) ;
|
|
|
|
return ! execute_command( cmd, operationdetail ) ;
|
2006-09-12 14:34:33 -06:00
|
|
|
}
|
|
|
|
|
2006-08-20 03:33:54 -06:00
|
|
|
bool xfs::create( const Partition & new_partition, OperationDetail & operationdetail )
|
2004-12-13 14:24:12 -07:00
|
|
|
{
|
2008-11-18 16:58:17 -07:00
|
|
|
//mkfs.xfs will not create file system if label is longer than 12 characters, hence truncation.
|
2008-04-07 13:41:18 -06:00
|
|
|
Glib::ustring label = new_partition .label ;
|
|
|
|
if( label .length() > 12 )
|
|
|
|
label = label.substr( 0, 12 ) ;
|
|
|
|
return ! execute_command( "mkfs.xfs -f -L \"" + label + "\" " + new_partition .get_path(), operationdetail ) ;
|
2004-12-13 14:24:12 -07:00
|
|
|
}
|
|
|
|
|
2006-08-20 03:33:54 -06:00
|
|
|
bool xfs::resize( const Partition & partition_new, OperationDetail & operationdetail, bool fill_partition )
|
2006-01-19 16:30:17 -07:00
|
|
|
{
|
2004-12-13 14:24:12 -07:00
|
|
|
bool return_value = false ;
|
2005-12-14 07:47:58 -07:00
|
|
|
Glib::ustring error ;
|
2008-11-18 16:58:17 -07:00
|
|
|
Glib::ustring TEMP_MP = Glib::get_tmp_dir() + "/gparted_tmp_xfs_mount_point" ;
|
2006-01-19 16:30:17 -07:00
|
|
|
|
2008-11-18 16:58:17 -07:00
|
|
|
//create mount point...
|
|
|
|
operationdetail .add_child( OperationDetail( String::ucompose( _("create temporary mount point (%1)"), TEMP_MP ) ) ) ;
|
2006-01-19 16:30:17 -07:00
|
|
|
if ( ! mkdir( TEMP_MP .c_str(), 0 ) )
|
|
|
|
{
|
2006-08-20 03:33:54 -06:00
|
|
|
operationdetail .get_last_child() .set_status( STATUS_SUCCES ) ;
|
2006-01-19 16:30:17 -07:00
|
|
|
|
|
|
|
//mount partition
|
2006-08-20 03:33:54 -06:00
|
|
|
operationdetail .add_child(
|
2006-07-29 02:27:28 -06:00
|
|
|
OperationDetail( String::ucompose( _("mount %1 on %2"), partition_new .get_path(), TEMP_MP ) ) ) ;
|
2006-02-15 09:05:26 -07:00
|
|
|
|
2006-03-14 14:37:47 -07:00
|
|
|
if ( ! execute_command( "mount -v -t xfs " + partition_new .get_path() + " " + TEMP_MP,
|
2006-08-20 03:33:54 -06:00
|
|
|
operationdetail .get_last_child() ) )
|
2006-01-19 16:30:17 -07:00
|
|
|
{
|
2006-08-20 03:33:54 -06:00
|
|
|
operationdetail .get_last_child() .set_status( STATUS_SUCCES ) ;
|
2006-01-19 16:30:17 -07:00
|
|
|
|
2008-11-18 16:58:17 -07:00
|
|
|
//grow the mounted file system..
|
|
|
|
operationdetail .add_child( OperationDetail( _("grow mounted file system") ) ) ;
|
2006-02-15 09:05:26 -07:00
|
|
|
|
2006-08-20 03:33:54 -06:00
|
|
|
if ( ! execute_command ( "xfs_growfs " + TEMP_MP, operationdetail .get_last_child() ) )
|
2006-01-19 16:30:17 -07:00
|
|
|
{
|
2006-08-20 03:33:54 -06:00
|
|
|
operationdetail .get_last_child() .set_status( STATUS_SUCCES ) ;
|
2006-01-19 16:30:17 -07:00
|
|
|
return_value = true ;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-08-20 03:33:54 -06:00
|
|
|
operationdetail .get_last_child() .set_status( STATUS_ERROR ) ;
|
2006-01-19 16:30:17 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
//and unmount it...
|
2006-08-20 03:33:54 -06:00
|
|
|
operationdetail .add_child(
|
2006-07-29 02:27:28 -06:00
|
|
|
OperationDetail( String::ucompose( _("unmount %1"), partition_new .get_path() ) ) ) ;
|
2006-02-15 09:05:26 -07:00
|
|
|
|
2006-03-14 14:37:47 -07:00
|
|
|
if ( ! execute_command( "umount -v " + partition_new .get_path(),
|
2006-08-20 03:33:54 -06:00
|
|
|
operationdetail .get_last_child() ) )
|
2006-01-19 16:30:17 -07:00
|
|
|
{
|
2006-08-20 03:33:54 -06:00
|
|
|
operationdetail .get_last_child() .set_status( STATUS_SUCCES ) ;
|
2006-01-19 16:30:17 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-08-20 03:33:54 -06:00
|
|
|
operationdetail .get_last_child() .set_status( STATUS_ERROR ) ;
|
2006-01-19 16:30:17 -07:00
|
|
|
return_value = false ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-08-20 03:33:54 -06:00
|
|
|
operationdetail .get_last_child() .set_status( STATUS_ERROR ) ;
|
2006-01-19 16:30:17 -07:00
|
|
|
}
|
|
|
|
|
2008-11-18 16:58:17 -07:00
|
|
|
//remove the mount point..
|
2006-08-20 03:33:54 -06:00
|
|
|
operationdetail .add_child(
|
2008-11-18 16:58:17 -07:00
|
|
|
OperationDetail( String::ucompose( _("remove temporary mount point (%1)"), TEMP_MP ) ) ) ;
|
2006-01-19 16:30:17 -07:00
|
|
|
if ( ! rmdir( TEMP_MP .c_str() ) )
|
|
|
|
{
|
2006-08-20 03:33:54 -06:00
|
|
|
operationdetail .get_last_child() .set_status( STATUS_SUCCES ) ;
|
2006-01-19 16:30:17 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-08-20 03:33:54 -06:00
|
|
|
operationdetail .get_last_child() .set_status( STATUS_ERROR ) ;
|
|
|
|
operationdetail .get_last_child() .add_child(
|
2006-07-29 02:27:28 -06:00
|
|
|
OperationDetail( Glib::strerror( errno ), STATUS_NONE ) ) ;
|
2006-01-19 16:30:17 -07:00
|
|
|
|
|
|
|
return_value = false ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
2004-12-13 14:24:12 -07:00
|
|
|
{
|
2006-08-20 03:33:54 -06:00
|
|
|
operationdetail .get_last_child() .set_status( STATUS_ERROR ) ;
|
|
|
|
operationdetail .get_last_child() .add_child( OperationDetail( Glib::strerror( errno ), STATUS_NONE ) ) ;
|
2004-12-13 14:24:12 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
return return_value ;
|
|
|
|
}
|
|
|
|
|
2006-08-20 03:33:54 -06:00
|
|
|
bool xfs::copy( const Glib::ustring & src_part_path,
|
2006-01-19 12:15:15 -07:00
|
|
|
const Glib::ustring & dest_part_path,
|
2006-08-20 03:33:54 -06:00
|
|
|
OperationDetail & operationdetail )
|
2006-01-20 12:45:55 -07:00
|
|
|
{
|
2004-12-20 12:09:48 -07:00
|
|
|
bool return_value = false ;
|
2005-12-14 07:47:58 -07:00
|
|
|
Glib::ustring error ;
|
2008-11-18 16:58:17 -07:00
|
|
|
Glib::ustring SRC = Glib::get_tmp_dir() + "/gparted_tmp_xfs_src_mount_point" ;
|
|
|
|
Glib::ustring DST = Glib::get_tmp_dir() + "/gparted_tmp_xfs_dest_mount_point" ;
|
2004-12-20 12:09:48 -07:00
|
|
|
|
2008-11-18 16:58:17 -07:00
|
|
|
//create xfs file system on destination..
|
|
|
|
/*TO TRANSLATORS: looks like Create new xfs file system */
|
2006-08-20 03:33:54 -06:00
|
|
|
operationdetail .add_child( OperationDetail(
|
2008-11-18 16:58:17 -07:00
|
|
|
String::ucompose( _("create new %1 file system"), Utils::get_filesystem_string( FS_XFS ) ) ) ) ;
|
2006-08-20 03:33:54 -06:00
|
|
|
|
|
|
|
if ( create( Partition( dest_part_path ), operationdetail .get_last_child() ) )
|
2006-01-20 12:45:55 -07:00
|
|
|
{
|
2006-08-20 03:33:54 -06:00
|
|
|
operationdetail .get_last_child() .set_status( STATUS_SUCCES ) ;
|
|
|
|
|
2008-11-18 16:58:17 -07:00
|
|
|
//create source mount point...
|
2006-08-20 03:33:54 -06:00
|
|
|
operationdetail .add_child(
|
2008-11-18 16:58:17 -07:00
|
|
|
OperationDetail( String::ucompose( _("create temporary mount point (%1)"), SRC ) ) ) ;
|
2006-01-20 12:45:55 -07:00
|
|
|
if ( ! mkdir( SRC .c_str(), 0 ) )
|
|
|
|
{
|
2006-08-20 03:33:54 -06:00
|
|
|
operationdetail .get_last_child() .set_status( STATUS_SUCCES ) ;
|
2006-01-20 12:45:55 -07:00
|
|
|
|
2008-11-18 16:58:17 -07:00
|
|
|
//create destination mount point...
|
2006-08-20 03:33:54 -06:00
|
|
|
operationdetail .add_child(
|
2008-11-18 16:58:17 -07:00
|
|
|
OperationDetail( String::ucompose( _("create temporary mount point (%1)"), DST ) ) ) ;
|
2006-01-20 12:45:55 -07:00
|
|
|
if ( ! mkdir( DST .c_str(), 0 ) )
|
|
|
|
{
|
2006-08-20 03:33:54 -06:00
|
|
|
operationdetail .get_last_child() .set_status( STATUS_SUCCES ) ;
|
2006-01-20 12:45:55 -07:00
|
|
|
|
|
|
|
//mount source partition
|
2006-08-20 03:33:54 -06:00
|
|
|
operationdetail .add_child(
|
2006-07-29 02:27:28 -06:00
|
|
|
OperationDetail( String::ucompose( _("mount %1 on %2"), src_part_path, SRC ) ) ) ;
|
2006-02-15 09:05:26 -07:00
|
|
|
|
|
|
|
if ( ! execute_command( "mount -v -t xfs -o noatime,ro " + src_part_path + " " + SRC,
|
2006-08-20 03:33:54 -06:00
|
|
|
operationdetail .get_last_child() ) )
|
2006-01-20 12:45:55 -07:00
|
|
|
{
|
2006-08-20 03:33:54 -06:00
|
|
|
operationdetail .get_last_child() .set_status( STATUS_SUCCES ) ;
|
2006-01-20 12:45:55 -07:00
|
|
|
|
|
|
|
//mount destination partition
|
2006-08-20 03:33:54 -06:00
|
|
|
operationdetail .add_child(
|
2006-07-29 02:27:28 -06:00
|
|
|
OperationDetail( String::ucompose( _("mount %1 on %2"), dest_part_path, DST ) ) ) ;
|
2006-02-15 09:05:26 -07:00
|
|
|
|
|
|
|
if ( ! execute_command( "mount -v -t xfs " + dest_part_path + " " + DST,
|
2006-08-20 03:33:54 -06:00
|
|
|
operationdetail .get_last_child() ) )
|
2006-01-20 12:45:55 -07:00
|
|
|
{
|
2006-08-20 03:33:54 -06:00
|
|
|
operationdetail .get_last_child() .set_status( STATUS_SUCCES ) ;
|
2004-12-14 15:49:44 -07:00
|
|
|
|
2008-11-18 16:58:17 -07:00
|
|
|
//copy file system..
|
|
|
|
operationdetail .add_child( OperationDetail( _("copy file system") ) ) ;
|
2006-01-20 12:45:55 -07:00
|
|
|
|
2006-02-15 09:05:26 -07:00
|
|
|
if ( ! execute_command(
|
|
|
|
"xfsdump -J - " + SRC + " | xfsrestore -J - " + DST,
|
2006-08-20 03:33:54 -06:00
|
|
|
operationdetail .get_last_child() ) )
|
2006-01-20 12:45:55 -07:00
|
|
|
{
|
2006-08-20 03:33:54 -06:00
|
|
|
operationdetail .get_last_child() .set_status( STATUS_SUCCES ) ;
|
2006-01-20 12:45:55 -07:00
|
|
|
return_value = true ;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-08-20 03:33:54 -06:00
|
|
|
operationdetail .get_last_child() .set_status( STATUS_ERROR ) ;
|
2006-01-20 12:45:55 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
//unmount destination partition
|
2006-08-20 03:33:54 -06:00
|
|
|
operationdetail .add_child(
|
2006-07-29 02:27:28 -06:00
|
|
|
OperationDetail( String::ucompose( _("unmount %1"),
|
2006-06-17 10:38:15 -06:00
|
|
|
dest_part_path ) ) ) ;
|
2006-02-15 09:05:26 -07:00
|
|
|
|
|
|
|
if ( ! execute_command( "umount -v " + dest_part_path,
|
2006-08-20 03:33:54 -06:00
|
|
|
operationdetail .get_last_child() ) )
|
2006-01-20 12:45:55 -07:00
|
|
|
{
|
2006-08-20 03:33:54 -06:00
|
|
|
operationdetail .get_last_child() .set_status( STATUS_SUCCES ) ;
|
2006-01-20 12:45:55 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-08-20 03:33:54 -06:00
|
|
|
operationdetail .get_last_child() .set_status( STATUS_ERROR ) ;
|
2006-01-20 12:45:55 -07:00
|
|
|
return_value = false ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-08-20 03:33:54 -06:00
|
|
|
operationdetail .get_last_child() .set_status( STATUS_ERROR ) ;
|
2006-01-20 12:45:55 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
//unmount source partition
|
2006-08-20 03:33:54 -06:00
|
|
|
operationdetail .add_child(
|
2006-07-29 02:27:28 -06:00
|
|
|
OperationDetail( String::ucompose( _("unmount %1"), src_part_path ) ) ) ;
|
2006-02-15 09:05:26 -07:00
|
|
|
|
|
|
|
if ( ! execute_command( "umount -v " + src_part_path,
|
2006-08-20 03:33:54 -06:00
|
|
|
operationdetail .get_last_child() ) )
|
2006-01-20 12:45:55 -07:00
|
|
|
{
|
2006-08-20 03:33:54 -06:00
|
|
|
operationdetail .get_last_child() .set_status( STATUS_SUCCES ) ;
|
2006-01-20 12:45:55 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-08-20 03:33:54 -06:00
|
|
|
operationdetail .get_last_child() .set_status( STATUS_ERROR ) ;
|
2006-01-20 12:45:55 -07:00
|
|
|
return_value = false ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-08-20 03:33:54 -06:00
|
|
|
operationdetail .get_last_child() .set_status( STATUS_ERROR ) ;
|
2006-01-20 12:45:55 -07:00
|
|
|
}
|
2004-12-20 12:09:48 -07:00
|
|
|
|
2008-11-18 16:58:17 -07:00
|
|
|
//remove destination mount point..
|
2006-08-20 03:33:54 -06:00
|
|
|
operationdetail .add_child(
|
2008-11-18 16:58:17 -07:00
|
|
|
OperationDetail( String::ucompose( _("remove temporary mount point (%1)"), DST ) ) ) ;
|
2006-01-20 12:45:55 -07:00
|
|
|
if ( ! rmdir( DST .c_str() ) )
|
|
|
|
{
|
2006-08-20 03:33:54 -06:00
|
|
|
operationdetail .get_last_child() .set_status( STATUS_SUCCES ) ;
|
2006-01-20 12:45:55 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-08-20 03:33:54 -06:00
|
|
|
operationdetail .get_last_child() .set_status( STATUS_ERROR ) ;
|
|
|
|
operationdetail .get_last_child() .add_child(
|
2006-07-29 02:27:28 -06:00
|
|
|
OperationDetail( Glib::strerror( errno ), STATUS_NONE ) ) ;
|
2004-12-20 12:09:48 -07:00
|
|
|
|
2006-01-20 12:45:55 -07:00
|
|
|
return_value = false ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-08-20 03:33:54 -06:00
|
|
|
operationdetail .get_last_child() .set_status( STATUS_ERROR ) ;
|
|
|
|
operationdetail .get_last_child() .add_child(
|
2006-07-29 02:27:28 -06:00
|
|
|
OperationDetail( Glib::strerror( errno ), STATUS_NONE ) ) ;
|
2006-01-20 12:45:55 -07:00
|
|
|
}
|
|
|
|
|
2008-11-18 16:58:17 -07:00
|
|
|
//remove source mount point..
|
2006-08-20 03:33:54 -06:00
|
|
|
operationdetail .add_child(
|
2008-11-18 16:58:17 -07:00
|
|
|
OperationDetail( String::ucompose( _("remove temporary mount point (%1)"), SRC ) ) ) ;
|
2006-01-20 12:45:55 -07:00
|
|
|
if ( ! rmdir( SRC .c_str() ) )
|
|
|
|
{
|
2006-08-20 03:33:54 -06:00
|
|
|
operationdetail .get_last_child() .set_status( STATUS_SUCCES ) ;
|
2006-01-20 12:45:55 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-08-20 03:33:54 -06:00
|
|
|
operationdetail .get_last_child() .set_status( STATUS_ERROR ) ;
|
|
|
|
operationdetail .get_last_child() .add_child(
|
2006-07-29 02:27:28 -06:00
|
|
|
OperationDetail( Glib::strerror( errno ), STATUS_NONE ) ) ;
|
2006-01-20 12:45:55 -07:00
|
|
|
|
|
|
|
return_value = false ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-08-20 03:33:54 -06:00
|
|
|
operationdetail .get_last_child() .set_status( STATUS_ERROR ) ;
|
|
|
|
operationdetail .get_last_child() .add_child(
|
2006-07-29 02:27:28 -06:00
|
|
|
OperationDetail( Glib::strerror( errno ), STATUS_NONE ) ) ;
|
2006-01-20 12:45:55 -07:00
|
|
|
}
|
|
|
|
}
|
2006-08-20 03:33:54 -06:00
|
|
|
else
|
|
|
|
operationdetail .get_last_child() .set_status( STATUS_ERROR ) ;
|
2006-01-20 12:45:55 -07:00
|
|
|
|
2004-12-20 12:09:48 -07:00
|
|
|
return return_value ;
|
2004-12-13 14:24:12 -07:00
|
|
|
}
|
|
|
|
|
2006-08-20 03:33:54 -06:00
|
|
|
bool xfs::check_repair( const Partition & partition, OperationDetail & operationdetail )
|
2004-12-13 14:24:12 -07:00
|
|
|
{
|
2006-08-20 03:33:54 -06:00
|
|
|
return ! execute_command( "xfs_repair -v " + partition .get_path(), operationdetail ) ;
|
2004-12-13 14:24:12 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
} //GParted
|
|
|
|
|
|
|
|
|