00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef PROC_MDSTAT_H
00024 #define PROC_MDSTAT_H
00025
00026
00027 namespace storage
00028 {
00029
00030 class ProcMdstat
00031 {
00032 public:
00033
00034 ProcMdstat();
00035
00036 struct Entry
00037 {
00038 Entry() : md_type(RAID_UNK), md_parity(PAR_DEFAULT), size_k(0), chunk_k(0),
00039 readonly(false), inactive(false), is_container(false), has_container(false) {}
00040
00041 MdType md_type;
00042 MdParity md_parity;
00043
00044 string super;
00045
00046 unsigned long long size_k;
00047 unsigned long chunk_k;
00048
00049 bool readonly;
00050 bool inactive;
00051
00052 list<string> devices;
00053 list<string> spares;
00054
00055 bool is_container;
00056
00057 bool has_container;
00058 string container_name;
00059 string container_member;
00060 };
00061
00062 friend std::ostream& operator<<(std::ostream& s, const Entry& entry);
00063
00064 list<string> getEntries() const;
00065
00066 bool getEntry(const string& name, Entry& entry) const;
00067
00068 typedef map<string, Entry>::const_iterator const_iterator;
00069
00070 const_iterator begin() const { return data.begin(); }
00071 const_iterator end() const { return data.end(); }
00072
00073 private:
00074
00075 Entry parse(const string& line1, const string& line2);
00076
00077 map<string, Entry> data;
00078
00079 };
00080
00081
00082 struct MdadmDetails
00083 {
00084 string uuid;
00085 string devname;
00086 string metadata;
00087 };
00088
00089 bool getMdadmDetails(const string& dev, MdadmDetails& details);
00090
00091
00092 bool isImsmPlatform();
00093
00094 }
00095
00096
00097 #endif