Author: aschnell Date: Sat Aug 9 00:15:11 2008 New Revision: 49897 URL: http://svn.opensuse.org/viewcvs/yast?rev=49897&view=rev Log: - some cleanup Modified: trunk/storage/libstorage/src/Container.h trunk/storage/libstorage/src/Storage.cc trunk/storage/libstorage/src/Storage.h trunk/storage/libstorage/src/StorageTypes.cc trunk/storage/libstorage/src/StorageTypes.h trunk/storage/libstorage/src/Volume.h Modified: trunk/storage/libstorage/src/Container.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/Container.h?rev=49897&r1=49896&r2=49897&view=diff ============================================================================== --- trunk/storage/libstorage/src/Container.h (original) +++ trunk/storage/libstorage/src/Container.h Sat Aug 9 00:15:11 2008 @@ -143,7 +143,7 @@ void setSilent( bool val=true ) { silent=val; } void clearUsedBy() { uby.clear(); } - void setUsedBy(storage::UsedByType t, const string& name) { uby.set(t, name); } + void setUsedBy(storage::UsedByType ub_type, const string& ub_name) { uby.set(ub_type, ub_name); } const storage::usedBy& getUsedBy() const { return uby; } storage::UsedByType getUsedByType() const { return uby.type(); } const string& usedByName() const { return uby.name(); } Modified: trunk/storage/libstorage/src/Storage.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/Storage.cc?rev=49897&r1=49896&r2=49897&view=diff ============================================================================== --- trunk/storage/libstorage/src/Storage.cc (original) +++ trunk/storage/libstorage/src/Storage.cc Sat Aug 9 00:15:11 2008 @@ -4592,32 +4592,31 @@ } -bool Storage::setUsedBy( const string& dev, UsedByType typ, const string& name ) - { +bool Storage::setUsedBy(const string& dev, UsedByType ub_type, const string& ub_name) +{ bool ret=true; VolIterator v; if( !findVolume( dev, v ) ) - { + { DiskIterator i = findDisk( dev ); if( i != dEnd() ) - { - i->setUsedBy( typ, name ); - } + { + i->setUsedBy(ub_type, ub_name); + } else - { + { ret = false; - y2error( "could not set used by %d:%s for %s", typ, name.c_str(), - dev.c_str() ); - } + y2err("could not set ub_type:" << ub_type << " ub_name:" << ub_name << + "for dev: " << dev); } + } else - { - v->setUsedBy( typ, name ); - } - y2milestone( "dev:%s usedBy %d:%s ret:%d", dev.c_str(), typ, name.c_str(), - ret ); - return( ret ); + { + v->setUsedBy(ub_type, ub_name); } + y2mil("dev:" << dev << " ub_type:" << ub_type << " ub_name:" << ub_name << " ret:" << ret); + return ret; +} bool Storage::usedBy( const string& dev, storage::usedBy& ub ) @@ -4931,9 +4930,10 @@ return( ret ); } -int Storage::removeUsing( const string& device, const storage::usedBy& uby ) - { - y2mil( "device:" << device << uby ); + +int Storage::removeUsing(const string& device, const storage::usedBy& uby) +{ + y2mil("device:" << device << " uby:" << uby); string name = uby.name(); int ret=0; switch( uby.type() ) @@ -4957,9 +4957,10 @@ ret = STORAGE_REMOVE_USING_UNKNOWN_TYPE; break; } - y2milestone( "ret:%d", ret ); - return( ret ); - } + y2mil("ret:" << ret); + return ret; +} + void Storage::rootMounted() { Modified: trunk/storage/libstorage/src/Storage.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/Storage.h?rev=49897&r1=49896&r2=49897&view=diff ============================================================================== --- trunk/storage/libstorage/src/Storage.h (original) +++ trunk/storage/libstorage/src/Storage.h Sat Aug 9 00:15:11 2008 @@ -235,8 +235,8 @@ storage::UsedByType usedBy( const string& dev ); bool usedBy( const string& dev, storage::usedBy& ub ); bool clearUsedBy(const string& dev); - bool setUsedBy(const string& dev, storage::UsedByType typ, - const string& name ); + bool setUsedBy(const string& dev, storage::UsedByType ub_type, + const string& ub_name); bool canUseDevice( const string& dev, bool disks_allowed=false ); bool knownDevice( const string& dev, bool disks_allowed=false ); bool setDmcryptData( const string& dev, const string& dm, Modified: trunk/storage/libstorage/src/StorageTypes.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/StorageTypes.cc?rev=49897&r1=49896&r2=49897&view=diff ============================================================================== --- trunk/storage/libstorage/src/StorageTypes.cc (original) +++ trunk/storage/libstorage/src/StorageTypes.cc Sat Aug 9 00:15:11 2008 @@ -55,9 +55,9 @@ usedBy::operator string() const { string st; - if( t!=storage::UB_NONE ) + if (type() != storage::UB_NONE) { - switch( t ) + switch (type()) { case storage::UB_LVM: st = "lvm"; @@ -75,7 +75,7 @@ st = "UNKNOWN"; break; } - st += "[" + nm + "]"; + st += "[" + name() + "]"; } return st; } @@ -83,7 +83,7 @@ std::ostream& operator<<(std::ostream& s, const usedBy& d) { - if( d.t!=storage::UB_NONE ) + if (d.type() != storage::UB_NONE) { s << " UsedBy:" << string(d); } Modified: trunk/storage/libstorage/src/StorageTypes.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/StorageTypes.h?rev=49897&r1=49896&r2=49897&view=diff ============================================================================== --- trunk/storage/libstorage/src/StorageTypes.h (original) +++ trunk/storage/libstorage/src/StorageTypes.h Sat Aug 9 00:15:11 2008 @@ -101,24 +101,28 @@ class usedBy { public: - usedBy() : t(storage::UB_NONE) {} - usedBy(storage::UsedByType typ, const string& n) : t(typ), nm(n) {} - void clear() { t=storage::UB_NONE; nm.erase(); } - void set( storage::UsedByType type, const string& n ) - { t=type; (t==storage::UB_NONE)?nm.erase():nm=n; } - bool operator==( const usedBy& rhs ) const - { return( t==rhs.t && nm==rhs.nm ); } - bool operator!=( const usedBy& rhs ) const - { return( !(*this==rhs)); } + usedBy() : ub_type(storage::UB_NONE) {} + usedBy(storage::UsedByType type, const string& name) : ub_type(type), ub_name(name) {} + + void clear() { ub_type = storage::UB_NONE; ub_name.erase(); } + void set(storage::UsedByType type, const string& name) + { ub_type = type; (ub_type==storage::UB_NONE)?ub_name.erase():ub_name = name; } + + bool operator==(const usedBy& rhs) const + { return ub_type == rhs.ub_type && ub_name == rhs.ub_name; } + bool operator!=(const usedBy& rhs) const + { return !(*this == rhs); } + operator string() const; - storage::UsedByType type() const { return t; } - const string& name() const { return nm; } + storage::UsedByType type() const { return ub_type; } + const string& name() const { return ub_name; } + friend std::ostream& operator<< (std::ostream&, const usedBy&); private: - storage::UsedByType t; - string nm; + storage::UsedByType ub_type; + string ub_name; }; Modified: trunk/storage/libstorage/src/Volume.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/Volume.h?rev=49897&r1=49896&r2=49897&view=diff ============================================================================== --- trunk/storage/libstorage/src/Volume.h (original) +++ trunk/storage/libstorage/src/Volume.h Sat Aug 9 00:15:11 2008 @@ -53,7 +53,7 @@ bool fstabAdded() const { return( fstab_added ); } void clearUsedBy() { uby.clear(); } - void setUsedBy(storage::UsedByType t, const string& name) { uby.set(t, name); } + void setUsedBy(storage::UsedByType ub_type, const string& ub_name) { uby.set(ub_type, ub_name); } const storage::usedBy& getUsedBy() const { return uby; } storage::UsedByType getUsedByType() const { return uby.type(); } const string& usedByName() const { return uby.name(); } -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org