Author: aschnell
Date: Wed Mar 25 15:33:23 2009
New Revision: 56390
URL: http://svn.opensuse.org/viewcvs/yast?rev=56390&view=rev
Log:
- make getToCommit return void and added some const
Modified:
trunk/storage/libstorage/src/Container.cc
trunk/storage/libstorage/src/Container.h
trunk/storage/libstorage/src/Dasd.cc
trunk/storage/libstorage/src/Dasd.h
trunk/storage/libstorage/src/Disk.cc
trunk/storage/libstorage/src/Disk.h
trunk/storage/libstorage/src/DmPartCo.cc
trunk/storage/libstorage/src/DmPartCo.h
trunk/storage/libstorage/src/LvmVg.cc
trunk/storage/libstorage/src/LvmVg.h
trunk/storage/libstorage/src/Storage.cc
trunk/storage/libstorage/src/Storage.h
Modified: trunk/storage/libstorage/src/Container.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/Container.cc?rev=56390&r1=56389&r2=56390&view=diff
==============================================================================
--- trunk/storage/libstorage/src/Container.cc (original)
+++ trunk/storage/libstorage/src/Container.cc Wed Mar 25 15:33:23 2009
@@ -56,10 +56,10 @@
static bool stageMount( const Volume& v )
{ return( v.needRemount()||v.needFstabUpdate()); }
-int Container::getToCommit( CommitStage stage, list& col,
- list& vol )
- {
- int ret = 0;
+
+void
+Container::getToCommit(CommitStage stage, list& col, list& vol)
+{
unsigned long oco = col.size();
unsigned long ovo = vol.size();
switch( stage )
@@ -96,14 +96,11 @@
vol.push_back( &(*i) );
}
break;
- default:
- break;
}
if( col.size()!=oco || vol.size()!=ovo )
- y2mil("ret:" << ret << " stage:" << stage << " col:" << col.size() << " vol:" <<
- vol.size());
- return( ret );
- }
+ y2mil("stage:" << stage << " col:" << col.size() << " vol:" << vol.size());
+}
+
int Container::commitChanges( CommitStage stage, Volume* vol )
{
Modified: trunk/storage/libstorage/src/Container.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/Container.h?rev=56390&r1=56389&r2=56390&view=diff
==============================================================================
--- trunk/storage/libstorage/src/Container.h (original)
+++ trunk/storage/libstorage/src/Container.h Wed Mar 25 15:33:23 2009
@@ -7,8 +7,11 @@
#include "y2storage/StorageTypes.h"
#include "y2storage/StorageTmpl.h"
+
namespace storage
{
+ using std::list;
+
class Container
{
@@ -48,9 +51,8 @@
virtual void logDifference( const Container& c ) const;
virtual void getCommitActions( std::liststorage::commitAction*& l ) const;
- virtual int getToCommit( storage::CommitStage stage,
- std::list& col,
- std::list& vol );
+ virtual void getToCommit(storage::CommitStage stage, list& col,
+ list& vol);
virtual int commitChanges( storage::CommitStage stage );
virtual int commitChanges( storage::CommitStage stage, Volume* vol );
Modified: trunk/storage/libstorage/src/Dasd.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/Dasd.cc?rev=56390&r1=56389&r2=56390&view=diff
==============================================================================
--- trunk/storage/libstorage/src/Dasd.cc (original)
+++ trunk/storage/libstorage/src/Dasd.cc Wed Mar 25 15:33:23 2009
@@ -480,10 +480,10 @@
return( txt );
}
-int Dasd::getToCommit( CommitStage stage, list& col,
- list& vol )
- {
- int ret = 0;
+
+void
+Dasd::getToCommit(CommitStage stage, list& col, list& vol)
+{
unsigned long oco = col.size();
unsigned long ovo = vol.size();
if( stage==DECREASE )
@@ -501,11 +501,11 @@
vol.push_back( &(*(p.begin())) );
}
else
- ret = Disk::getToCommit( stage, col, vol );
+ Disk::getToCommit( stage, col, vol );
if( col.size()!=oco || vol.size()!=ovo )
- y2mil("ret:" << ret << " col:" << col.size() << " vol:" << vol.size());
- return( ret );
- }
+ y2mil("stage:" << stage << " col:" << col.size() << " vol:" << vol.size());
+}
+
int Dasd::commitChanges( CommitStage stage )
{
Modified: trunk/storage/libstorage/src/Dasd.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/Dasd.h?rev=56390&r1=56389&r2=56390&view=diff
==============================================================================
--- trunk/storage/libstorage/src/Dasd.h (original)
+++ trunk/storage/libstorage/src/Dasd.h Wed Mar 25 15:33:23 2009
@@ -3,8 +3,11 @@
#include "y2storage/Disk.h"
+
namespace storage
{
+ using std::list;
+
class SystemCmd;
class ProcPart;
@@ -27,8 +30,8 @@
string dasdfmtText( bool doing ) const;
static string dasdfmtTexts( bool single, const string& devs );
void getCommitActions( std::liststorage::commitAction*& l ) const;
- int getToCommit( storage::CommitStage stage, std::list& col,
- std::list& vol );
+ void getToCommit(storage::CommitStage stage, list& col,
+ list& vol);
int commitChanges( storage::CommitStage stage );
bool detectGeometry();
Modified: trunk/storage/libstorage/src/Disk.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/Disk.cc?rev=56390&r1=56389&r2=56390&view=diff
==============================================================================
--- trunk/storage/libstorage/src/Disk.cc (original)
+++ trunk/storage/libstorage/src/Disk.cc Wed Mar 25 15:33:23 2009
@@ -1754,10 +1754,10 @@
return( ret );
}
-int Disk::getToCommit( CommitStage stage, list& col,
- list& vol )
+
+void
+Disk::getToCommit(CommitStage stage, list& col, list& vol)
{
- int ret = 0;
unsigned long oco = col.size();
unsigned long ovo = vol.size();
Container::getToCommit( stage, col, vol );
@@ -1769,8 +1769,7 @@
vol.push_back( &(*i) );
}
if( col.size()!=oco || vol.size()!=ovo )
- y2mil("ret:" << ret << " col:" << col.size() << " vol:" << vol.size());
- return( ret );
+ y2mil("stage:" << stage << " col:" << col.size() << " vol:" << vol.size());
}
int Disk::commitChanges( CommitStage stage, Volume* vol )
Modified: trunk/storage/libstorage/src/Disk.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/Disk.h?rev=56390&r1=56389&r2=56390&view=diff
==============================================================================
--- trunk/storage/libstorage/src/Disk.h (original)
+++ trunk/storage/libstorage/src/Disk.h Wed Mar 25 15:33:23 2009
@@ -6,8 +6,11 @@
#include "y2storage/Container.h"
#include "y2storage/Partition.h"
+
namespace storage
{
+ using std::list;
+
class Storage;
class SystemCmd;
@@ -79,9 +82,8 @@
int destroyPartitionTable( const string& new_label );
unsigned availablePartNumber(storage::PartitionType type = storage::PRIMARY) const;
virtual void getCommitActions( std::liststorage::commitAction*& l ) const;
- virtual int getToCommit( storage::CommitStage stage,
- std::list& col,
- std::list& vol );
+ virtual void getToCommit(storage::CommitStage stage, list& col,
+ list& vol);
virtual int commitChanges( storage::CommitStage stage );
int commitChanges( storage::CommitStage stage, Volume* vol );
int freeCylindersAfterPartition(const Partition* p, unsigned long& freeCyls) const;
Modified: trunk/storage/libstorage/src/DmPartCo.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/DmPartCo.cc?rev=56390&r1=56389&r2=56390&view=diff
==============================================================================
--- trunk/storage/libstorage/src/DmPartCo.cc (original)
+++ trunk/storage/libstorage/src/DmPartCo.cc Wed Mar 25 15:33:23 2009
@@ -655,10 +655,10 @@
return( p!=NULL && !d.deleted() && Partition::toChangeId(*p) );
}
-int DmPartCo::getToCommit( CommitStage stage, list& col,
- list& vol )
- {
- int ret = 0;
+
+void
+DmPartCo::getToCommit(CommitStage stage, list& col, list& vol)
+{
y2mil("col:" << col.size() << " vol:" << vol.size());
getStorage()->logCo( this );
unsigned long oco = col.size();
@@ -674,9 +674,8 @@
if( del_ptable && find( col.begin(), col.end(), this )==col.end() )
col.push_back( this );
if( col.size()!=oco || vol.size()!=ovo )
- y2mil("ret:" << ret << " col:" << col.size() << " vol:" << vol.size());
- return( ret );
- }
+ y2mil("stage:" << stage << " col:" << col.size() << " vol:" << vol.size());
+}
int DmPartCo::commitChanges( CommitStage stage, Volume* vol )
Modified: trunk/storage/libstorage/src/DmPartCo.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/DmPartCo.h?rev=56390&r1=56389&r2=56390&view=diff
==============================================================================
--- trunk/storage/libstorage/src/DmPartCo.h (original)
+++ trunk/storage/libstorage/src/DmPartCo.h Wed Mar 25 15:33:23 2009
@@ -7,8 +7,11 @@
#include "y2storage/Disk.h"
#include "y2storage/DmPart.h"
+
namespace storage
{
+ using std::list;
+
class Storage;
class SystemCmd;
@@ -73,9 +76,8 @@
string getPartName( unsigned nr ) const;
virtual void getCommitActions( std::liststorage::commitAction*& l ) const;
- virtual int getToCommit( storage::CommitStage stage,
- std::list& col,
- std::list& vol );
+ virtual void getToCommit(storage::CommitStage stage, list& col,
+ list& vol);
virtual int commitChanges( storage::CommitStage stage );
int commitChanges( storage::CommitStage stage, Volume* vol );
Modified: trunk/storage/libstorage/src/LvmVg.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/LvmVg.cc?rev=56390&r1=56389&r2=56390&view=diff
==============================================================================
--- trunk/storage/libstorage/src/LvmVg.cc (original)
+++ trunk/storage/libstorage/src/LvmVg.cc Wed Mar 25 15:33:23 2009
@@ -902,10 +902,10 @@
p = new Pv;
}
-int LvmVg::getToCommit( CommitStage stage, list& col,
- list& vol )
- {
- int ret = 0;
+
+void
+LvmVg::getToCommit(CommitStage stage, list& col, list& vol)
+{
unsigned long oco = col.size();
unsigned long ovo = vol.size();
Container::getToCommit( stage, col, vol );
@@ -926,9 +926,9 @@
}
}
if( col.size()!=oco || vol.size()!=ovo )
- y2mil("ret:" << ret << " col:" << col.size() << " vol:" << vol.size());
- return( ret );
- }
+ y2mil("stage:" << stage << " col:" << col.size() << " vol:" << vol.size());
+}
+
int LvmVg::commitChanges( CommitStage stage )
{
Modified: trunk/storage/libstorage/src/LvmVg.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/LvmVg.h?rev=56390&r1=56389&r2=56390&view=diff
==============================================================================
--- trunk/storage/libstorage/src/LvmVg.h (original)
+++ trunk/storage/libstorage/src/LvmVg.h Wed Mar 25 15:33:23 2009
@@ -4,8 +4,11 @@
#include "y2storage/PeContainer.h"
#include "y2storage/LvmLv.h"
+
namespace storage
{
+ using std::list;
+
class LvmVg : public PeContainer
{
@@ -44,8 +47,8 @@
void normalizeDmDevices();
void getCommitActions( std::liststorage::commitAction*& l ) const;
int commitChanges( storage::CommitStage stage );
- int getToCommit( storage::CommitStage stage, std::list& col,
- std::list& vol );
+ void getToCommit(storage::CommitStage stage, list& col,
+ list& vol);
int resizeVolume( Volume* v, unsigned long long newSize );
int removeVolume( Volume* v );
void getInfo( storage::LvmVgInfo& info ) const;
Modified: trunk/storage/libstorage/src/Storage.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/Storage.cc?rev=56390&r1=56389&r2=56390&view=diff
==============================================================================
--- trunk/storage/libstorage/src/Storage.cc (original)
+++ trunk/storage/libstorage/src/Storage.cc Wed Mar 25 15:33:23 2009
@@ -3627,8 +3627,8 @@
}
void
-Storage::sortCommitLists( CommitStage stage, list& co,
- list& vl, list& todo )
+Storage::sortCommitLists( CommitStage stage, list& co,
+ list& vl, list& todo )
{
co.sort( (stage==DECREASE)?sort_cont_up:sort_cont_down );
std::ostringstream b;
@@ -3644,9 +3644,9 @@
vl.sort( sort_vol_mount );
else
vl.sort( sort_vol_normal );
- for( list::const_iterator i=co.begin(); i!=co.end(); ++i )
+ for( list::const_iterator i=co.begin(); i!=co.end(); ++i )
todo.push_back( new commitAction( stage, (*i)->type(), *i ));
- for( list::const_iterator i=vl.begin(); i!=vl.end(); ++i )
+ for( list::const_iterator i=vl.begin(); i!=vl.end(); ++i )
todo.push_back( new commitAction( stage, (*i)->cType(), *i ));
b.str("");
b << "unsorted actions <";
@@ -3665,7 +3665,7 @@
todo.sort( cont_less<commitAction>() );
y2mil("stage:" << stage);
b << "sorted co <";
- for( list::const_iterator i=co.begin(); i!=co.end(); ++i )
+ for( list::const_iterator i=co.begin(); i!=co.end(); ++i )
{
if( i!=co.begin() )
b << " ";
@@ -3675,7 +3675,7 @@
y2mil(b.str());
b.str("");
b << "sorted vol <";
- for( list::const_iterator i=vl.begin(); i!=vl.end(); ++i )
+ for( list::const_iterator i=vl.begin(); i!=vl.end(); ++i )
{
if( i!=vl.begin() )
b << " ";
@@ -3784,14 +3784,14 @@
while( unsigned(pt-a) < lengthof(a) )
{
bool new_pair = false;
- list colist;
- list vlist;
- ContIterator i = p.begin();
- while( ret==0 && i != p.end() )
- {
- ret = i->getToCommit( *pt, colist, vlist );
- ++i;
- }
+ list colist;
+ list vlist;
+
+ if (ret == 0)
+ {
+ for (ContIterator i = p.begin(); i != p.end(); ++i)
+ i->getToCommit(*pt, colist, vlist);
+ }
#if 0
if( *pt == FORMAT && instsys() )
{
Modified: trunk/storage/libstorage/src/Storage.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/Storage.h?rev=56390&r1=56389&r2=56390&view=diff
==============================================================================
--- trunk/storage/libstorage/src/Storage.h (original)
+++ trunk/storage/libstorage/src/Storage.h Wed Mar 25 15:33:23 2009
@@ -1691,8 +1691,8 @@
void logVolumes( const string& Dir );
int commitPair( CPair& p, bool (* fnc)( const Container& ) );
void sortCommitLists( storage::CommitStage stage,
- std::list& co,
- std::list& vl,
+ std::list& co,
+ std::list& vl,
std::liststorage::commitAction*& todo );
bool ignoreError( std::list::iterator i,
std::list& al );
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org