EtcRaidtab.h

Go to the documentation of this file.
00001 #ifndef ETC_RAIDTAB_H
00002 #define ETC_RAIDTAB_H
00003 
00004 #include <string>
00005 #include <map>
00006 
00007 namespace storage
00008 {
00009 
00010 class AsciiFile;
00011 
00012 class EtcRaidtab
00013     {
00014     public:
00015         EtcRaidtab( const string& prefix="" );
00016         ~EtcRaidtab();
00017         void updateEntry( unsigned num, const std::list<string>& entries,
00018                           const string&, const std::list<string>& devs );
00019         void removeEntry( unsigned num );
00020     protected:
00021         struct entry
00022             {
00023             entry() { first=last=0; }
00024             entry( unsigned f, unsigned l ) { first=f; last=l; }
00025             unsigned first;
00026             unsigned last;
00027             friend std::ostream& operator<< (std::ostream& s, const entry &v );
00028             };
00029         friend std::ostream& operator<< (std::ostream& s, const entry &v );
00030 
00031         void updateMdadmFile();
00032         void updateRaidtabFile();
00033         void buildRaidtabMap();
00034         void buildMdadmMap();
00035 
00036         Regex *whitespace;
00037         Regex *comment;
00038         string rtabname;
00039         string mdadmname;
00040         int mdadm_dev_line;
00041         std::map<unsigned,entry> mtab;
00042         std::map<unsigned,entry> rtab;
00043         AsciiFile* raidtab;
00044         AsciiFile* mdadm;
00045     };
00047 
00048 inline std::ostream& operator<< (std::ostream& s, const EtcRaidtab::entry& v )
00049     {
00050     s << "first=" << v.first << " last=" << v.last;
00051     return( s );
00052     }
00053 
00054 }
00055 
00056 #endif

Generated on Thu Jul 6 00:40:24 2006 for yast2-storage by  doxygen 1.4.6