00001 #ifndef DM_H 00002 #define DM_H 00003 00004 #include <map> 00005 00006 #include "y2storage/Volume.h" 00007 00008 namespace storage 00009 { 00010 00011 class PeContainer; 00012 00013 class Dm : public Volume 00014 { 00015 public: 00016 Dm( const PeContainer& d, const string& tn ); 00017 Dm( const PeContainer& d, const string& tn, unsigned mnum ); 00018 Dm( const PeContainer& d, const Dm& d ); 00019 Dm& operator=( const Dm& ); 00020 00021 virtual ~Dm(); 00022 const string& getTableName() const { return( tname ); } 00023 const string& getTargetName() const { return( target ); } 00024 void setTableName( const string& name ) { tname=name; } 00025 bool inactive() const { return( inactiv ); } 00026 unsigned long long getLe() const { return num_le; } 00027 void setLe( unsigned long long le ); 00028 void modifyPeSize( unsigned long long old, unsigned long long neww ); 00029 bool removeTable(); 00030 void calcSize(); 00031 const std::map<string,unsigned long>& getPeMap() const { return( pe_map ); } 00032 void setPeMap( const std::map<string,unsigned long>& m ) { pe_map = m; } 00033 unsigned long long usingPe( const string& dev ) const; 00034 bool mapsTo( const string& dev ) const; 00035 void getTableInfo(); 00036 virtual bool checkConsistency() const; 00037 unsigned stripes() const { return stripe; } 00038 unsigned long long stripeSize() const { return stripe_size; } 00039 void setStripeSize( unsigned long long val ) { stripe_size=val; } 00040 string sysfsPath() const; 00041 void updateMajorMinor(); 00042 00043 friend std::ostream& operator<< (std::ostream& s, const Dm &p ); 00044 virtual void print( std::ostream& s ) const { s << *this; } 00045 virtual string removeText( bool doing ) const; 00046 virtual string formatText( bool doing ) const; 00047 void getInfo( storage::DmInfo& info ) const; 00048 00049 static bool notDeleted( const Dm& l ) { return( !l.deleted() ); } 00050 00051 static void activate( bool val=true ); 00052 static string devToTable( const string& dev ); 00053 bool equalContent( const Dm& rhs ) const; 00054 void logDifference( const Dm& d ) const; 00055 string stringDifference( const Dm& d ) const; 00056 static unsigned dmMajor(); 00057 00058 protected: 00059 void init(); 00060 const PeContainer* const pec() const; 00061 virtual const string shortPrintedName() const { return( "Dm" ); } 00062 string getDevice( const string& majmin ); 00063 static void getDmMajor(); 00064 00065 string tname; 00066 string target; 00067 unsigned long long num_le; 00068 unsigned stripe; 00069 unsigned long long stripe_size; 00070 bool inactiv; 00071 std::map<string,unsigned long> pe_map; 00072 static bool active; 00073 static unsigned dm_major; 00074 mutable storage::DmInfo info; 00075 }; 00076 00077 } 00078 00079 #endif