00001 #ifndef LOOP_H 00002 #define LOOP_H 00003 00004 #include "y2storage/Volume.h" 00005 00006 namespace storage 00007 { 00008 class LoopCo; 00009 class ProcPart; 00010 00011 class Loop : public Volume 00012 { 00013 public: 00014 Loop( const LoopCo& d, const string& LoopDev, const string& LoopFile, 00015 ProcPart& ppart ); 00016 Loop( const LoopCo& d, const string& file, bool reuseExisting, 00017 unsigned long long sizeK ); 00018 Loop( const LoopCo& d, const Loop& d ); 00019 virtual ~Loop(); 00020 const string& loopFile() const { return lfile; } 00021 void setLoopFile( const string& file ); 00022 bool getReuse() { return( reuseFile ); } 00023 void setReuse( bool reuseExisting ); 00024 void setDelFile( bool val=true ) { delFile=val; } 00025 bool removeFile(); 00026 bool createFile(); 00027 string lfileRealPath() const; 00028 friend std::ostream& operator<< (std::ostream& s, const Loop& l ); 00029 00030 virtual void print( std::ostream& s ) const { s << *this; } 00031 string removeText( bool doing ) const; 00032 string createText( bool doing ) const; 00033 string formatText( bool doing ) const; 00034 00035 void getInfo( storage::LoopInfo& info ) const; 00036 bool equalContent( const Loop& rhs ) const; 00037 void logDifference( const Loop& d ) const; 00038 00039 static bool notDeleted( const Loop& l ) { return( !l.deleted() ); } 00040 00041 protected: 00042 void init(); 00043 void checkReuse(); 00044 Loop& operator=( const Loop& ); 00045 00046 string lfile; 00047 bool reuseFile; 00048 bool delFile; 00049 mutable storage::LoopInfo info; 00050 }; 00051 00052 } 00053 00054 #endif