/* 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 . */ /* SWRaid_Info * * Cache of information about RAID array members recognised by mdadm so * the command only needs to be executed once per refresh. This will * include Linux Software RAID arrays and also IMSM and DDF type * Firmware / BIOS / ATARAID arrays whether or not the distribution uses * dmraid or mdadm to manage them. * * Note that ATARAID array members will only report as active in this * module if they were started using mdadm and appear in /proc/mdstat. */ #ifndef GPARTED_SWRAID_INFO_H #define GPARTED_SWRAID_INFO_H #include "BlockSpecial.h" #include "Utils.h" #include #include namespace GParted { struct SWRaid_Member { BlockSpecial member; FSType fstype; Glib::ustring array; Glib::ustring uuid; Glib::ustring label; bool active; }; class SWRaid_Info { public: static void load_cache(); static bool is_member( const Glib::ustring & member_path ); static bool is_member_active( const Glib::ustring & member_path ); static Glib::ustring get_array( const Glib::ustring & member_path ); static Glib::ustring get_uuid( const Glib::ustring & member_path ); static Glib::ustring get_label( const Glib::ustring & member_path ); private: static void initialise_if_required(); static void set_command_found(); static void load_swraid_info_cache(); static SWRaid_Member & get_cache_entry_by_member( const Glib::ustring & member_path ); static Glib::ustring mdadm_to_canonical_uuid( const Glib::ustring & mdadm_uuid ); static bool cache_initialised; static bool mdadm_found; static std::vector swraid_info_cache; }; }//GParted #endif /* GPARTED_SWRAID_INFO_H */