2015-10-20 13:52:19 -06:00
|
|
|
/* Copyright (C) 2015 Mike Fleetwood
|
|
|
|
*
|
|
|
|
* 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 General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/* SWRaid_Info
|
|
|
|
*
|
|
|
|
* Cache of information about Linux Software RAID arrays so that the
|
|
|
|
* mdadm command only needs to be executed once per refresh.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef GPARTED_SWRAID_INFO_H
|
|
|
|
#define GPARTED_SWRAID_INFO_H
|
|
|
|
|
2016-07-04 11:40:38 -06:00
|
|
|
#include "../include/BlockSpecial.h"
|
|
|
|
|
2015-10-20 13:52:19 -06:00
|
|
|
#include <glibmm/ustring.h>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
namespace GParted
|
|
|
|
{
|
|
|
|
|
2015-10-21 06:54:58 -06:00
|
|
|
struct SWRaid_Member
|
|
|
|
{
|
2016-07-04 11:40:38 -06:00
|
|
|
BlockSpecial member;
|
2015-10-22 05:37:57 -06:00
|
|
|
Glib::ustring array;
|
2015-10-23 14:23:29 -06:00
|
|
|
Glib::ustring uuid;
|
|
|
|
Glib::ustring label;
|
2015-10-21 06:54:58 -06:00
|
|
|
bool active;
|
|
|
|
};
|
|
|
|
|
2015-10-20 13:52:19 -06:00
|
|
|
class SWRaid_Info
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
static void load_cache();
|
|
|
|
static bool is_member( const Glib::ustring & member_path );
|
2015-10-21 06:54:58 -06:00
|
|
|
static bool is_member_active( const Glib::ustring & member_path );
|
2015-10-22 05:37:57 -06:00
|
|
|
static Glib::ustring get_array( const Glib::ustring & member_path );
|
2015-10-23 14:23:29 -06:00
|
|
|
static Glib::ustring get_uuid( const Glib::ustring & member_path );
|
|
|
|
static Glib::ustring get_label( const Glib::ustring & member_path );
|
2015-10-20 13:52:19 -06:00
|
|
|
|
|
|
|
private:
|
2015-10-23 00:34:13 -06:00
|
|
|
static void initialise_if_required();
|
2015-10-20 13:52:19 -06:00
|
|
|
static void set_command_found();
|
|
|
|
static void load_swraid_info_cache();
|
2015-10-21 06:54:58 -06:00
|
|
|
static SWRaid_Member & get_cache_entry_by_member( const Glib::ustring & member_path );
|
2015-10-23 14:23:29 -06:00
|
|
|
static Glib::ustring mdadm_to_canonical_uuid( const Glib::ustring & mdadm_uuid );
|
2015-10-20 13:52:19 -06:00
|
|
|
|
2015-10-23 00:34:13 -06:00
|
|
|
static bool cache_initialised;
|
2015-10-20 13:52:19 -06:00
|
|
|
static bool mdadm_found;
|
2015-10-21 06:54:58 -06:00
|
|
|
static std::vector<SWRaid_Member> swraid_info_cache;
|
2015-10-20 13:52:19 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
}//GParted
|
|
|
|
|
|
|
|
#endif /* GPARTED_SWRAID_INFO_H */
|