Author: aschnell
Date: Fri Aug 8 22:57:28 2008
New Revision: 49896
URL: http://svn.opensuse.org/viewcvs/yast?rev=49896&view=rev
Log:
- protect members of class usedBy
Modified:
trunk/storage/libstorage/src/StorageTypes.cc
trunk/storage/libstorage/src/StorageTypes.h
trunk/storage/libstorage/src/Volume.cc
Modified: trunk/storage/libstorage/src/StorageTypes.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/StorageTypes.cc?rev=49896&r1=49895&r2=49896&view=diff
==============================================================================
--- trunk/storage/libstorage/src/StorageTypes.cc (original)
+++ trunk/storage/libstorage/src/StorageTypes.cc Fri Aug 8 22:57:28 2008
@@ -13,7 +13,7 @@
{
if( vol()==NULL || rhs.vol()==NULL )
return( false );
- else
+ else
{
if( rhs.vol()->getMount()=="swap" )
return( false );
@@ -51,5 +51,44 @@
return( unsigned(l)http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/StorageTypes.h?rev=49896&r1=49895&r2=49896&view=diff
==============================================================================
--- trunk/storage/libstorage/src/StorageTypes.h (original)
+++ trunk/storage/libstorage/src/StorageTypes.h Fri Aug 8 22:57:28 2008
@@ -97,10 +97,12 @@
{ return( !(*this < rhs && *this == rhs) ); }
};
-struct usedBy
- {
- usedBy() : t(storage::UB_NONE) {;}
- usedBy( storage::UsedByType typ, const string& n ) : t(typ), nm(n) {;}
+
+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; }
@@ -108,52 +110,17 @@
{ return( t==rhs.t && nm==rhs.nm ); }
bool operator!=( const usedBy& rhs ) const
{ return( !(*this==rhs)); }
- inline operator string() const;
+ operator string() const;
- storage::UsedByType type() const { return( t ); }
- const string& name() const { return( nm ); }
- friend inline std::ostream& operator<< (std::ostream&, const usedBy& );
+ storage::UsedByType type() const { return t; }
+ const string& name() const { return nm; }
+ friend std::ostream& operator<< (std::ostream&, const usedBy&);
+private:
storage::UsedByType t;
string nm;
- };
+};
-inline usedBy::operator string() const
- {
- string st;
- if( t!=storage::UB_NONE )
- {
- switch( t )
- {
- case storage::UB_LVM:
- st = "lvm";
- break;
- case storage::UB_MD:
- st = "md";
- break;
- case storage::UB_DM:
- st = "dm";
- break;
- case storage::UB_DMRAID:
- st = "dmraid";
- break;
- default:
- st = "UNKNOWN";
- break;
- }
- st += "[" + nm + "]";
- }
- return( st );
- }
-
-inline std::ostream& operator<< (std::ostream& s, const usedBy& d )
- {
- if( d.t!=storage::UB_NONE )
- {
- s << " UsedBy:" << string(d);
- }
- return( s );
- }
struct match_string
{
Modified: trunk/storage/libstorage/src/Volume.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/Volume.cc?rev=49896&r1=49895&r2=49896&view=diff
==============================================================================
--- trunk/storage/libstorage/src/Volume.cc (original)
+++ trunk/storage/libstorage/src/Volume.cc Fri Aug 8 22:57:28 2008
@@ -487,7 +487,7 @@
else
{
FsCapabilities caps;
- if( uby.t != UB_NONE )
+ if( uby.type() != UB_NONE )
{
ret = VOLUME_ALREADY_IN_USE;
}
@@ -528,7 +528,7 @@
{
ret = VOLUME_MOUNT_POINT_INVALID;
}
- else if( uby.t != UB_NONE )
+ else if( uby.type() != UB_NONE )
{
ret = VOLUME_ALREADY_IN_USE;
}
@@ -554,7 +554,7 @@
int ret = 0;
y2milestone( "device:%s mby:%s", dev.c_str(), mbyTypeString(mby).c_str() );
y2mil( "vorher:" << *this );
- if( uby.t != UB_NONE )
+ if( uby.type() != UB_NONE )
{
ret = VOLUME_ALREADY_IN_USE;
}
@@ -598,7 +598,7 @@
int ret = 0;
y2milestone( "device:%s options:%s encr:%s", dev.c_str(), options.c_str(),
encTypeString(encryption).c_str() );
- if( uby.t != UB_NONE )
+ if( uby.type() != UB_NONE )
{
ret = VOLUME_ALREADY_IN_USE;
}
@@ -670,7 +670,7 @@
{
cont->getStorage()->showInfoCb( formatText(true) );
}
- if( uby.t != UB_NONE )
+ if( uby.type() != UB_NONE )
{
ret = VOLUME_ALREADY_IN_USE;
}
@@ -1131,7 +1131,7 @@
{
createPath( lmount );
}
- if( ret==0 && !mp.empty() && uby.t != UB_NONE )
+ if( ret==0 && !mp.empty() && uby.type() != UB_NONE )
{
ret = VOLUME_ALREADY_IN_USE;
}
@@ -1166,7 +1166,7 @@
{
int ret=0;
y2milestone( "val:%llu", newSizeK );
- if( uby.t != UB_NONE )
+ if( uby.type() != UB_NONE )
{
ret = VOLUME_ALREADY_IN_USE;
}
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org