Mailinglist Archive: yast-commit (693 mails)

< Previous Next >
[yast-commit] r55950 - in /trunk/storage/libstorage/src: AppUtil.cc Disk.cc Dm.cc DmPart.cc DmmultipathCo.cc DmraidCo.cc EtcFstab.cc Partition.cc Storage.cc StorageTypes.h Volume.cc
  • From: aschnell@xxxxxxxxxxxxxxxx
  • Date: Thu, 05 Mar 2009 17:21:56 -0000
  • Message-id: <E1LfHGe-0007D6-L5@xxxxxxxxxxxxxxxx>
Author: aschnell
Date: Thu Mar 5 18:21:56 2009
New Revision: 55950

URL: http://svn.opensuse.org/viewcvs/yast?rev=55950&view=rev
Log:
- better names for tiny helpers

Modified:
trunk/storage/libstorage/src/AppUtil.cc
trunk/storage/libstorage/src/Disk.cc
trunk/storage/libstorage/src/Dm.cc
trunk/storage/libstorage/src/DmPart.cc
trunk/storage/libstorage/src/DmmultipathCo.cc
trunk/storage/libstorage/src/DmraidCo.cc
trunk/storage/libstorage/src/EtcFstab.cc
trunk/storage/libstorage/src/Partition.cc
trunk/storage/libstorage/src/Storage.cc
trunk/storage/libstorage/src/StorageTypes.h
trunk/storage/libstorage/src/Volume.cc

Modified: trunk/storage/libstorage/src/AppUtil.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/AppUtil.cc?rev=55950&r1=55949&r2=55950&view=diff
==============================================================================
--- trunk/storage/libstorage/src/AppUtil.cc (original)
+++ trunk/storage/libstorage/src/AppUtil.cc Thu Mar 5 18:21:56 2009
@@ -491,7 +491,7 @@

Regex rx("^" + Regex::ws + "([0-9]+)" + Regex::ws + string(driver) + "$");

- std::vector<string>::const_iterator it = find_if(lines.begin(),
lines.end(), match_regex(rx));
+ std::vector<string>::const_iterator it = find_if(lines.begin(),
lines.end(), regex_matches(rx));
if (it == lines.end())
y2err("did not find " << driver << " in /proc/devices");
else

Modified: trunk/storage/libstorage/src/Disk.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/Disk.cc?rev=55950&r1=55949&r2=55950&view=diff
==============================================================================
--- trunk/storage/libstorage/src/Disk.cc (original)
+++ trunk/storage/libstorage/src/Disk.cc Thu Mar 5 18:21:56 2009
@@ -187,8 +187,8 @@
y2mil("disk:" << nm << " path:" << path << "id:" << id);
udev_path = path;
udev_id = id;
- udev_id.remove_if(find_begin("edd-"));
- partition(udev_id.begin(), udev_id.end(), find_begin("ata-"));
+ udev_id.remove_if(string_starts_with("edd-"));
+ partition(udev_id.begin(), udev_id.end(), string_starts_with("ata-"));
y2mil("id:" << udev_id);

PartPair pp = partPair();

