Md.h

Go to the documentation of this file.
00001 #ifndef MD_H
00002 #define MD_H
00003 
00004 #include "y2storage/StorageInterface.h"
00005 #include "y2storage/Volume.h"
00006 
00007 namespace storage
00008 {
00009 
00010 class MdCo;
00011 
00012 class Md : public Volume
00013     {
00014     public:
00015         Md( const MdCo& d, unsigned Pnr, storage::MdType Type, 
00016             const std::list<string>& devs );
00017         Md( const MdCo& d, const string& line, const string& line2 );
00018         Md( const MdCo& d, const Md& m );
00019 
00020         virtual ~Md();
00021         storage::MdType personality() const { return md_type; }
00022         void setPersonality( storage::MdType val ); 
00023         storage::MdParity parity() const { return md_parity; }
00024         void setParity( storage::MdParity val ) { md_parity=val; }
00025         unsigned long chunkSize() const { return chunk; }
00026         void setChunkSize( unsigned long val ) { chunk=val; }
00027         void setMdUuid( const string&val ) { md_uuid=val; }
00028         bool destroySb() const { return( destrSb ); }
00029         void setDestroySb( bool val=true ) { destrSb=val; }
00030         const string& getMdUuid() const { return(md_uuid); }
00031         const string& pName() const { return md_names[md_type]; }
00032         const string& ptName() const { return par_names[md_parity]; }
00033         void getDevs( std::list<string>& devices, bool all=true, bool spare=false ) const; 
00034         void addSpareDevice( const string& dev );
00035         int checkDevices();
00036         int addDevice( const string& dev, bool spare=false );
00037         int removeDevice( const string& dev );
00038         void raidtabLines( std::list<string>& ) const ; 
00039         string mdadmLine() const; 
00040         string createCmd() const;
00041         static bool matchRegex( const string& dev );
00042         static unsigned mdMajor();
00043 
00044         static const string& pName( storage::MdType t ) { return md_names[t]; }
00045         static bool mdStringNum( const string& name, unsigned& num ); 
00046         friend std::ostream& operator<< (std::ostream& s, const Md& m );
00047         virtual void print( std::ostream& s ) const { s << *this; }
00048         string removeText( bool doing ) const;
00049         string createText( bool doing ) const;
00050         string formatText( bool doing ) const;
00051         static bool notDeleted( const Md& l ) { return( !l.deleted() ); }
00052 
00053         void getInfo( storage::MdInfo& info ) const;
00054         bool equalContent( const Md& rhs ) const;
00055         void logDifference( const Md& d ) const;
00056 
00057     protected:
00058         void init();
00059         void computeSize();
00060         Md& operator=( const Md& );
00061 
00062         static void getMdMajor();
00063         static storage::MdType toMdType( const string& val );
00064         static storage::MdParity toMdParity( const string& val );
00065 
00066         storage::MdType md_type;
00067         storage::MdParity md_parity;
00068         unsigned long chunk;
00069         string md_uuid;
00070         bool destrSb;
00071         std::list<string> devs;
00072         std::list<string> spare;
00073         static string md_names[storage::MULTIPATH+1];
00074         static string par_names[storage::RIGHT_SYMMETRIC+1];
00075         static unsigned md_major;
00076         mutable storage::MdInfo info;
00077     };
00078 
00079 }
00080 
00081 #endif

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