1
/* Copyright (C) 2009 Luca Bruno <lucab@debian.org>
3
* This program is free software; you can redistribute it and/or modify
4
* it under the terms of the GNU General Public License as published by
5
* the Free Software Foundation; either version 2 of the License, or
6
* (at your option) any later version.
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU Library General Public License for more details.
13
* You should have received a copy of the GNU General Public License
14
* along with this program; if not, write to the Free Software
15
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19
#include "../include/btrfs.h"
24
FS btrfs::get_filesystem_support()
27
fs .filesystem = GParted::FS_BTRFS ;
29
if ( ! Glib::find_program_in_path( "btrfs-show" ) .empty() )
31
fs .read = GParted::FS::EXTERNAL ;
32
fs .read_label = FS::EXTERNAL ;
35
if ( ! Glib::find_program_in_path( "mkfs.btrfs" ) .empty() )
36
fs .create = GParted::FS::EXTERNAL ;
38
if ( ! Glib::find_program_in_path( "btrfsck" ) .empty() )
39
fs .check = GParted::FS::EXTERNAL ;
43
fs .copy = GParted::FS::GPARTED ;
44
fs .move = GParted::FS::GPARTED ;
47
fs .MIN = 256 * MEBIBYTE ;
52
bool btrfs::create( const Partition & new_partition, OperationDetail & operationdetail )
54
return (! execute_command( "mkfs.btrfs -L \"" + new_partition .label + "\" " + new_partition .get_path(), operationdetail ) );
57
bool btrfs::check_repair( const Partition & partition, OperationDetail & operationdetail )
59
return (! execute_command( "btrfsck " + partition .get_path(), operationdetail )) ;
62
void btrfs::set_used_sectors( Partition & partition )
68
bool btrfs::write_label( const Partition & partition, OperationDetail & operationdetail )
74
bool btrfs::copy( const Glib::ustring & src_part_path,
75
const Glib::ustring & dest_part_path,
76
OperationDetail & operationdetail )
82
bool btrfs::resize( const Partition & partition_new, OperationDetail & operationdetail, bool fill_partition )
88
void btrfs::read_label( Partition & partition )
90
if ( ! Utils::execute_command( "btrfs-show " + partition .get_path(), output, error, true ) )
92
partition .label = Utils::regexp_label( output, "^Label ([^\n\t]*)" ) ;
96
if ( ! output .empty() )
97
partition .messages .push_back( output ) ;
99
if ( ! error .empty() )
100
partition .messages .push_back( error ) ;