Modified: trunk/storage/libstorage/src/Dm.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/Dm.cc?rev=55950&r1=55949&r2=55950&view=diff
==============================================================================
--- trunk/storage/libstorage/src/Dm.cc (original)
+++ trunk/storage/libstorage/src/Dm.cc Thu Mar 5 18:21:56 2009
@@ -511,7 +511,7 @@
{
string ret = SYSFSDIR "/";
list<string>::const_iterator i =
- find_if( alt_names.begin(), alt_names.end(), find_begin( "/dev/dm-" ) );
+ find_if( alt_names.begin(), alt_names.end(), string_starts_with(
"/dev/dm-" ) );
if( i != alt_names.end() )
{
string::size_type pos = i->rfind( '/' ) + 1;

Modified: trunk/storage/libstorage/src/DmPart.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/DmPart.cc?rev=55950&r1=55949&r2=55950&view=diff
==============================================================================
--- trunk/storage/libstorage/src/DmPart.cc (original)
+++ trunk/storage/libstorage/src/DmPart.cc Thu Mar 5 18:21:56 2009
@@ -109,7 +109,7 @@
void
DmPart::addAltUdevId( unsigned num )
{
- alt_names.remove_if(find_any("/by-id/"));
+ alt_names.remove_if(string_contains("/by-id/"));

list<string>::const_iterator j = co()->udevId().begin();
while( j!=co()->udevId().end() )

Modified: trunk/storage/libstorage/src/DmmultipathCo.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/DmmultipathCo.cc?rev=55950&r1=55949&r2=55950&view=diff
==============================================================================
--- trunk/storage/libstorage/src/DmmultipathCo.cc (original)
+++ trunk/storage/libstorage/src/DmmultipathCo.cc Thu Mar 5 18:21:56 2009
@@ -91,7 +91,7 @@
{
y2mil("disk:" << nm << " id:" << id);
udev_id = id;
- udev_id.remove_if(find_begin("dm-"));
+ udev_id.remove_if(string_starts_with("dm-"));
y2mil("id:" << udev_id);

DmPartCo::setUdevData(udev_id);

Modified: trunk/storage/libstorage/src/DmraidCo.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/DmraidCo.cc?rev=55950&r1=55949&r2=55950&view=diff
==============================================================================
--- trunk/storage/libstorage/src/DmraidCo.cc (original)
+++ trunk/storage/libstorage/src/DmraidCo.cc Thu Mar 5 18:21:56 2009
@@ -79,7 +79,7 @@
{
y2mil("disk:" << nm << " id:" << id);
udev_id = id;
- udev_id.remove_if(find_begin("dm-"));
+ udev_id.remove_if(string_starts_with("dm-"));
y2mil("id:" << udev_id);

DmPartCo::setUdevData(udev_id);

Modified: trunk/storage/libstorage/src/EtcFstab.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/EtcFstab.cc?rev=55950&r1=55949&r2=55950&view=diff
==============================================================================
--- trunk/storage/libstorage/src/EtcFstab.cc (original)
+++ trunk/storage/libstorage/src/EtcFstab.cc Thu Mar 5 18:21:56 2009
@@ -188,7 +188,7 @@

noauto = find( beg, end, "noauto" ) != end;

- list<string>::const_iterator i = find_if( beg, end, find_begin("loop") );
+ list<string>::const_iterator i = find_if( beg, end,
string_starts_with("loop") );
if( i!=end )
{
loop = true;
@@ -198,7 +198,7 @@
loop_dev = i->substr( pos+1 );
}
}
- i = find_if( beg, end, find_begin("encryption=") );
+ i = find_if( beg, end, string_starts_with("encryption=") );
if( i!=end )
{
string::size_type pos = i->find("=");

Modified: trunk/storage/libstorage/src/Partition.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/Partition.cc?rev=55950&r1=55949&r2=55950&view=diff
==============================================================================
--- trunk/storage/libstorage/src/Partition.cc (original)
+++ trunk/storage/libstorage/src/Partition.cc Thu Mar 5 18:21:56 2009
@@ -78,7 +78,7 @@
const string& Partition::udevPath() const
{
list<string>::const_iterator i =
- find_if( alt_names.begin(), alt_names.end(), find_any( "/by-path/" ));
+ find_if( alt_names.begin(), alt_names.end(), string_contains(
"/by-path/" ));
return( i==alt_names.end() ? empty_string : *i );
}

@@ -120,7 +120,7 @@

void Partition::addAltUdevId( unsigned num )
{
- alt_names.remove_if(find_any("/by-id/"));
+ alt_names.remove_if(string_contains("/by-id/"));

list<string>::const_iterator j = disk()->udevId().begin();
while( j!=disk()->udevId().end() )
@@ -133,7 +133,7 @@

void Partition::addAltUdevPath( unsigned num )
{
- alt_names.remove_if(find_any("/by-path/"));
+ alt_names.remove_if(string_contains("/by-path/"));

if( !disk()->udevPath().empty() )
alt_names.push_back( udevCompletePathPath( disk()->udevPath(), num ));
@@ -156,7 +156,7 @@
}
addAltUdevId( num );
list<string>::iterator i = find_if( alt_names.begin(), alt_names.end(),
- find_any( "/by-path/" ));
+ string_contains( "/by-path/" ));
if( i!=alt_names.end() )
*i = udevCompletePathPath( disk()->udevPath(), num );
nm.clear();

Modified: trunk/storage/libstorage/src/Storage.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/Storage.cc?rev=55950&r1=55949&r2=55950&view=diff
==============================================================================
--- trunk/storage/libstorage/src/Storage.cc (original)
+++ trunk/storage/libstorage/src/Storage.cc Thu Mar 5 18:21:56 2009
@@ -2214,7 +2214,7 @@
list<string> opts = splitString( vol->getFstabOption(), "," );
for( list<string>::const_iterator i=l.begin(); i!=l.end(); i++ )
{
- opts.remove_if(match_regex(*i));
+ opts.remove_if(regex_matches(*i));
}
ret = vol->changeFstabOptions( boost::join( opts, "," ) );
}

Modified: trunk/storage/libstorage/src/StorageTypes.h
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/StorageTypes.h?rev=55950&r1=55949&r2=55950&view=diff
==============================================================================
--- trunk/storage/libstorage/src/StorageTypes.h (original)
+++ trunk/storage/libstorage/src/StorageTypes.h Thu Mar 5 18:21:56 2009
@@ -131,25 +131,25 @@
};


-struct match_regex
+ struct regex_matches
{
- match_regex(const Regex& t) : r(t) {}
- bool operator()(const string&s) { return r.match(s); }
- const Regex& r;
+ regex_matches(const Regex& t) : val(t) {}
+ bool operator()(const string& s) { return val.match(s); }
+ const Regex& val;
};

-struct find_begin
+ struct string_starts_with
{
- find_begin(const string& t) : val(t) {}
- bool operator()(const string& s) { return boost::starts_with(s, val); }
- const string& val;
+ string_starts_with(const string& t) : val(t) {}
+ bool operator()(const string& s) { return boost::starts_with(s, val); }
+ const string& val;
};

-struct find_any
+ struct string_contains
{
- find_any(const string& t) : val(t) {}
- bool operator()(const string& s) { return boost::contains(s, val); }
- const string& val;
+ string_contains(const string& t) : val(t) {}
+ bool operator()(const string& s) { return boost::contains(s, val); }
+ const string& val;
};

}

Modified: trunk/storage/libstorage/src/Volume.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/Volume.cc?rev=55950&r1=55949&r2=55950&view=diff
==============================================================================
--- trunk/storage/libstorage/src/Volume.cc (original)
+++ trunk/storage/libstorage/src/Volume.cc Thu Mar 5 18:21:56 2009
@@ -466,7 +466,7 @@
{
uuid = i->second;
b << " uuid:" << uuid;
- alt_names.remove_if(find_any("/by-uuid/"));
+ alt_names.remove_if(string_contains("/by-uuid/"));
alt_names.push_back( "/dev/disk/by-uuid/" + uuid );
}
i = m.find( "LABEL" );
@@ -476,7 +476,7 @@
if (fs != HFS)
label = orig_label = i->second;
b << " label:\"" << label << "\"";
- alt_names.remove_if(find_any("/by-label/"));
+ alt_names.remove_if(string_contains("/by-label/"));
alt_names.push_back( "/dev/disk/by-label/" + label );
}
y2mil(b.str());
@@ -742,7 +742,7 @@
{
cmd = "/sbin/mkdosfs";
list<string> l=splitString( mkfs_opt );
- if( find_if( l.begin(), l.end(), find_begin( "-F" ) ) !=
l.end())
+ if( find_if( l.begin(), l.end(), string_starts_with( "-F" ) )
!= l.end())
params = "-F 32";
else if( sizeK()>2*1024*1024 )
{
@@ -1785,7 +1785,7 @@
list<string> l = splitString( fstab_opt, "," );
list<string>::iterator i = find( l.begin(), l.end(), "loop" );
if( i == l.end() )
- i = find_if( l.begin(), l.end(), find_begin( "loop=" ) );
+ i = find_if( l.begin(), l.end(), string_starts_with(
"loop=" ) );
if( i!=l.end() )
*i = "loop=" + fstab_loop_dev;
fstab_opt = boost::join( l, "," );
@@ -1828,7 +1828,7 @@
{
y2mil( "prefix:" << prefix << " new:" << newn );
list<string>::iterator i =
- find_if( alt_names.begin(), alt_names.end(), find_begin( prefix ) );
+ find_if( alt_names.begin(), alt_names.end(), string_starts_with( prefix
) );
if( i!=alt_names.end() )
{
if( !newn.empty() )
@@ -2136,7 +2136,7 @@
for( unsigned i=0; i<lengthof(ign_opt) && *ign_opt[i]!=0; i++ )
l.remove(ign_opt[i]);
for( unsigned i=0; i<lengthof(ign_beg) && *ign_beg[i]!=0; i++ )
- l.remove_if(find_begin(ign_beg[i]));
+ l.remove_if(string_starts_with(ign_beg[i]));
y2mil( "l after:" << l );
string opts = " ";
if( !l.empty() )
@@ -2325,9 +2325,9 @@
l = splitString( fstab_opt, "," );
list<string>::iterator loop = find( l.begin(), l.end(), "loop" );
if( loop == l.end() )
- loop = find_if( l.begin(), l.end(), find_begin( "loop=" ) );
+ loop = find_if( l.begin(), l.end(), string_starts_with( "loop=" ) );
list<string>::iterator enc =
- find_if( l.begin(), l.end(), find_begin( "encryption=" ) );
+ find_if( l.begin(), l.end(), string_starts_with( "encryption=" ) );
string lstr;
if( optNoauto() &&
((encryption!=ENC_NONE && !dmcrypt()) || cont->type()==LOOP ))

--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages