[yast-commit] r59269 - in /branches/tmp/mpatelcz/SP1-md/libstorage/src: MdPart.cc MdPart.h MdPartCo.cc MdPartCo.h Storage.cc Storage.h StorageDefines.h
Author: aschnell
Date: Tue Nov 3 12:16:22 2009
New Revision: 59269
URL: http://svn.opensuse.org/viewcvs/yast?rev=59269&view=rev
Log:
- minor improvements
Modified:
branches/tmp/mpatelcz/SP1-md/libstorage/src/MdPart.cc
branches/tmp/mpatelcz/SP1-md/libstorage/src/MdPart.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
branches/tmp/mpatelcz/SP1-md/libstorage/src/StorageDefines.h
Modified: branches/tmp/mpatelcz/SP1-md/libstorage/src/MdPart.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/mpatelcz/SP1-md/libstorage/src/MdPart.cc?rev=59269&r1=59268&r2=59269&view=diff
==============================================================================
--- branches/tmp/mpatelcz/SP1-md/libstorage/src/MdPart.cc (original)
+++ branches/tmp/mpatelcz/SP1-md/libstorage/src/MdPart.cc Tue Nov 3 12:16:22 2009
@@ -5,6 +5,7 @@
* Device (RAID Volume).
*
* Copyright (c) 2009, Intel Corporation.
+ * Copyright (c) 2009 Novell, Inc.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
@@ -18,7 +19,6 @@
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
- *
*/
/*
@@ -34,8 +34,10 @@
#include "y2storage/AppUtil.h"
#include "y2storage/Storage.h"
-using namespace std;
-using namespace storage;
+
+namespace storage
+{
+ using namespace std;
MdPart::MdPart(const MdPartCo& d, unsigned nr, Partition* pa) : Volume( d, nr, 0 )
@@ -214,8 +216,6 @@
tinfo = info;
}
-namespace storage
-{
std::ostream& operator<< (std::ostream& s, const MdPart &p )
{
@@ -224,8 +224,6 @@
return( s );
}
-}
-
bool MdPart::equalContent( const MdPart& rhs ) const
{
return( Volume::equalContent(rhs) );
@@ -251,3 +249,5 @@
}
+
+}
Modified: branches/tmp/mpatelcz/SP1-md/libstorage/src/MdPart.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/mpatelcz/SP1-md/libstorage/src/MdPart.h?rev=59269&r1=59268&r2=59269&view=diff
==============================================================================
--- branches/tmp/mpatelcz/SP1-md/libstorage/src/MdPart.h (original)
+++ branches/tmp/mpatelcz/SP1-md/libstorage/src/MdPart.h Tue Nov 3 12:16:22 2009
@@ -3,7 +3,9 @@
*
* Declaration of MdPart class which represents single partition on MD
* Device (RAID Volume).
+ *
* Copyright (c) 2009, Intel Corporation.
+ * Copyright (c) 2009 Novell, Inc.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
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=59269&r1=59268&r2=59269&view=diff
==============================================================================
--- branches/tmp/mpatelcz/SP1-md/libstorage/src/MdPartCo.cc (original)
+++ branches/tmp/mpatelcz/SP1-md/libstorage/src/MdPartCo.cc Tue Nov 3 12:16:22 2009
@@ -5,6 +5,7 @@
* Volume) like md126 which is a Container for partitions.
*
* Copyright (c) 2009, Intel Corporation.
+ * Copyright (c) 2009 Novell, Inc.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
@@ -18,8 +19,8 @@
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
- *
*/
+
/*
Textdomain "storage"
*/
@@ -42,8 +43,11 @@
#include "y2storage/StorageDefines.h"
#include "y2storage/Regex.h"
-using namespace std;
-using namespace storage;
+
+namespace storage
+{
+ using namespace std;
+
MdPartCo::MdPartCo( Storage * const s,
const string& name,
@@ -1088,9 +1092,6 @@
}
-namespace storage
-{
-
std::ostream& operator<< (std::ostream& s, const MdPartCo& d )
{
s << *((Container*)&d);
@@ -1105,7 +1106,6 @@
return( s );
}
-}
string MdPartCo::getDiffString( const Container& d ) const
{
@@ -1300,9 +1300,11 @@
//
//unused devices: <none>
-void MdPartCo::getMdRaids( list<string>& l )
+
+list<string>
+MdPartCo::getMdRaids()
{
- l.clear();
+ list<string> l;
y2mil( "begin" );
string line;
@@ -1330,7 +1332,9 @@
}
file.close();
file.clear();
- //y2mil( "List of MD's: " << l );
+
+ y2mil("detected mdparts " << l);
+ return l;
}
void
@@ -1929,7 +1933,7 @@
SystemCmd c;
bool ret = false;
- string cmd = PARTEDCMD " /dev/" + quote(name) + " print";
+ string cmd = PARTEDCMD " " + quote("/dev/" + name) + " print";
c.execute(cmd);
@@ -1961,13 +1965,15 @@
y2mil( " Returning: " << ret);
return ret;
}
+
+
/* Return true if there is no partition table and no FS */
bool MdPartCo::hasFileSystem(const string& name)
{
y2mil( " called for " << name);
//bool ret = false;
SystemCmd c;
- string cmd = BLKIDBIN " /dev/" + quote(name);
+ string cmd = BLKIDBIN " -c /dev/null " + quote("/dev/" + name);
c.execute(cmd);
// IF filesystem was bit found then it will return no output end error core 2.
@@ -1980,6 +1986,8 @@
y2mil( " Return true");
return true;
}
+
+
// No '/dev/' please.
bool MdPartCo::isHandled(const string& name)
{
@@ -2065,3 +2073,4 @@
void MdPartCo::logData( const string& Dir ) {;}
+}
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=59269&r1=59268&r2=59269&view=diff
==============================================================================
--- branches/tmp/mpatelcz/SP1-md/libstorage/src/MdPartCo.h (original)
+++ branches/tmp/mpatelcz/SP1-md/libstorage/src/MdPartCo.h Tue Nov 3 12:16:22 2009
@@ -5,6 +5,7 @@
* Volume) like md126 which is a Container for partitions.
*
* Copyright (c) 2009, Intel Corporation.
+ * Copyright (c) 2009 Novell, Inc.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
@@ -125,7 +126,7 @@
static string undevName( const string& name );
string numToName( unsigned num ) const;
- static void getMdRaids( list<string>& l );
+ static list<string> getMdRaids();
/* RAID Related functionality */
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=59269&r1=59268&r2=59269&view=diff
==============================================================================
--- branches/tmp/mpatelcz/SP1-md/libstorage/src/Storage.cc (original)
+++ branches/tmp/mpatelcz/SP1-md/libstorage/src/Storage.cc Tue Nov 3 12:16:22 2009
@@ -396,11 +396,12 @@
}
}
-void Storage::dispatchMdDevs(list<string>& inList,
- list<string>& mdpList)
+
+list<string>
+Storage::dispatchMdDevs(const list<string>& inList) const
{
y2mil(" called ");
- mdpList.clear();
+ list<string> mdpList;
for( list<string>::const_iterator i=inList.begin(); i!=inList.end(); ++i )
{
y2mil(" Element: " << *i);
@@ -409,7 +410,7 @@
// 1. With Partition Table
// 2. Without Partition Table and without FS on it.
// 3. this gives: No FS.
- if( MdPartCo::hasFileSystem(*i) == false )
+ if (!MdPartCo::hasFileSystem(*i))
{
mdpList.push_back(*i);
}
@@ -423,11 +424,10 @@
}
}
}
- return;
+ return mdpList;
}
-
// Detect MD Partitionable Volumes.
void Storage::detectMdParts(ProcPart& ppart)
{
@@ -450,15 +450,10 @@
}
else
{
- list<string> l;
- list<string> mdpartlist;
- MdPartCo::getMdRaids(l);
- if (!l.empty())
- {
- mdpartlist.clear();
+ const list<string> l = MdPartCo::getMdRaids();
//map
participants (1)
-
aschnell@svn.opensuse.org