[yast-commit] r59438 - in /branches/tmp/mpatelcz/SP1-md/libstorage/src: MdCo.cc MdCo.h MdPartCo.cc MdPartCo.h Storage.cc Storage.h
Author: aschnell Date: Mon Nov 9 18:37:24 2009 New Revision: 59438 URL: http://svn.opensuse.org/viewcvs/yast?rev=59438&view=rev Log: - keep only one EtcRaidtab object Modified: branches/tmp/mpatelcz/SP1-md/libstorage/src/MdCo.cc branches/tmp/mpatelcz/SP1-md/libstorage/src/MdCo.h branches/tmp/mpatelcz/SP1-md/libstorage/src/MdPartCo.cc branches/tmp/mpatelcz/SP1-md/libstorage/src/MdPartCo.h branches/tmp/mpatelcz/SP1-md/libstorage/src/Storage.cc branches/tmp/mpatelcz/SP1-md/libstorage/src/Storage.h Modified: branches/tmp/mpatelcz/SP1-md/libstorage/src/MdCo.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/mpatelcz/SP1-md/libstorage/src/MdCo.cc?rev=59438&r1=59437&r2=59438&view=diff ============================================================================== --- branches/tmp/mpatelcz/SP1-md/libstorage/src/MdCo.cc (original) +++ branches/tmp/mpatelcz/SP1-md/libstorage/src/MdCo.cc Mon Nov 9 18:37:24 2009 @@ -36,43 +36,30 @@ MdCo::~MdCo() { y2deb("destructed MdCo"); - delete tab; } void MdCo::init() { - tab = NULL; mjr = Md::mdMajor(); - initTab(); } -void -MdCo::initTab() - { - if( tab==NULL && !getStorage()->instsys() ) - tab = new EtcRaidtab( getStorage()->root() ); - } void MdCo::syncRaidtab() - { - delete tab; - string d = getStorage()->root()+"/etc"; - if( !checkDir( d ) ) - createPath( d ); - tab = new EtcRaidtab( getStorage()->root() ); +{ MdPair p=mdPair(Md::notDeleted); for( MdIter i=p.begin(); i!=p.end(); ++i ) - { + { updateEntry( &(*i) ); - } } +} + void MdCo::updateEntry( const Md* m ) { - initTab(); - if( tab ) + EtcRaidtab* tab = getStorage()->getRaidtab(); + if (tab) { list<string> lines; list<string> devices; @@ -683,7 +670,7 @@ } if( ret==0 ) { - initTab(); + EtcRaidtab* tab = getStorage()->getRaidtab(); if( tab!=NULL ) { tab->removeEntry( m->nr() ); @@ -786,7 +773,6 @@ { y2deb("constructed MdCo by copy constructor from " << rhs.nm); *this = rhs; - this->tab = NULL; ConstMdPair p = rhs.mdPair(); for( ConstMdIter i=p.begin(); i!=p.end(); ++i ) { Modified: branches/tmp/mpatelcz/SP1-md/libstorage/src/MdCo.h URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/mpatelcz/SP1-md/libstorage/src/MdCo.h?rev=59438&r1=59437&r2=59438&view=diff ============================================================================== --- branches/tmp/mpatelcz/SP1-md/libstorage/src/MdCo.h (original) +++ branches/tmp/mpatelcz/SP1-md/libstorage/src/MdCo.h Mon Nov 9 18:37:24 2009 @@ -102,7 +102,6 @@ void addMd( Md* m ); void checkMd( Md* m ); void updateEntry( const Md* m ); - void initTab(); void init(); @@ -122,8 +121,6 @@ * The line2 is a line following device name in mdstat. */ bool canHandleDev(const string& name, const string& line2); - EtcRaidtab *tab; - static bool active; }; Modified: branches/tmp/mpatelcz/SP1-md/libstorage/src/MdPartCo.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/mpatelcz/SP1-md/libstorage/src/MdPartCo.cc?rev=59438&r1=59437&r2=59438&view=diff ============================================================================== --- branches/tmp/mpatelcz/SP1-md/libstorage/src/MdPartCo.cc (original) +++ branches/tmp/mpatelcz/SP1-md/libstorage/src/MdPartCo.cc Mon Nov 9 18:37:24 2009 @@ -1903,29 +1903,16 @@ } - - -void -MdPartCo::initTab() - { - if( tab==NULL && !getStorage()->instsys() ) - tab = new EtcRaidtab( getStorage()->root() ); - } - void MdPartCo::syncRaidtab() - { - delete tab; - string d = getStorage()->root()+"/etc"; - if( !checkDir( d ) ) - createPath( d ); - tab = new EtcRaidtab( getStorage()->root() ); +{ updateEntry(); - } +} + -void MdPartCo::updateEntry( void ) +void MdPartCo::updateEntry() { - initTab(); + EtcRaidtab* tab = getStorage()->getRaidtab(); if( tab ) { list<string> lines; Modified: branches/tmp/mpatelcz/SP1-md/libstorage/src/MdPartCo.h URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/mpatelcz/SP1-md/libstorage/src/MdPartCo.h?rev=59438&r1=59437&r2=59438&view=diff ============================================================================== --- branches/tmp/mpatelcz/SP1-md/libstorage/src/MdPartCo.h (original) +++ branches/tmp/mpatelcz/SP1-md/libstorage/src/MdPartCo.h Mon Nov 9 18:37:24 2009 @@ -257,8 +257,7 @@ bool validPartition( const Partition* p ); bool findMdPart( unsigned nr, MdPartIter& i ); - void updateEntry( ); - void initTab(); + void updateEntry(); string mdadmLine() const; void raidtabLines( list<string>& lines ) const; @@ -354,8 +353,6 @@ /* Name that is present in /dev/md directory.*/ string md_name; - EtcRaidtab *tab; - static string sysfs_path; enum MdProperty Modified: branches/tmp/mpatelcz/SP1-md/libstorage/src/Storage.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/mpatelcz/SP1-md/libstorage/src/Storage.cc?rev=59438&r1=59437&r2=59438&view=diff ============================================================================== --- branches/tmp/mpatelcz/SP1-md/libstorage/src/Storage.cc (original) +++ branches/tmp/mpatelcz/SP1-md/libstorage/src/Storage.cc Mon Nov 9 18:37:24 2009 @@ -36,6 +36,7 @@ #include "y2storage/ProcMounts.h" #include "y2storage/ProcPart.h" #include "y2storage/EtcFstab.h" +#include "y2storage/EtcRaidtab.h" #include "y2storage/AsciiFile.h" #include "y2storage/StorageDefines.h" @@ -108,6 +109,9 @@ defaultMountBy = MOUNTBY_ID; detectMounted = true; + fstab = NULL; + raidtab = NULL; + logSystemInfo(); } @@ -244,6 +248,7 @@ SystemCmd::testmode = true; rootprefix = testdir(); fstab = new EtcFstab( rootprefix ); + raidtab = new EtcRaidtab(rootprefix); string t = testdir() + "/volume_info"; if( access( t.c_str(), R_OK )==0 ) { @@ -253,6 +258,8 @@ else { fstab = new EtcFstab( "/etc", isRootMounted() ); + if (!instsys()) + raidtab = new EtcRaidtab(root()); detectLoops( *ppart ); ProcMounts pm( this ); if( !instsys() ) @@ -5680,30 +5687,39 @@ return ret; } -void -Storage::syncMdPartRaidtab() -{ - MdPartCoPair p = mdpCoPair(); - MdPartCoIterator ret=p.begin(); - - while( ret != p.end() ) - { - ret->syncRaidtab(); - ret++; - } -} void Storage::rootMounted() { - MdCo* md; root_mounted = true; if( !root().empty() ) { - syncMdPartRaidtab(); + string d = root() + "/etc"; + if (!checkDir(d)) + createPath(d); + + bool have_mds = false; + + MdCo* md; + if (haveMd(md)) + have_mds = true; + + MdPartCoPair p = mdpCoPair(); + if (!p.empty()) + have_mds = true; + + if (have_mds) + { + delete raidtab; + raidtab = new EtcRaidtab(root()); + + if (haveMd(md)) + md->syncRaidtab(); + + for (MdPartCoIterator it = p.begin(); it != p.end(); ++it) + it->syncRaidtab(); + } - if( haveMd(md) ) - md->syncRaidtab(); - if( instsys() ) + if( instsys() ) { string path = root()+"/etc/fstab"; unlink( path.c_str() ); Modified: branches/tmp/mpatelcz/SP1-md/libstorage/src/Storage.h URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/mpatelcz/SP1-md/libstorage/src/Storage.h?rev=59438&r1=59437&r2=59438&view=diff ============================================================================== --- branches/tmp/mpatelcz/SP1-md/libstorage/src/Storage.h (original) +++ branches/tmp/mpatelcz/SP1-md/libstorage/src/Storage.h Mon Nov 9 18:37:24 2009 @@ -167,6 +167,7 @@ */ class EtcFstab; +class EtcRaidtab; class DiskData; class Storage : public storage::StorageInterface @@ -235,6 +236,7 @@ static bool isPPCMac() { return( is_ppc_mac ); } static bool isPPCPegasos() { return( is_ppc_pegasos ); } EtcFstab* getFstab() { return fstab; } + EtcRaidtab* getRaidtab() { return raidtab; } void handleLogFile( const string& name ); static bool testFilesEqual( const string& n1, const string& n2 ); void printInfo( std::ostream& str ) { printInfo( str, "" ); } @@ -1908,6 +1910,7 @@ static bool is_ppc_pegasos; CCont cont; EtcFstab *fstab; + EtcRaidtab *raidtab; storage::CallbackProgressBar progress_bar_cb; storage::CallbackShowInstallInfo install_info_cb; -- 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