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), 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
00051 list<string> devices;
00052 list<string> spares;
00053
00054 bool is_container;
00055
00056 bool has_container;
00057 string container_name;
00058 string container_member;
00059 };
00060
00061 friend std::ostream& operator<<(std::ostream& s, const Entry& entry);
00062
00063 list<string> getEntries() const;
00064
00065 bool getEntry(const string& name, Entry& entry) const;
00066
00067 typedef map<string, Entry>::const_iterator const_iterator;
00068
00069 const_iterator begin() const { return data.begin(); }
00070 const_iterator end() const { return data.end(); }
00071
00072 private:
00073
00074 Entry parse(const string& line1, const string& line2);
00075
00076 map<string, Entry> data;
00077
00078 };
00079
00080
00081 struct MdadmDetails
00082 {
00083 string uuid;
00084 string devname;
00085 string metadata;
00086 };
00087
00088 bool getMdadmDetails(const string& dev, MdadmDetails& details);
00089
00090
00091 bool isImsmPlatform();
00092
00093 }
00094
00095
00096 #endif