2011-02-22 14:40:02 -07:00
|
|
|
/* Copyright (C) 2009, 2010, 2011 Curtis Gedak
|
2009-03-14 14:02:41 -06: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
|
2014-01-23 03:59:48 -07:00
|
|
|
* GNU General Public License for more details.
|
2009-03-14 14:02:41 -06:00
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2014-01-23 03:59:48 -07:00
|
|
|
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
2009-03-14 14:02:41 -06:00
|
|
|
*/
|
|
|
|
|
|
|
|
/* READ THIS!
|
|
|
|
* This class was created in an effort to reduce the complexity of the
|
|
|
|
* GParted_Core class.
|
|
|
|
* This class provides support for motherboard based RAID devices, also know
|
|
|
|
* as Fake RAID.
|
|
|
|
* Static elements are used in order to reduce the disk accesses required to
|
|
|
|
* load the data structures upon each initialization of the class.
|
|
|
|
*/
|
|
|
|
|
2013-05-27 05:20:16 -06:00
|
|
|
#ifndef GPARTED_DMRAID_H
|
|
|
|
#define GPARTED_DMRAID_H
|
2009-03-14 14:02:41 -06:00
|
|
|
|
2016-10-18 16:45:28 -06:00
|
|
|
#include "Utils.h"
|
2019-11-24 06:15:22 -07:00
|
|
|
#include "BlockSpecial.h"
|
2016-10-18 16:45:28 -06:00
|
|
|
#include "Partition.h"
|
|
|
|
#include "OperationDetail.h"
|
2009-03-14 14:02:41 -06:00
|
|
|
|
2019-11-24 06:15:22 -07:00
|
|
|
#include <glibmm/ustring.h>
|
2009-03-14 14:02:41 -06:00
|
|
|
#include <vector>
|
|
|
|
|
2019-11-24 06:15:22 -07:00
|
|
|
|
2009-03-14 14:02:41 -06:00
|
|
|
namespace GParted
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
class DMRaid
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
DMRaid() ;
|
|
|
|
DMRaid( const bool & do_refresh ) ;
|
|
|
|
~DMRaid() ;
|
|
|
|
bool is_dmraid_supported() ;
|
|
|
|
bool is_dmraid_device( const Glib::ustring & dev_path ) ;
|
2009-03-16 16:59:50 -06:00
|
|
|
int execute_command( const Glib::ustring & command, OperationDetail & operationdetail ) ;
|
2009-03-14 14:02:41 -06:00
|
|
|
void get_devices( std::vector<Glib::ustring> & dmraid_devices ) ;
|
|
|
|
Glib::ustring get_dmraid_name( const Glib::ustring & dev_path ) ;
|
2009-03-16 16:59:50 -06:00
|
|
|
int get_partition_number( const Glib::ustring & partition_name ) ;
|
2010-08-25 10:33:02 -06:00
|
|
|
Glib::ustring get_udev_dm_name( const Glib::ustring & dev_path ) ;
|
2010-08-17 09:27:44 -06:00
|
|
|
Glib::ustring make_path_dmraid_compatible( Glib::ustring partition_path ) ;
|
2009-03-14 14:02:41 -06:00
|
|
|
bool create_dev_map_entries( const Partition & partition, OperationDetail & operationdetail ) ;
|
|
|
|
bool create_dev_map_entries( const Glib::ustring & dev_path ) ;
|
|
|
|
bool delete_affected_dev_map_entries( const Partition & partition, OperationDetail & operationdetail ) ;
|
|
|
|
bool delete_dev_map_entry( const Partition & partition, OperationDetail & operationdetail ) ;
|
|
|
|
bool purge_dev_map_entries( const Glib::ustring & dev_path ) ;
|
|
|
|
bool update_dev_map_entry( const Partition & partition, OperationDetail & operationdetail ) ;
|
2019-11-24 06:15:22 -07:00
|
|
|
bool is_member_active(const Glib::ustring& member_path);
|
|
|
|
|
2009-03-14 14:02:41 -06:00
|
|
|
private:
|
|
|
|
void load_dmraid_cache() ;
|
|
|
|
void set_commands_found() ;
|
|
|
|
void get_dmraid_dir_entries( const Glib::ustring & dev_path, std::vector<Glib::ustring> & dir_list ) ;
|
|
|
|
void get_affected_dev_map_entries( const Partition & partition, std::vector<Glib::ustring> & affected_entries ) ;
|
2009-03-16 16:59:50 -06:00
|
|
|
void get_partition_dev_map_entries( const Partition & partition, std::vector<Glib::ustring> & partition_entries ) ;
|
2019-11-24 06:15:22 -07:00
|
|
|
static std::vector<Glib::ustring> lookup_dmraid_members(const Glib::ustring& array);
|
|
|
|
|
2009-03-14 14:02:41 -06:00
|
|
|
static bool dmraid_cache_initialized ;
|
|
|
|
static bool dmraid_found ;
|
|
|
|
static bool dmsetup_found ;
|
2009-04-26 16:45:53 -06:00
|
|
|
static bool udevadm_found ;
|
2009-03-14 14:02:41 -06:00
|
|
|
static std::vector<Glib::ustring> dmraid_devices ;
|
2019-11-24 06:15:22 -07:00
|
|
|
static std::vector<BlockSpecial> dmraid_member_cache;
|
2009-03-14 14:02:41 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
}//GParted
|
|
|
|
|
2013-05-27 05:20:16 -06:00
|
|
|
#endif /* GPARTED_DMRAID_H */
|