[yast-commit] r56497 - /trunk/storage/libstorage/src/
Author: aschnell Date: Tue Mar 31 15:11:54 2009 New Revision: 56497 URL: http://svn.opensuse.org/viewcvs/yast?rev=56497&view=rev Log: - added some const - some cleanup Modified: trunk/storage/libstorage/src/Container.h trunk/storage/libstorage/src/Disk.cc trunk/storage/libstorage/src/Disk.h trunk/storage/libstorage/src/DmCo.cc trunk/storage/libstorage/src/DmCo.h trunk/storage/libstorage/src/DmPartCo.cc trunk/storage/libstorage/src/DmPartCo.h trunk/storage/libstorage/src/DmmultipathCo.cc trunk/storage/libstorage/src/DmmultipathCo.h trunk/storage/libstorage/src/DmraidCo.cc trunk/storage/libstorage/src/DmraidCo.h trunk/storage/libstorage/src/LoopCo.cc trunk/storage/libstorage/src/LoopCo.h trunk/storage/libstorage/src/LvmVg.cc trunk/storage/libstorage/src/LvmVg.h trunk/storage/libstorage/src/MdCo.cc trunk/storage/libstorage/src/MdCo.h trunk/storage/libstorage/src/NfsCo.cc trunk/storage/libstorage/src/NfsCo.h trunk/storage/libstorage/src/Storage.cc trunk/storage/libstorage/src/Storage.h Modified: trunk/storage/libstorage/src/Container.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/Container.h?rev=56497&r1=56496&r2=56497&view=diff ============================================================================== --- trunk/storage/libstorage/src/Container.h (original) +++ trunk/storage/libstorage/src/Container.h Tue Mar 31 15:11:54 2009 @@ -180,7 +180,7 @@ virtual int doCreate( Volume * v ); virtual int doRemove( Volume * v ); virtual int doResize( Volume * v ); - virtual void logData( const string& Dir ) {} + virtual void logData(const string& Dir) const {} Container& operator=( const Container& ); static bool stageDecrease( const Volume& v ) { return( v.deleted()||v.needShrink()); } Modified: trunk/storage/libstorage/src/Disk.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/Disk.cc?rev=56497&r1=56496&r2=56497&view=diff ============================================================================== --- trunk/storage/libstorage/src/Disk.cc (original) +++ trunk/storage/libstorage/src/Disk.cc Tue Mar 31 15:11:54 2009 @@ -431,8 +431,9 @@ return( ret ); } + void -Disk::logData( const string& Dir ) +Disk::logData(const string& Dir) const { string fname( Dir + "/disk_" + logfile_name + ".tmp" ); ofstream file( fname.c_str() ); @@ -463,8 +464,8 @@ } file << "SizeK: " << size_k << endl; - PartPair pp = partPair(); - for( PartIter p=pp.begin(); p!=pp.end(); ++p ) + ConstPartPair pp = partPair(); + for (ConstPartIter p = pp.begin(); p != pp.end(); ++p) { file << "Partition: "; p->logData(file); @@ -474,6 +475,7 @@ getStorage()->handleLogFile( fname ); } + void Disk::setLabelData( const string& disklabel ) { Modified: trunk/storage/libstorage/src/Disk.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/Disk.h?rev=56497&r1=56496&r2=56497&view=diff ============================================================================== --- trunk/storage/libstorage/src/Disk.h (original) +++ trunk/storage/libstorage/src/Disk.h Tue Mar 31 15:11:54 2009 @@ -201,7 +201,7 @@ virtual int doSetType( Volume* v ); virtual int doCreateLabel(); - void logData( const string& Dir ); + void logData(const string& Dir) const; void setLabelData( const string& ); static string defaultLabel( const Storage&, unsigned long long size_k ); Modified: trunk/storage/libstorage/src/DmCo.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/DmCo.cc?rev=56497&r1=56496&r2=56497&view=diff ============================================================================== --- trunk/storage/libstorage/src/DmCo.cc (original) +++ trunk/storage/libstorage/src/DmCo.cc Tue Mar 31 15:11:54 2009 @@ -436,6 +436,10 @@ } -void DmCo::logData( const string& Dir ) {;} +void +DmCo::logData(const string& Dir) const +{ +} + } Modified: trunk/storage/libstorage/src/DmCo.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/DmCo.h?rev=56497&r1=56496&r2=56497&view=diff ============================================================================== --- trunk/storage/libstorage/src/DmCo.h (original) +++ trunk/storage/libstorage/src/DmCo.h Tue Mar 31 15:11:54 2009 @@ -46,7 +46,7 @@ int doRemove( Volume* v ); - void logData( const string& Dir ); + void logData(const string& Dir) const; }; } Modified: trunk/storage/libstorage/src/DmPartCo.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/DmPartCo.cc?rev=56497&r1=56496&r2=56497&view=diff ============================================================================== --- trunk/storage/libstorage/src/DmPartCo.cc (original) +++ trunk/storage/libstorage/src/DmPartCo.cc Tue Mar 31 15:11:54 2009 @@ -1079,6 +1079,9 @@ updatePointers(true); } -void DmPartCo::logData( const string& Dir ) {;} +void +DmPartCo::logData(const string& Dir) const +{ +} } Modified: trunk/storage/libstorage/src/DmPartCo.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/DmPartCo.h?rev=56497&r1=56496&r2=56497&view=diff ============================================================================== --- trunk/storage/libstorage/src/DmPartCo.h (original) +++ trunk/storage/libstorage/src/DmPartCo.h Tue Mar 31 15:11:54 2009 @@ -168,7 +168,7 @@ virtual string removeText( bool doing ) const; virtual string setDiskLabelText( bool doing ) const; - void logData( const string& Dir ); + void logData(const string& Dir) const; string udev_path; std::list<string> udev_id; string logfile_name; Modified: trunk/storage/libstorage/src/DmmultipathCo.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/DmmultipathCo.cc?rev=56497&r1=56496&r2=56497&view=diff ============================================================================== --- trunk/storage/libstorage/src/DmmultipathCo.cc (original) +++ trunk/storage/libstorage/src/DmmultipathCo.cc Tue Mar 31 15:11:54 2009 @@ -285,7 +285,12 @@ model = rhs.model; } -void DmmultipathCo::logData( const string& Dir ) {} + +void +DmmultipathCo::logData(const string& Dir) const +{ +} + bool DmmultipathCo::active = false; Modified: trunk/storage/libstorage/src/DmmultipathCo.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/DmmultipathCo.h?rev=56497&r1=56496&r2=56497&view=diff ============================================================================== --- trunk/storage/libstorage/src/DmmultipathCo.h (original) +++ trunk/storage/libstorage/src/DmmultipathCo.h Tue Mar 31 15:11:54 2009 @@ -101,7 +101,7 @@ static void getMultipaths( std::list<string>& l ); static bool multipathNotDeleted( const Dmmultipath&d ) { return( !d.deleted() ); } - void logData( const string& Dir ); + void logData(const string& Dir) const; string vendor; string model; Modified: trunk/storage/libstorage/src/DmraidCo.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/DmraidCo.cc?rev=56497&r1=56496&r2=56497&view=diff ============================================================================== --- trunk/storage/libstorage/src/DmraidCo.cc (original) +++ trunk/storage/libstorage/src/DmraidCo.cc Tue Mar 31 15:11:54 2009 @@ -272,7 +272,12 @@ controller = rhs.controller; } -void DmraidCo::logData( const string& Dir ) {;} + +void +DmraidCo::logData(const string& Dir) const +{ +} + bool DmraidCo::active = false; Modified: trunk/storage/libstorage/src/DmraidCo.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/DmraidCo.h?rev=56497&r1=56496&r2=56497&view=diff ============================================================================== --- trunk/storage/libstorage/src/DmraidCo.h (original) +++ trunk/storage/libstorage/src/DmraidCo.h Tue Mar 31 15:11:54 2009 @@ -102,7 +102,7 @@ int doRemove(); - void logData( const string& Dir ); + void logData(const string& Dir) const; string raidtype; string controller; Modified: trunk/storage/libstorage/src/LoopCo.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/LoopCo.cc?rev=56497&r1=56496&r2=56497&view=diff ============================================================================== --- trunk/storage/libstorage/src/LoopCo.cc (original) +++ trunk/storage/libstorage/src/LoopCo.cc Tue Mar 31 15:11:54 2009 @@ -339,7 +339,11 @@ return( ret ); } -void LoopCo::logData( const string& Dir ) {;} + +void +LoopCo::logData(const string& Dir) const +{ +} inline std::ostream& operator<< (std::ostream& s, const LoopCo& d ) Modified: trunk/storage/libstorage/src/LoopCo.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/LoopCo.h?rev=56497&r1=56496&r2=56497&view=diff ============================================================================== --- trunk/storage/libstorage/src/LoopCo.h (original) +++ trunk/storage/libstorage/src/LoopCo.h Tue Mar 31 15:11:54 2009 @@ -99,7 +99,7 @@ int doCreate( Volume* v ); int doRemove( Volume* v ); - void logData( const string& Dir ); + void logData(const string& Dir) const; }; } Modified: trunk/storage/libstorage/src/LvmVg.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/LvmVg.cc?rev=56497&r1=56496&r2=56497&view=diff ============================================================================== --- trunk/storage/libstorage/src/LvmVg.cc (original) +++ trunk/storage/libstorage/src/LvmVg.cc Tue Mar 31 15:11:54 2009 @@ -1705,7 +1705,12 @@ } } -void LvmVg::logData( const string& Dir ) {;} + +void +LvmVg::logData(const string& Dir) const +{ +} + bool LvmVg::active = false; Modified: trunk/storage/libstorage/src/LvmVg.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/LvmVg.h?rev=56497&r1=56496&r2=56497&view=diff ============================================================================== --- trunk/storage/libstorage/src/LvmVg.h (original) +++ trunk/storage/libstorage/src/LvmVg.h Tue Mar 31 15:11:54 2009 @@ -133,7 +133,8 @@ string metaString(); string instSysString(); - void logData( const string& Dir ); + void logData(const string& Dir) const; + void addLv(unsigned long& le, string& name, string& origin, string& uuid, string& status, string& alloc, bool& ro); void addPv( Pv*& p ); Modified: trunk/storage/libstorage/src/MdCo.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/MdCo.cc?rev=56497&r1=56496&r2=56497&view=diff ============================================================================== --- trunk/storage/libstorage/src/MdCo.cc (original) +++ trunk/storage/libstorage/src/MdCo.cc Tue Mar 31 15:11:54 2009 @@ -785,7 +785,11 @@ } -void MdCo::logData( const string& Dir ) {;} +void +MdCo::logData(const string& Dir) const +{ +} + bool MdCo::active = false; Modified: trunk/storage/libstorage/src/MdCo.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/MdCo.h?rev=56497&r1=56496&r2=56497&view=diff ============================================================================== --- trunk/storage/libstorage/src/MdCo.h (original) +++ trunk/storage/libstorage/src/MdCo.h Tue Mar 31 15:11:54 2009 @@ -112,7 +112,7 @@ int doCreate( Volume* v ); int doRemove( Volume* v ); - void logData( const string& Dir ); + void logData(const string& Dir) const; EtcRaidtab *tab; Modified: trunk/storage/libstorage/src/NfsCo.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/NfsCo.cc?rev=56497&r1=56496&r2=56497&view=diff ============================================================================== --- trunk/storage/libstorage/src/NfsCo.cc (original) +++ trunk/storage/libstorage/src/NfsCo.cc Tue Mar 31 15:11:54 2009 @@ -208,7 +208,10 @@ } -void NfsCo::logData( const string& Dir ) {;} +void +NfsCo::logData(const string& Dir) const +{ +} inline std::ostream& operator<< (std::ostream& s, const NfsCo& d ) Modified: trunk/storage/libstorage/src/NfsCo.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/NfsCo.h?rev=56497&r1=56496&r2=56497&view=diff ============================================================================== --- trunk/storage/libstorage/src/NfsCo.h (original) +++ trunk/storage/libstorage/src/NfsCo.h Tue Mar 31 15:11:54 2009 @@ -87,7 +87,7 @@ virtual void print( std::ostream& s ) const { s << *this; } virtual Container* getCopy() const { return( new NfsCo( *this ) ); } - void logData( const string& Dir ); + void logData(const string& Dir) const; }; } Modified: trunk/storage/libstorage/src/Storage.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/Storage.cc?rev=56497&r1=56496&r2=56497&view=diff ============================================================================== --- trunk/storage/libstorage/src/Storage.cc (original) +++ trunk/storage/libstorage/src/Storage.cc Tue Mar 31 15:11:54 2009 @@ -255,18 +255,14 @@ void Storage::deleteClist( CCont& co ) { for( CIter i=co.begin(); i!=co.end(); ++i ) - delete( *i ); + delete *i; co.clear(); } void Storage::deleteBackups() { - map<string,CCont>::iterator i = backups.begin(); - while( i!=backups.end() ) - { + for (map<string, CCont>::iterator i = backups.begin(); i != backups.end(); ++i) deleteClist( i->second ); - ++i; - } backups.clear(); } @@ -275,7 +271,7 @@ if( max_log_num>0 ) { logVolumes( logdir ); - for( CIter i=cont.begin(); i!=cont.end(); ++i ) + for (CCIter i = cont.begin(); i != cont.end(); ++i) { (*i)->logData( logdir ); } @@ -824,12 +820,13 @@ void -Storage::logVolumes( const string& Dir ) +Storage::logVolumes(const string& Dir) const { string fname( Dir + "/volume_info.tmp" ); ofstream file( fname.c_str() ); classic(file); - for( VolIterator i=vBegin(); i!=vEnd(); ++i ) + ConstVolPair p = volPair(); + for (ConstVolIterator i = p.begin(); i != p.end(); ++i) { if( i->getFs()!=FSUNKNOWN ) { @@ -5527,14 +5524,10 @@ y2mil("name:" << name); if( ret==0 ) { - if(checkBackupState(name)) - removeBackupState( name ); - CCIter i=cont.begin(); - while( i!=cont.end() ) - { + if (checkBackupState(name)) + removeBackupState(name); + for (CCIter i = cont.begin(); i != cont.end(); ++i) backups[name].push_back( (*i)->getCopy() ); - ++i; - } } y2mil( "states:" << backupStates() ); y2mil("ret:" << ret); @@ -5582,12 +5575,8 @@ if( b!=backups.end()) { cont.clear(); - CCIter i=b->second.begin(); - while( i!=b->second.end() ) - { + for (CCIter i = b->second.begin(); i != b->second.end(); ++i) cont.push_back( (*i)->getCopy() ); - ++i; - } } else ret = STORAGE_BACKUP_STATE_NOT_FOUND; Modified: trunk/storage/libstorage/src/Storage.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/Storage.h?rev=56497&r1=56496&r2=56497&view=diff ============================================================================== --- trunk/storage/libstorage/src/Storage.h (original) +++ trunk/storage/libstorage/src/Storage.h Tue Mar 31 15:11:54 2009 @@ -1686,7 +1686,7 @@ bool haveNfs( NfsCo*& co ); bool haveLoop( LoopCo*& loop ); int removeContainer( Container* val, bool call_del=true ); - void logVolumes( const string& Dir ); + void logVolumes(const string& Dir) const; int commitPair( CPair& p, bool (* fnc)( const Container& ) ); void sortCommitLists( storage::CommitStage stage, std::list<const Container*>& co, -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
aschnell@svn.opensuse.org