[yast-commit] r52685 - in /trunk/storage/libstorage/src: Loop.cc LoopCo.cc
Author: aschnell Date: Wed Oct 29 16:34:35 2008 New Revision: 52685 URL: http://svn.opensuse.org/viewcvs/yast?rev=52685&view=rev Log: - some cleanup Modified: trunk/storage/libstorage/src/Loop.cc trunk/storage/libstorage/src/LoopCo.cc Modified: trunk/storage/libstorage/src/Loop.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/Loop.cc?re... ============================================================================== --- trunk/storage/libstorage/src/Loop.cc (original) +++ trunk/storage/libstorage/src/Loop.cc Wed Oct 29 16:34:35 2008 @@ -18,15 +18,16 @@ using namespace storage; using namespace std; -Loop::Loop( const LoopCo& d, const string& LoopDev, const string& LoopFile, - bool dmcrypt, const string& dm_dev, - ProcPart& ppart, SystemCmd& losetup ) : - Volume( d, 0, 0 ) - { - y2milestone( "constructed loop dev:%s file:%s dmcrypt:%d dmdev:%s", - LoopDev.c_str(), LoopFile.c_str(), dmcrypt, dm_dev.c_str() ); + +Loop::Loop(const LoopCo& d, const string& LoopDev, const string& LoopFile, + bool dmcrypt, const string& dm_dev, ProcPart& ppart, + SystemCmd& losetup) + : Volume(d, 0, 0) +{ + y2mil("constructed loop dev:" << LoopDev << " file:" << LoopFile << + " dmcrypt:" << dmcrypt << " dmdev:" << dm_dev); if( d.type() != LOOP ) - y2error( "constructed loop with wrong container" ); + y2err("constructed loop with wrong container"); init(); lfile = LoopFile; loop_dev = fstab_loop_dev = LoopDev; @@ -73,15 +74,17 @@ if( stat( lfile.c_str(), &st )>=0 ) setSize( st.st_size/1024 ); } - } +} -Loop::Loop( const LoopCo& d, const string& file, bool reuseExisting, - unsigned long long sizeK, bool dmcr ) : Volume( d, 0, 0 ) - { - y2milestone( "constructed loop file:%s reuseExisting:%d sizek:%llu dmcrypt:%d", - file.c_str(), reuseExisting, sizeK, dmcr ); + +Loop::Loop(const LoopCo& d, const string& file, bool reuseExisting, + unsigned long long sizeK, bool dmcr) + : Volume(d, 0, 0) +{ + y2mil("constructed loop file:" << file << " reuseExisting:" << reuseExisting << + " sizek:" << sizeK << " dmcrypt:" << dmcr); if( d.type() != LOOP ) - y2error( "constructed loop with wrong container" ); + y2err("constructed loop with wrong container"); init(); reuseFile = reuseExisting; lfile = file; @@ -107,12 +110,14 @@ checkReuse(); if( !reuseFile ) setSize( sizeK ); - } +} + Loop::~Loop() - { - y2debug( "destructed loop %s", dev.c_str() ); - } +{ + y2deb("destructed loop " << dev); +} + void Loop::init() @@ -191,7 +196,7 @@ return( ret ); } -string +string Loop::lfileRealPath() const { return( cont->getStorage()->root() + lfile ); @@ -281,7 +286,7 @@ // %4$s is replaced by file system type (e.g. reiserfs) // %5$s is replaced by mount point (e.g. /usr) txt = sformat( _("Create file-based device %1$s of file %2$s (%3$s) as %5$s with %4$s"), - d.c_str(), lfile.c_str(), sizeString().c_str(), + d.c_str(), lfile.c_str(), sizeString().c_str(), fsTypeString().c_str(), mp.c_str() ); } else @@ -292,7 +297,7 @@ // %4$s is replaced by file system type (e.g. reiserfs) // %5$s is replaced by mount point (e.g. /usr) txt = sformat( _("Create encrypted file-based device %1$s of file %2$s (%3$s) as %5$s with %4$s"), - d.c_str(), lfile.c_str(), sizeString().c_str(), + d.c_str(), lfile.c_str(), sizeString().c_str(), fsTypeString().c_str(), mp.c_str() ); } } @@ -320,7 +325,7 @@ // %3$s is replaced by size (e.g. 623.5 MB) // %4$s is replaced by file system type (e.g. reiserfs) txt = sformat( _("Formatting file-based device %1$s of %2$s (%3$s) with %4$s "), - d.c_str(), lfile.c_str(), sizeString().c_str(), + d.c_str(), lfile.c_str(), sizeString().c_str(), fsTypeString().c_str() ); } else @@ -338,7 +343,7 @@ // %4$s is replaced by file system type (e.g. reiserfs) // %5$s is replaced by mount point (e.g. /usr) txt = sformat( _("Format file-based device %1$s of %2$s (%3$s) as %5$s with %4$s"), - d.c_str(), lfile.c_str(), sizeString().c_str(), + d.c_str(), lfile.c_str(), sizeString().c_str(), fsTypeString().c_str(), mp.c_str() ); } else @@ -349,7 +354,7 @@ // %4$s is replaced by file system type (e.g. reiserfs) // %5$s is replaced by mount point (e.g. /usr) txt = sformat( _("Format encrypted file-based device %1$s of %2$s (%3$s) as %5$s with %4$s"), - d.c_str(), lfile.c_str(), sizeString().c_str(), + d.c_str(), lfile.c_str(), sizeString().c_str(), fsTypeString().c_str(), mp.c_str() ); } } @@ -360,7 +365,7 @@ // %3$s is replaced by size (e.g. 623.5 MB) // %4$s is replaced by file system type (e.g. reiserfs) txt = sformat( _("Format file-based device %1$s of %2$s (%3$s) with %4$s"), - d.c_str(), lfile.c_str(), sizeString().c_str(), + d.c_str(), lfile.c_str(), sizeString().c_str(), fsTypeString().c_str() ); } } @@ -395,7 +400,7 @@ bool Loop::equalContent( const Loop& rhs ) const { return( Volume::equalContent(rhs) && - lfile==rhs.lfile && reuseFile==rhs.reuseFile && + lfile==rhs.lfile && reuseFile==rhs.reuseFile && delFile==rhs.delFile ); } @@ -421,21 +426,24 @@ y2mil(log); } -Loop& Loop::operator= ( const Loop& rhs ) - { - y2debug( "operator= from %s", rhs.nm.c_str() ); + +Loop& Loop::operator=(const Loop& rhs) +{ + y2deb("operator= from " << rhs.nm); *((Volume*)this) = rhs; lfile = rhs.lfile; reuseFile = rhs.reuseFile; delFile = rhs.delFile; - return( *this ); - } + return *this; +} -Loop::Loop( const LoopCo& d, const Loop& rhs ) : Volume(d) - { - y2debug( "constructed loop by copy constructor from %s", rhs.nm.c_str() ); + +Loop::Loop(const LoopCo& d, const Loop& rhs) + : Volume(d) +{ + y2deb("constructed loop by copy constructor from " << rhs.nm); *this = rhs; - } +} -unsigned Loop::loop_major = 0; +unsigned Loop::loop_major = 0; Modified: trunk/storage/libstorage/src/LoopCo.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/LoopCo.cc?... ============================================================================== --- trunk/storage/libstorage/src/LoopCo.cc (original) +++ trunk/storage/libstorage/src/LoopCo.cc Wed Oct 29 16:34:35 2008 @@ -18,26 +18,30 @@ using namespace storage; using namespace std; -LoopCo::LoopCo( Storage * const s, bool detect, ProcPart& ppart ) : - Container(s,"loop",staticType()) - { - y2debug( "constructing LoopCo detect:%d", detect ); + +LoopCo::LoopCo(Storage * const s, bool detect, ProcPart& ppart) + : Container(s, "loop", staticType()) +{ + y2deb("constructing LoopCo detect:" << detect); init(); if( detect ) getLoopData( ppart ); - } +} -LoopCo::LoopCo( Storage * const s, const string& file ) : - Container(s,"loop",staticType()) - { - y2debug( "constructing LoopCo file:%s", file.c_str() ); + +LoopCo::LoopCo(Storage * const s, const string& file) + : Container(s, "loop", staticType()) +{ + y2deb("constructing LoopCo file:" << file); init(); - } +} + LoopCo::~LoopCo() - { - y2debug( "destructed LoopCo" ); - } +{ + y2deb("destructed LoopCo"); +} + void LoopCo::init() @@ -68,7 +72,7 @@ y2warning( "file %s not existent or special", lfile.c_str() ); else { - Loop *l = new Loop( *this, i->loop_dev, lfile, + Loop *l = new Loop( *this, i->loop_dev, lfile, i->dmcrypt, !i->noauto?i->dentry:"", ppart, c ); l->setEncryption( i->encr ); @@ -92,10 +96,10 @@ { getStorage()->findDmUsing( i->loopDevice(), dm ); } - if( dm==0 && !i->getMount().empty() && + if( dm==0 && !i->getMount().empty() && !mp[i->getMount()].empty() ) { - y2mil( "mp:" << i->getMount() << " dev:" << + y2mil( "mp:" << i->getMount() << " dev:" << mp[i->getMount()] ); getStorage()->findDm( mp[i->getMount()], dm ); } @@ -197,11 +201,11 @@ } int -LoopCo::updateLoop( const string& device, const string& file, +LoopCo::updateLoop( const string& device, const string& file, bool reuseExisting, unsigned long long sizeK ) { int ret = 0; - y2milestone( "device:%s file:%s reuse:%d sizeK:%lld", device.c_str(), + y2milestone( "device:%s file:%s reuse:%d sizeK:%lld", device.c_str(), file.c_str(), reuseExisting, sizeK ); LoopIter i; if( readonly() ) @@ -409,16 +413,16 @@ return( ret ); } -LoopCo::LoopCo( const LoopCo& rhs ) : Container(rhs) - { - y2debug( "constructed LoopCo by copy constructor from %s", rhs.nm.c_str() ); + +LoopCo::LoopCo(const LoopCo& rhs) + : Container(rhs) +{ + y2deb("constructed LoopCo by copy constructor from " << rhs.nm); *this = rhs; ConstLoopPair p = rhs.loopPair(); for( ConstLoopIter i=p.begin(); i!=p.end(); ++i ) - { - Loop * p = new Loop( *this, *i ); - vols.push_back( p ); - } + { + Loop * p = new Loop( *this, *i ); + vols.push_back( p ); } - - +} -- 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