Author: aschnell Date: Sat Jul 26 17:07:09 2008 New Revision: 49433 URL: http://svn.opensuse.org/viewcvs/yast?rev=49433&view=rev Log: - make SystemCmd::quote easier to access Modified: trunk/storage/libstorage/src/Disk.cc trunk/storage/libstorage/src/Md.cc trunk/storage/libstorage/src/SystemCmd.h Modified: trunk/storage/libstorage/src/Disk.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/Disk.cc?rev=49433&r1=49432&r2=49433&view=diff ============================================================================== --- trunk/storage/libstorage/src/Disk.cc (original) +++ trunk/storage/libstorage/src/Disk.cc Sat Jul 26 17:07:09 2008 @@ -394,7 +394,7 @@ bool Disk::detectPartitions( ProcPart& ppart ) { bool ret = true; - string cmd_line = PARTEDCMD + SystemCmd::quote(device()) + " unit cyl print | sort -n"; + string cmd_line = PARTEDCMD + quote(device()) + " unit cyl print | sort -n"; string dlabel; system_stderr.erase(); y2milestone( "executing cmd:%s", cmd_line.c_str() ); @@ -1868,7 +1868,7 @@ removePresentPartitions(); system_stderr.erase(); std::ostringstream cmd_line; - cmd_line << PARTEDCMD << SystemCmd::quote(device()) << " mklabel " << label; + cmd_line << PARTEDCMD << quote(device()) << " mklabel " << label; if( execCheckFailed( cmd_line.str() ) ) { ret = DISK_SET_LABEL_PARTED_FAILED; @@ -1928,7 +1928,7 @@ void Disk::redetectGeometry() { - string cmd_line = PARTEDCMD + SystemCmd::quote(device()) + " unit cyl print"; + string cmd_line = PARTEDCMD + quote(device()) + " unit cyl print"; y2milestone( "executing cmd:%s", cmd_line.c_str() ); SystemCmd Cmd( cmd_line ); if( Cmd.select( "BIOS cylinder" )>0 ) @@ -1963,7 +1963,7 @@ } system_stderr.erase(); std::ostringstream cmd_line; - cmd_line << PARTEDCMD << SystemCmd::quote(device()) << " set " << p->nr() << " "; + cmd_line << PARTEDCMD << quote(device()) << " set " << p->nr() << " "; string start_cmd = cmd_line.str(); if( ret==0 ) { @@ -2044,7 +2044,7 @@ { ProcPart ppart; std::ostringstream cmd_line; - cmd_line << PARTEDCMD << SystemCmd::quote(device()) << " unit cyl print | grep -w \"^[ \t]*\"" << p->nr(); + cmd_line << PARTEDCMD << quote(device()) << " unit cyl print | grep -w \"^[ \t]*\"" << p->nr(); SystemCmd cmd( cmd_line.str() ); unsigned nr, id; unsigned long start, csize; @@ -2071,7 +2071,7 @@ } } cmd_line.str(""); - cmd_line << PARTEDCMD << SystemCmd::quote(device()) << " unit cyl print"; + cmd_line << PARTEDCMD << quote(device()) << " unit cyl print"; cmd.execute( cmd_line.str() ); } return( ret ); @@ -2091,7 +2091,7 @@ else { std::ostringstream cmd_line; - cmd_line << PARTEDCMD << SystemCmd::quote(device()) << " unit s print | grep -w \"^[ \t]*\"" << p->nr(); + cmd_line << PARTEDCMD << quote(device()) << " unit s print | grep -w \"^[ \t]*\"" << p->nr(); SystemCmd cmd( cmd_line.str() ); if( cmd.numLines()>0 ) { @@ -2117,7 +2117,7 @@ { string cmd_line( "yes Fix | " PARTEDBIN ); cmd_line += " ---pretend-input-tty "; - cmd_line += SystemCmd::quote(device()); + cmd_line += quote(device()); cmd_line += " print "; SystemCmd cmd( cmd_line ); gpt_enlarge = false; @@ -2159,7 +2159,7 @@ std::ostringstream cmd_line; if( ret==0 ) { - cmd_line << PARTEDCMD << SystemCmd::quote(device()) << " unit cyl mkpart "; + cmd_line << PARTEDCMD << quote(device()) << " unit cyl mkpart "; if( label != "sun" ) { switch( p->type() ) @@ -2343,7 +2343,7 @@ if( ret==0 && !p->created() ) { std::ostringstream cmd_line; - cmd_line << PARTEDCMD << SystemCmd::quote(device()) << " rm " << p->OrigNr(); + cmd_line << PARTEDCMD << quote(device()) << " rm " << p->OrigNr(); if( execCheckFailed( cmd_line.str() ) ) { ret = DISK_REMOVE_PARTITION_PARTED_FAILED; @@ -2526,7 +2526,7 @@ end_sect = max_end; y2mil( "new end_sect:" << end_sect ); } - cmd_line << "YAST_IS_RUNNING=1 " << PARTEDCMD << SystemCmd::quote(device()) + cmd_line << "YAST_IS_RUNNING=1 " << PARTEDCMD << quote(device()) << " unit s resize " << p->nr() << " " << start_sect << " " << end_sect; if( execCheckFailed( cmd_line.str() ) ) Modified: trunk/storage/libstorage/src/Md.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/Md.cc?rev=49433&r1=49432&r2=49433&view=diff ============================================================================== --- trunk/storage/libstorage/src/Md.cc (original) +++ trunk/storage/libstorage/src/Md.cc Sat Jul 26 17:07:09 2008 @@ -46,7 +46,7 @@ setNameDev(); getMajorMinor( dev, mjr, mnr ); } - SystemCmd c( "mdadm --detail " + SystemCmd::quote(device()) ); + SystemCmd c( "mdadm --detail " + quote(device()) ); c.select( "UUID : " ); string::size_type pos; if( c.retcode()==0 && c.numLines(true)>0 ) @@ -250,7 +250,7 @@ void Md::getState(MdStateInfo& info) const { - SystemCmd c("mdadm --detail " + SystemCmd::quote(device())); + SystemCmd c("mdadm --detail " + quote(device())); c.select("State : "); if( c.retcode()==0 && c.numLines(true)>0 ) @@ -309,8 +309,8 @@ string Md::createCmd() const { - string cmd = "ls -l --full-time " + SystemCmd::quote(devs) + " " + SystemCmd::quote(spare) + "; "; - cmd += "modprobe " + pName() + "; mdadm --create " + SystemCmd::quote(device()) + + string cmd = "ls -l --full-time " + quote(devs) + " " + quote(spare) + "; "; + cmd += "modprobe " + pName() + "; mdadm --create " + quote(device()) + " --run --level=" + pName() + " -e 1.0"; if (pName() == "raid1" || pName() == "raid5" || pName() == "raid6" || pName() == "raid10") @@ -322,7 +322,7 @@ cmd += " --raid-devices=" + decString(devs.size()); if( !spare.empty() ) cmd += " --spare-devices=" + decString(spare.size()); - cmd += " " + SystemCmd::quote(devs) + " " + SystemCmd::quote(spare); + cmd += " " + quote(devs) + " " + quote(spare); y2milestone( "ret:%s", cmd.c_str() ); return( cmd ); } Modified: trunk/storage/libstorage/src/SystemCmd.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/SystemCmd.h?rev=49433&r1=49432&r2=49433&view=diff ============================================================================== --- trunk/storage/libstorage/src/SystemCmd.h (original) +++ trunk/storage/libstorage/src/SystemCmd.h Sat Jul 26 17:07:09 2008 @@ -103,6 +103,17 @@ static int Nr_i; }; + + inline string quote(const string& str) + { + return SystemCmd::quote(str); + } + + inline string quote(const std::list<string>& strs) + { + return SystemCmd::quote(strs); + } + } #endif -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org