Hello community, here is the log from the commit of package libstorage for openSUSE:Factory checked in at 2014-07-27 08:25:45 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/libstorage (Old) and /work/SRC/openSUSE:Factory/.libstorage.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libstorage" Changes: -------- --- /work/SRC/openSUSE:Factory/libstorage/libstorage.changes 2014-06-18 10:59:36.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.libstorage.new/libstorage.changes 2014-07-27 08:25:54.000000000 +0200 @@ -1,0 +2,22 @@ +Mon Jul 21 13:47:50 CEST 2014 - [email protected] + +- ignore default subvolume during subvolume detection (bnc#882982) +- fixed encryption detection (see bnc#888128) + +------------------------------------------------------------------- +Wed Jul 16 16:56:07 CEST 2014 - [email protected] + +- fixed check for parted errors (see bnc#886005) + +------------------------------------------------------------------- +Wed Jul 09 10:28:06 CEST 2014 - [email protected] + +- call tune2fs when changing data mode for ext3 and ext4 root + filesystem (bnc#886240) + +------------------------------------------------------------------- +Wed Jul 07 13:31:30 CEST 2014 - [email protected] + +- configure{,.ac} uses python2-config to find python headers, libs + +------------------------------------------------------------------- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libstorage-2.25.14.tar.bz2 ++++++ ++++ 1922 lines of diff (skipped) ++++ retrying with extended exclude list diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libstorage-2.25.14/bindings/python/Makefile.am new/libstorage-2.25.14/bindings/python/Makefile.am --- old/libstorage-2.25.14/bindings/python/Makefile.am 2014-06-11 14:18:39.000000000 +0200 +++ new/libstorage-2.25.14/bindings/python/Makefile.am 2014-07-17 11:00:53.000000000 +0200 @@ -8,9 +8,7 @@ AM_CXXFLAGS = -fPIC -DPIC -PYLIBVER ?= python$(PYTHON_VERSION) - -INCLUDES = -I. -I${top_srcdir} -I/usr/include/$(PYLIBVER) +INCLUDES = -I. -I${top_srcdir} -I${PYTHON_INCLUDES} DEPENDENCIES = \ ${top_srcdir}/storage/StorageInterface.h \ @@ -18,7 +16,7 @@ ${top_srcdir}/storage/Graph.h \ ./enum_ref.i -LIBS = $(top_builddir)/storage/libstorage.la +LIBS = $(top_builddir)/storage/libstorage.la ${PYTHON_LIBS} python_PYTHON = libstorage.py diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libstorage-2.25.14/bindings/python/examples/probing.py new/libstorage-2.25.14/bindings/python/examples/probing.py --- old/libstorage-2.25.14/bindings/python/examples/probing.py 2014-06-11 14:18:39.000000000 +0200 +++ new/libstorage-2.25.14/bindings/python/examples/probing.py 2014-07-17 11:00:53.000000000 +0200 @@ -8,7 +8,7 @@ c = libstorage.createStorageInterface(env) -containers = libstorage.dequecontainerinfo() +containers = libstorage.DequeContainerInfo() c.getContainers(containers) for container in containers: @@ -22,7 +22,7 @@ print " Size:", libstorage.byteToHumanString(1024 * diskinfo.sizeK, True, 2, False) print " Cylinder Size:", libstorage.byteToHumanString(diskinfo.cylSize, True, 2, False) - partitioninfos = libstorage.dequepartitioninfo() + partitioninfos = libstorage.DequePartitionInfo() c.getPartitionInfo(container.name, partitioninfos) for partitioninfo in partitioninfos: @@ -46,12 +46,12 @@ print " Size:", libstorage.byteToHumanString(1024 * lvmvginfo.sizeK, True, 2, False) print " PE Size:", libstorage.byteToHumanString(1024 * lvmvginfo.peSizeK, True, 2, True) - lvmlvinfos = libstorage.dequelvmlvinfo() + lvmlvinfos = libstorage.DequeLvmLvInfo() c.getLvmLvInfo(container.name, lvmlvinfos) for lvmlvinfo in lvmlvinfos: print " Device:", lvmlvinfo.v.device - print " Size:", libstorage.byteToHumanString(1024 * lvmlvinfo.sizeK, True, 2, False) + print " Size:", libstorage.byteToHumanString(1024 * lvmlvinfo.v.sizeK, True, 2, False) print " Stripes:", lvmlvinfo.stripes if lvmlvinfo.stripes > 1: print " Stripe Size:", libstorage.byteToHumanString(1024 * lvmlvinfo.stripeSizeK, True, 2, True) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libstorage-2.25.14/configure.ac new/libstorage-2.25.14/configure.ac --- old/libstorage-2.25.14/configure.ac 2014-06-11 14:18:39.000000000 +0200 +++ new/libstorage-2.25.14/configure.ac 2014-07-17 11:00:53.000000000 +0200 @@ -29,8 +29,14 @@ dnl Disable it by "configure --disable-silent-rules" or "make V=1" m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) -CFLAGS="${CFLAGS} -Wall -Wformat=2 -Wmissing-prototypes" -CXXFLAGS="${CXXFLAGS} -std=c++0x -DHAVE_CXX0X -Wall -Wextra -Wformat=2 -Wnon-virtual-dtor -Wno-unused-parameter" +PYTHON_CONFIG=${PYTHON_CONFIG:-python2-config} +PYTHON_INCLUDES=$($PYTHON_CONFIG --includes) +PYTHON_LIBS=$($PYTHON_CONFIG --libs) + +CWARNS="-Wall -Wformat=2 -Wmissing-prototypes" +CFLAGS="${CFLAGS} ${CXXWARNS}" +CXXWARNS="-Wall -Wextra -Wformat=2 -Wnon-virtual-dtor -Wno-unused-parameter" +CXXFLAGS="${CXXFLAGS} -std=c++0x -DHAVE_CXX0X ${CXXWARNS}" docdir=\${prefix}/share/doc/packages/libstorage fillupdir=/var/adm/fillup-templates @@ -41,6 +47,8 @@ AC_SUBST(LIBVERSION_MINOR) AC_SUBST(LIBVERSION_PATCHLEVEL) AC_SUBST(LIBVERSION_INFO) +AC_SUBST(PYTHON_INCLUDES) +AC_SUBST(PYTHON_LIBS) AC_SUBST(docdir) AC_SUBST(fillupdir) @@ -49,26 +57,28 @@ AC_MSG_ERROR(ruby is missing; please install ruby) fi +AC_DEFUN([RBCONFIG], [$RUBY -rrbconfig -e 'puts RbConfig::CONFIG[["$1"]]']) + RUBY_VERSION=`$RUBY -e "puts RUBY_VERSION"` AC_SUBST(RUBY_VERSION) -RUBY_BIN_DIR=`$RUBY -rrbconfig -e 'puts Config::CONFIG[["bindir"]]'` +RUBY_BIN_DIR=$(RBCONFIG(bindir)) AC_SUBST(RUBY_BIN_DIR) -RUBY_INCLUDE_DIR=`$RUBY -rrbconfig -e 'puts Config::CONFIG[["rubyhdrdir"]]'` +RUBY_INCLUDE_DIR=$(RBCONFIG(rubyhdrdir)) if test "$RUBY_INCLUDE_DIR" = "nil" ; then - RUBY_INCLUDE_DIR=`$RUBY -rrbconfig -e 'puts Config::CONFIG[["archdir"]]'` + RUBY_INCLUDE_DIR=$(RBCONFIG(archdir)) fi AC_SUBST(RUBY_INCLUDE_DIR) -RUBY_LIB_DIR=`$RUBY -rrbconfig -e 'puts Config::CONFIG[["libdir"]]'` +RUBY_LIB_DIR=$(RBCONFIG(libdir)) AC_SUBST(RUBY_LIB_DIR) -RUBY_EXTENSION_DIR=`$RUBY -rrbconfig -e 'puts Config::CONFIG[["vendorarchdir"]]'` +RUBY_EXTENSION_DIR=$(RBCONFIG(vendorarchdir)) AC_SUBST(RUBY_EXTENSION_DIR) -RUBY_VENDOR_DIR=`$RUBY -rrbconfig -e 'puts Config::CONFIG[["vendordir"]]'` +RUBY_VENDOR_DIR=$(RBCONFIG(vendordir)) AC_SUBST(RUBY_VENDOR_DIR) -RUBY_SO_NAME=`$RUBY -rrbconfig -e 'puts Config::CONFIG[["RUBY_SO_NAME"]]'` +RUBY_SO_NAME=$(RBCONFIG(RUBY_SO_NAME)) AC_SUBST(RUBY_SO_NAME) -RUBY_SHARED_LIB=`$RUBY -rrbconfig -e 'puts Config::CONFIG[["LIBRUBY"]]'` +RUBY_SHARED_LIB=$(RBCONFIG(LIBRUBY)) AC_SUBST(RUBY_SHARED_LIB) -RUBY_ARCH_NAME=`$RUBY -rrbconfig -e 'puts Config::CONFIG[["arch"]]'` +RUBY_ARCH_NAME=$(RBCONFIG(arch)) AC_SUBST(RUBY_ARCH_NAME) AC_OUTPUT( diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libstorage-2.25.14/storage/AsciiFile.cc new/libstorage-2.25.14/storage/AsciiFile.cc --- old/libstorage-2.25.14/storage/AsciiFile.cc 2014-06-11 14:18:39.000000000 +0200 +++ new/libstorage-2.25.14/storage/AsciiFile.cc 2014-07-14 21:06:43.000000000 +0200 @@ -62,7 +62,7 @@ y2mil("loading file " << Name_C); clear(); - ifstream File_Ci(Name_C.c_str()); + ifstream File_Ci(Name_C); classic(File_Ci); string Line_Ci; @@ -100,7 +100,7 @@ { y2mil("saving file " << Name_C); - ofstream file( Name_C.c_str() ); + ofstream file(Name_C); classic(file); for (vector<string>::const_iterator it = Lines_C.begin(); it != Lines_C.end(); ++it) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libstorage-2.25.14/storage/Btrfs.cc new/libstorage-2.25.14/storage/Btrfs.cc --- old/libstorage-2.25.14/storage/Btrfs.cc 2014-06-11 14:18:39.000000000 +0200 +++ new/libstorage-2.25.14/storage/Btrfs.cc 2014-07-21 15:21:12.000000000 +0200 @@ -84,13 +84,13 @@ l = getChildNodes(node, "subvolumes"); for (list<const xmlNode*>::const_iterator it=l.begin(); it!=l.end(); ++it ) { - subvol.push_back(Subvolume(*it)); + subvolumes.push_back(Subvolume(*it)); } } -Btrfs::Btrfs(const BtrfsCo& c, const Btrfs& v) : Volume(c, v), - devices(v.devices), subvol(v.subvol) + Btrfs::Btrfs(const BtrfsCo& c, const Btrfs& v) + : Volume(c, v), devices(v.devices), subvolumes(v.subvolumes) { y2deb("copy-constructed Btrfs from " << v.dev); } @@ -131,11 +131,13 @@ y2mil( "devs:" << devs ); } -void Btrfs::detectSubvol() + + void + Btrfs::detectSubvolumes() { y2mil( "dev:" << device() ); if( getFormat() ) - clearSubvol(); + clearSubvolumes(); else { bool mounted = false; @@ -144,31 +146,35 @@ mounted = true; if( !mp.empty() ) { - clearSubvol(); - SystemCmd cmd(BTRFSBIN " subvolume list -a " + quote(mp)); - for( vector<string>::const_iterator s=cmd.stdout().begin(); - s!=cmd.stdout().end(); ++s ) + clearSubvolumes(); + SystemCmd cmd(BTRFSBIN " subvolume list -a -p " + quote(mp)); + for (const string& line : cmd.stdout()) { - string level; - string::size_type pos1 = s->find(" level "); + string parent; + string::size_type pos1 = line.find(" parent "); if (pos1 != string::npos) - pos1 = s->find_first_not_of(app_ws, pos1 + 6); + pos1 = line.find_first_not_of(app_ws, pos1 + 6); if (pos1 != string::npos) - level = s->substr(pos1, s->find_last_not_of(app_ws)); + parent = line.substr(pos1, line.find_last_not_of(app_ws)); - string subvol; - string::size_type pos2 = s->find(" path "); + string subvolume; + string::size_type pos2 = line.find(" path "); if (pos2 != string::npos) - pos2 = s->find_first_not_of(app_ws, pos2 + 5); + pos2 = line.find_first_not_of(app_ws, pos2 + 5); if (pos2 != string::npos) - subvol = s->substr(pos2, s->find_last_not_of(app_ws)); - if (boost::starts_with(subvol, "<FS_TREE>/")) - subvol.erase(0, 10); + subvolume = line.substr(pos2, line.find_last_not_of(app_ws)); + if (boost::starts_with(subvolume, "<FS_TREE>/")) + subvolume.erase(0, 10); - // Subvolume can already be deleted, in which case level is "0" + if (subvolume == getStorage()->getDefaultSubvolName()) + continue; + + // Subvolume can already be deleted, in which case parent is "0" // (and path "DELETED"). That is a temporary state. - if (level != "0" && !subvol.empty()) - addSubvol(subvol); + if (parent == "0" || subvolume.empty()) + continue; + + addSubvolume(subvolume); } } if( mounted ) @@ -178,26 +184,29 @@ rmdir( mp.c_str() ); } } - y2mil( "ret dev:" << device() << " subvol:" << subvol ); + y2mil("ret dev:" << device() << " subvolumes:" << subvolumes); } -void Btrfs::addSubvol( const string& path ) + + void + Btrfs::addSubvolume(const string& path) { y2mil( "path:\"" << path << "\"" ); Subvolume v( path ); - if( !contains( subvol, v )) - subvol.push_back( v ); + if (!contains(subvolumes, v)) + subvolumes.push_back( v ); else y2war( "subvolume " << v << " already exists!" ); } + bool Btrfs::existSubvolume( const string& name ) { bool ret=false; y2mil( "name:" << name ); - list<Subvolume>::iterator i=subvol.begin(); - while( i!=subvol.end() && !ret ) + list<Subvolume>::iterator i=subvolumes.begin(); + while( i!=subvolumes.end() && !ret ) { ret = !i->deleted() && i->path()==name && (!getFormat()||i->created()); if( !ret ) @@ -212,14 +221,14 @@ { int ret=0; y2mil( "name:" << name ); - list<Subvolume>::iterator i=subvol.begin(); - while( i!=subvol.end() && !i->deleted() && i->path()!=name ) + list<Subvolume>::iterator i=subvolumes.begin(); + while( i!=subvolumes.end() && !i->deleted() && i->path()!=name ) ++i; - if( i==subvol.end() ) + if( i==subvolumes.end() ) { Subvolume v( name ); v.setCreated(); - subvol.push_back( v ); + subvolumes.push_back( v ); } else if( getFormat() ) { @@ -236,13 +245,13 @@ { int ret=0; y2mil( "name:" << name ); - list<Subvolume>::iterator i=subvol.begin(); - while( i!=subvol.end() && i->path()!=name ) + list<Subvolume>::iterator i=subvolumes.begin(); + while( i!=subvolumes.end() && i->path()!=name ) ++i; - if( i!=subvol.end() ) + if( i!=subvolumes.end() ) { if( i->created() ) - subvol.erase(i); + subvolumes.erase(i); else i->setDeleted(); } @@ -442,7 +451,7 @@ { SystemCmd c; string cmd = BTRFSBIN " subvolume delete "; - for( list<Subvolume>::iterator i=subvol.begin(); i!=subvol.end(); ++i ) + for( list<Subvolume>::iterator i=subvolumes.begin(); i!=subvolumes.end(); ++i ) { if( i->deleted() ) { @@ -472,7 +481,7 @@ { SystemCmd c; string cmd = BTRFSBIN " subvolume create "; - for( list<Subvolume>::iterator i=subvol.begin(); i!=subvol.end(); ++i ) + for( list<Subvolume>::iterator i=subvolumes.begin(); i!=subvolumes.end(); ++i ) { if( i->created() ) { @@ -506,7 +515,7 @@ list<string> Btrfs::getSubvolAddDel( bool add ) const { list<string> ret; - for (list<Subvolume>::const_iterator i = subvol.begin(); i != subvol.end(); ++i) + for (list<Subvolume>::const_iterator i = subvolumes.begin(); i != subvolumes.end(); ++i) { if( !add && i->deleted() ) ret.push_back(i->path()); @@ -522,8 +531,8 @@ Btrfs::countSubvolAddDel( unsigned& add, unsigned& del ) const { add = del = 0; - for( list<Subvolume>::const_iterator i=subvol.begin(); - i!=subvol.end(); ++i ) + for( list<Subvolume>::const_iterator i=subvolumes.begin(); + i!=subvolumes.end(); ++i ) { if( i->deleted() ) del++; @@ -538,8 +547,8 @@ Btrfs::subvolNames( bool added ) const { string ret; - for( list<Subvolume>::const_iterator i=subvol.begin(); - i!=subvol.end(); ++i ) + for( list<Subvolume>::const_iterator i=subvolumes.begin(); + i!=subvolumes.end(); ++i ) { if( (added && i->created()) || (!added && i->deleted())) @@ -562,7 +571,7 @@ { if( val ) uuid = co()->fakeUuid(); - detectSubvol(); + detectSubvolumes(); getStorage()->setBtrfsUsedBy( this ); } y2mil("device:" << *this ); @@ -769,7 +778,7 @@ { string def_subvol = getStorage()->getDefaultSubvolName(); - for (list<Subvolume>::const_iterator it = subvol.begin(); it != subvol.end(); ++it) + for (list<Subvolume>::const_iterator it = subvolumes.begin(); it != subvolumes.end(); ++it) { string path = it->path(); if (!def_subvol.empty() && boost::starts_with(it->path(), def_subvol + "/")) @@ -795,7 +804,7 @@ { string def_subvol = getStorage()->getDefaultSubvolName(); - for (list<Subvolume>::const_iterator it = subvol.begin(); it != subvol.end(); ++it) + for (list<Subvolume>::const_iterator it = subvolumes.begin(); it != subvolumes.end(); ++it) { string path = it->path(); if (!def_subvol.empty() && boost::starts_with(it->path(), def_subvol + "/")) @@ -823,7 +832,7 @@ { string def_subvol = getStorage()->getDefaultSubvolName(); - for (list<Subvolume>::const_iterator it = subvol.begin(); it != subvol.end(); ++it) + for (list<Subvolume>::const_iterator it = subvolumes.begin(); it != subvolumes.end(); ++it) { string path = it->path(); if (!def_subvol.empty() && boost::starts_with(it->path(), def_subvol + "/")) @@ -931,7 +940,7 @@ info.subvol.clear(); info.subvol_add.clear(); info.subvol_rem.clear(); - for (list<Subvolume>::const_iterator it = subvol.begin(); it != subvol.end(); ++it) + for (list<Subvolume>::const_iterator it = subvolumes.begin(); it != subvolumes.end(); ++it) { if (it->deleted()) info.subvol_rem.push_back(it->path()); @@ -950,17 +959,17 @@ s << " dev_add:" << v.dev_add; if( !v.dev_rem.empty() ) s << " dev_rem:" << v.dev_rem; - if( !v.subvol.empty() ) - s << " subvol:" << v.subvol; + if (!v.subvolumes.empty()) + s << " subvolumes:" << v.subvolumes; return( s ); } bool Btrfs::equalContent( const Btrfs& rhs ) const { - return( Volume::equalContent(rhs) && devices==rhs.devices && + return Volume::equalContent(rhs) && devices==rhs.devices && dev_add==rhs.dev_add && dev_rem==rhs.dev_rem && - subvol==rhs.subvol ); + subvolumes == rhs.subvolumes; } @@ -999,15 +1008,15 @@ log << " DevRem:" << tmp; tmp.erase(); - for (list<Subvolume>::const_iterator s = subvol.begin(); s != subvol.end(); ++s) + for (const Subvolume& subvolume : subvolumes) { - if( s->deleted() ) - tmp += "<--" + s->path(); - else if( s->created() ) - tmp += s->path() + "-->"; + if (subvolume.deleted()) + tmp += "<--" + subvolume.path(); + else if (subvolume.created()) + tmp += subvolume.path() + "-->"; } if (!tmp.empty()) - log << " SubVol:" << tmp; + log << " Subvolumes:" << tmp; } @@ -1020,7 +1029,7 @@ setChildValueIf(node, "dev_add", dev_add, !dev_add.empty()); setChildValueIf(node, "dev_rem", dev_rem, !dev_rem.empty()); - setChildValueIf(node, "subvolume", subvol, !subvol.empty()); + setChildValueIf(node, "subvolumes", subvolumes, !subvolumes.empty()); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libstorage-2.25.14/storage/Btrfs.h new/libstorage-2.25.14/storage/Btrfs.h --- old/libstorage-2.25.14/storage/Btrfs.h 2014-06-11 14:18:39.000000000 +0200 +++ new/libstorage-2.25.14/storage/Btrfs.h 2014-07-21 15:21:12.000000000 +0200 @@ -42,12 +42,12 @@ Btrfs( const BtrfsCo& c, const Btrfs& v); virtual ~Btrfs(); - void clearSubvol() { subvol.clear(); } - void addSubvol( const string& path ); - void detectSubvol(); + void clearSubvolumes() { subvolumes.clear(); } + void addSubvolume(const string& path); + void detectSubvolumes(); list<string> getDevices( bool add_del=false ) const; void getDevices( list<string>& devs, bool add_del=false ) const; - void getSubvolumes( list<Subvolume>& sv ) const { sv = subvol; } + list<Subvolume> getSubvolumes() const { return subvolumes; } bool existSubvolume( const string& name ); int createSubvolume( const string& name ); @@ -100,7 +100,7 @@ list<string> devices; list<string> dev_add; list<string> dev_rem; - list<Subvolume> subvol; + list<Subvolume> subvolumes; Volume const * findRealVolume() const; virtual int extraFstabAdd(EtcFstab* fstab, const FstabChange& change) override; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libstorage-2.25.14/storage/BtrfsCo.cc new/libstorage-2.25.14/storage/BtrfsCo.cc --- old/libstorage-2.25.14/storage/BtrfsCo.cc 2014-06-11 14:18:39.000000000 +0200 +++ new/libstorage-2.25.14/storage/BtrfsCo.cc 2014-07-21 15:21:12.000000000 +0200 @@ -150,7 +150,7 @@ } BtrfsPair p( btrfsPair() ); for( BtrfsIter i=p.begin(); i!=p.end(); ++i ) - i->detectSubvol(); + i->detectSubvolumes(); y2mil("end"); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libstorage-2.25.14/storage/Disk.cc new/libstorage-2.25.14/storage/Disk.cc --- old/libstorage-2.25.14/storage/Disk.cc 2014-06-11 14:18:39.000000000 +0200 +++ new/libstorage-2.25.14/storage/Disk.cc 2014-07-16 17:36:34.000000000 +0200 @@ -409,59 +409,69 @@ } -int -Disk::checkSystemError( const string& cmd_line, const SystemCmd& cmd ) const + int + Disk::checkSystemError(const string& cmd_line, const SystemCmd& cmd) const { - string tmp = boost::join(cmd.stderr(), "\n"); - if (!tmp.empty()) + string tmp_out = boost::join(cmd.stdout(), "\n"); + if (!tmp_out.empty()) { - y2err("cmd:" << cmd_line); - y2err("err:" << tmp); + y2mil("cmd:" << cmd_line); + y2mil("out:" << tmp_out); } - tmp = boost::join(cmd.stdout(), "\n"); - if (!tmp.empty()) + + string tmp_err = boost::join(cmd.stderr(), "\n"); + if (!tmp_err.empty()) { - y2mil("cmd:" << cmd_line); - y2mil("out:" << tmp); + y2err("cmd:" << cmd_line); + y2err("err:" << tmp_err); } - int ret = cmd.retcode(); - if( ret!=0 && tmp.find( "kernel failed to re-read" )!=string::npos ) + + int ret = cmd.retcode(); + + if (ret != 0 && boost::contains(tmp_err, "kernel failed to re-read")) { - y2mil( "resetting retcode cmd " << ret << " of:" << cmd_line ); - ret = 0; + y2mil("resetting retcode cmd " << ret << " of:" << cmd_line); + ret = 0; } - if( ret!=0 && tmp.find( "Error informing the kernel about modifications" )!=string::npos ) + if (ret != 0 && boost::contains(tmp_err, "Error informing the kernel about modifications")) { - y2mil( "resetting retcode cmd " << ret << " of:" << cmd_line ); - ret = 0; + y2mil("resetting retcode cmd " << ret << " of:" << cmd_line); + ret = 0; } - if( ret != 0 ) + + if (ret != 0) { - if( dmp_slave && tmp.empty() ) + if (dmp_slave && tmp_err.empty()) { - y2mil( "resetting retcode " << ret << " of:" << cmd_line ); - ret = 0; + y2mil( "resetting retcode " << ret << " of:" << cmd_line ); + ret = 0; } - else - y2err("retcode:" << cmd.retcode()); - } - return( ret ); + else + { + y2err("retcode:" << cmd.retcode()); + } + } + + return ret; } -int -Disk::execCheckFailed( const string& cmd_line ) + + int + Disk::execCheckFailed(const string& cmd_line) { - static SystemCmd cmd; - return( execCheckFailed( cmd, cmd_line ) ); + static SystemCmd cmd; + return execCheckFailed(cmd, cmd_line); } -int Disk::execCheckFailed( SystemCmd& cmd, const string& cmd_line ) + + int + Disk::execCheckFailed(SystemCmd& cmd, const string& cmd_line) { - cmd.execute( cmd_line ); - int ret = checkSystemError( cmd_line, cmd ); - if( ret!=0 ) - setExtError( cmd ); - return( ret ); + cmd.execute(cmd_line); + int ret = checkSystemError(cmd_line, cmd); + if (ret != 0) + setExtError(cmd); + return ret; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libstorage-2.25.14/storage/EtcFstab.cc new/libstorage-2.25.14/storage/EtcFstab.cc --- old/libstorage-2.25.14/storage/EtcFstab.cc 2014-06-11 14:18:39.000000000 +0200 +++ new/libstorage-2.25.14/storage/EtcFstab.cc 2014-07-14 21:06:43.000000000 +0200 @@ -38,6 +38,20 @@ using namespace std; + string + getExtDataMode(const string& fstab_options) + { + list<string> tmp = splitString(fstab_options, ","); + + list<string>::const_iterator it = find_if(tmp.begin(), tmp.end(), + string_starts_with("data=")); + if (it == tmp.end()) + return "ordered"; + + return it->substr(5); + } + + EtcFstab::EtcFstab(const string& prefix, bool rootMounted) : prefix(prefix) { @@ -61,7 +75,7 @@ y2mil("entries:" << co.size()); string file = prefix+"/fstab"; - ifstream mounts( file.c_str() ); + ifstream mounts(file); classic(mounts); string line; getline( mounts, line ); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libstorage-2.25.14/storage/EtcFstab.h new/libstorage-2.25.14/storage/EtcFstab.h --- old/libstorage-2.25.14/storage/EtcFstab.h 2014-06-11 14:18:39.000000000 +0200 +++ new/libstorage-2.25.14/storage/EtcFstab.h 2014-07-09 11:25:49.000000000 +0200 @@ -43,6 +43,13 @@ /* + * Get data mode ("journal", "ordered" or "writeback") for ext filesystems + * from fstab mount options. + */ + string getExtDataMode(const string& fstab_options); + + + /* * Unique key to identify entries in fstab. */ struct FstabKey diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libstorage-2.25.14/storage/Graph.cc new/libstorage-2.25.14/storage/Graph.cc --- old/libstorage-2.25.14/storage/Graph.cc 2014-06-11 14:18:39.000000000 +0200 +++ new/libstorage-2.25.14/storage/Graph.cc 2014-07-14 21:06:43.000000000 +0200 @@ -560,7 +560,7 @@ bool Graph::save(const string& filename) const { - ofstream out(filename.c_str()); + ofstream out(filename); classic(out); out << "// generated by libstorage version " VERSION << endl; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libstorage-2.25.14/storage/LvmVg.cc new/libstorage-2.25.14/storage/LvmVg.cc --- old/libstorage-2.25.14/storage/LvmVg.cc 2014-06-11 14:18:39.000000000 +0200 +++ new/libstorage-2.25.14/storage/LvmVg.cc 2014-07-15 09:46:13.000000000 +0200 @@ -1687,7 +1687,7 @@ if( !orig || !orig->isThin() ) cmd += " -l " + decString(l->getLe()); if( l->chunkSize()>0 ) - cmd += " --chunksize " + l->chunkSize(); + cmd += " --chunksize " + decString(l->chunkSize()); cmd += " --snapshot"; cmd += " --name " + quote(l->name()); cmd += " " + quote(name() + "/" + l->getOrigin()); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libstorage-2.25.14/storage/Partition.cc new/libstorage-2.25.14/storage/Partition.cc --- old/libstorage-2.25.14/storage/Partition.cc 2014-06-11 14:18:39.000000000 +0200 +++ new/libstorage-2.25.14/storage/Partition.cc 2014-07-16 17:36:34.000000000 +0200 @@ -387,16 +387,18 @@ bool zero_new = getContainer()->getStorage()->getZeroNewPartitions(); bool used_as_pv = isUsedBy(UB_LVM); - bool prep = ( id() == ID_PPC_PREP || id() == ID_GPT_PREP ); + bool prep = id() == ID_PPC_PREP || id() == ID_GPT_PREP; y2mil("zero_new:" << zero_new << " used_as_pv:" << used_as_pv << " prep:" << prep); - if (prep) { - ret = getContainer()->getStorage()->zeroDevice(device(), false, size_k); - } else { - if (zero_new || used_as_pv) - ret = getContainer()->getStorage()->zeroDevice(device()); - } + if (prep) + { + ret = getContainer()->getStorage()->zeroDevice(device(), false, size_k); + } + else if (zero_new || used_as_pv) + { + ret = getContainer()->getStorage()->zeroDevice(device()); + } return ret; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libstorage-2.25.14/storage/Storage.h new/libstorage-2.25.14/storage/Storage.h --- old/libstorage-2.25.14/storage/Storage.h 2014-06-11 14:18:39.000000000 +0200 +++ new/libstorage-2.25.14/storage/Storage.h 2014-07-14 21:06:43.000000000 +0200 @@ -195,7 +195,7 @@ class EtcFstab; class EtcMdadm; -class DiskData; +struct DiskData; /** diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libstorage-2.25.14/storage/StorageTmpl.h new/libstorage-2.25.14/storage/StorageTmpl.h --- old/libstorage-2.25.14/storage/StorageTmpl.h 2014-06-11 14:18:39.000000000 +0200 +++ new/libstorage-2.25.14/storage/StorageTmpl.h 2014-07-14 21:06:43.000000000 +0200 @@ -277,7 +277,7 @@ bool read_sysfs_property(const string& path, Type& value, bool log_error = true) { - std::ifstream file(path.c_str()); + std::ifstream file(path); classic(file); file >> value; file.close(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libstorage-2.25.14/storage/SystemInfo/CmdCryptsetup.cc new/libstorage-2.25.14/storage/SystemInfo/CmdCryptsetup.cc --- old/libstorage-2.25.14/storage/SystemInfo/CmdCryptsetup.cc 2014-06-11 14:18:39.000000000 +0200 +++ new/libstorage-2.25.14/storage/SystemInfo/CmdCryptsetup.cc 2014-07-21 15:37:35.000000000 +0200 @@ -52,17 +52,19 @@ void CmdCryptsetup::parse(const vector<string>& lines) { - string cipher, keysize; + string type, cipher, keysize; for (const string& line : lines) { string key = extractNthWord(0, line); - if (key == "cipher:") + if (key == "type:") + type = extractNthWord(1, line); + else if (key == "cipher:") cipher = extractNthWord(1, line); else if(key == "keysize:") keysize = extractNthWord(1, line); } - if (cipher == "aes-cbc-essiv:sha256" || cipher == "aes-cbc-plain") + if (type == "LUKS1") encrypt_type = ENC_LUKS; else if (cipher == "twofish-cbc-plain") encrypt_type = ENC_TWOFISH; @@ -73,7 +75,8 @@ else { encrypt_type = ENC_UNKNOWN; - y2err("unknown encryption cipher:" << cipher << " keysize:" << keysize); + y2err("unknown encryption type:" << type << " cipher:" << cipher << " keysize:" << + keysize); } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libstorage-2.25.14/storage/Volume.cc new/libstorage-2.25.14/storage/Volume.cc --- old/libstorage-2.25.14/storage/Volume.cc 2014-06-11 14:58:30.000000000 +0200 +++ new/libstorage-2.25.14/storage/Volume.cc 2014-07-14 21:06:43.000000000 +0200 @@ -824,49 +824,41 @@ Text Volume::formatText( bool doing ) const { Text txt; - if( doing ) - { - // displayed text during action, %1$s is replaced by device name e.g. /dev/hda1 + if (doing) + { + // displayed during action + // %1$s is replaced by device name e.g. /dev/hda1 // %2$s is replaced by size (e.g. 623.5 MB) // %3$s is replaced by file system type (e.g. reiserfs) - txt = sformat(_("Formatting device %1$s (%2$s) with %3$s"), dev.c_str(), - sizeString().c_str(), fsTypeString().c_str()); - } + txt = _("Formatting device %1$s (%2$s) with %3$s"); + } + else if (mp.empty()) + { + // displayed before action + // %1$s is replaced by device name e.g. /dev/hda1 + // %2$s is replaced by size (e.g. 623.5 MB) + // %3$s is replaced by file system type (e.g. reiserfs) + txt = _("Format device %1$s (%2$s) with %3$s"); + } + else if (encryption == ENC_NONE) + { + // displayed before action + // %1$s is replaced by device name e.g. /dev/hda1 + // %2$s is replaced by size (e.g. 623.5 MB) + // %3$s is replaced by file system type (e.g. reiserfs) + // %4$s is replaced by mount point (e.g. /usr) + txt = _("Format device %1$s (%2$s) for %4$s with %3$s"); + } else - { - if( !mp.empty() ) - { - if( encryption==ENC_NONE ) - { - // displayed text before action, %1$s is replaced by device name e.g. /dev/hda1 - // %2$s is replaced by size (e.g. 623.5 MB) - // %3$s is replaced by file system type (e.g. reiserfs) - // %4$s is replaced by mount point (e.g. /usr) - txt = sformat(_("Format device %1$s (%2$s) for %4$s with %3$s"), - dev.c_str(), sizeString().c_str(), fsTypeString().c_str(), - mp.c_str()); - } - else - { - // displayed text before action, %1$s is replaced by device name e.g. /dev/hda1 - // %2$s is replaced by size (e.g. 623.5 MB) - // %3$s is replaced by file system type (e.g. reiserfs) - // %4$s is replaced by mount point (e.g. /usr) - txt = sformat(_("Format encrypted device %1$s (%2$s) for %4$s with %3$s"), - dev.c_str(), sizeString().c_str(), fsTypeString().c_str(), - mp.c_str()); - } - } - else - { - // displayed text before action, %1$s is replaced by device name e.g. /dev/hda1 - // %2$s is replaced by size (e.g. 623.5 MB) - // %3$s is replaced by file system type (e.g. reiserfs) - txt = sformat(_("Format device %1$s (%2$s) with %3$s"), - dev.c_str(), sizeString().c_str(), fsTypeString().c_str()); - } - } - return( txt ); + { + // displayed before action + // %1$s is replaced by device name e.g. /dev/hda1 + // %2$s is replaced by size (e.g. 623.5 MB) + // %3$s is replaced by file system type (e.g. reiserfs) + // %4$s is replaced by mount point (e.g. /usr) + txt = _("Format encrypted device %1$s (%2$s) for %4$s with %3$s"); + } + return sformat(txt, dev.c_str(), sizeString().c_str(), fsTypeString().c_str(), mp.c_str()); } static string handle_O_Features( const string& opts ) @@ -1011,6 +1003,7 @@ alt_names.push_back("/dev/disk/by-uuid/" + uuid); } + int Volume::doFormat() { static int fcount=1000; @@ -1139,19 +1132,11 @@ ret = VOLUME_TUNE2FS_FAILED; } - if( ret==0 && mp=="/" && - (fstab_opt.find( "data=writeback" )!=string::npos || - fstab_opt.find( "data=journal" )!=string::npos) ) - { - string cmd = TUNE2FSBIN " -o "; - if( fstab_opt.find( "data=writeback" )!=string::npos ) - cmd += "journal_data_writeback "; - else - cmd += "journal_data "; - cmd += quote(mountDevice()); - SystemCmd c( cmd ); - if( c.retcode()!=0 ) - ret = VOLUME_TUNE2FS_FAILED; + if (ret == 0 && mp == "/") + { + string data_mode = getExtDataMode(fstab_opt); + if (data_mode != "ordered") + ret = doTuneExtDataMode(data_mode); } } break; @@ -1218,6 +1203,35 @@ } + int + Volume::doTuneExtDataMode(const string& data_mode) + { + int ret = 0; + + string option; + if (data_mode == "ordered") + option = "journal_data_ordered"; + else if (data_mode == "journal") + option = "journal_data"; + else if (data_mode == "writeback") + option = "journal_data_writeback"; + + if (option.empty()) + { + y2err("unknown data_mode '" << data_mode << "'"); + } + else + { + string cmd = TUNE2FSBIN " -o " + option + " " + quote(mountDevice()); + SystemCmd c(cmd); + if (c.retcode() != 0) + ret = VOLUME_TUNE2FS_FAILED; + } + + return ret; + } + + void Volume::updateFsData( bool setUsedByLvm ) { @@ -1264,7 +1278,7 @@ string path = getFilesysSysfsPath() + "/uevent"; if( access( path.c_str(), R_OK )==0 ) { - ofstream file( path.c_str() ); + ofstream file(path); classic(file); if( file.good() ) { @@ -1419,13 +1433,15 @@ { if( !mp.empty() ) { - // displayed text during action, %1$s is replaced by device name e.g. /dev/hda1 + // displayed during action + // %1$s is replaced by device name e.g. /dev/hda1 // %2$s is replaced by mount point e.g. /home txt = sformat(_("Mounting %1$s to %2$s"), dev.c_str(), mp.c_str()); } else { - // displayed text during action, %1$s is replaced by device name e.g. /dev/hda1 + // displayed during action + // %1$s is replaced by device name e.g. /dev/hda1 txt = sformat(_("Unmounting %1$s"), dev.c_str()); } } @@ -1434,7 +1450,8 @@ if( !orig_mp.empty() && !mp.empty() && (!getStorage()->instsys()||mp!=orig_mp||mp!="swap") ) { - // displayed text before action, %1$s is replaced by device name e.g. /dev/hda1 + // displayed before action + // %1$s is replaced by device name e.g. /dev/hda1 // %2$s is replaced by mount point e.g. /home txt = sformat(_("Change mount point of %1$s to %2$s"), dev.c_str(), mp.c_str()); @@ -1443,14 +1460,16 @@ { if( mp != "swap" ) { - // displayed text before action, %1$s is replaced by device name e.g. /dev/hda1 + // displayed before action + // %1$s is replaced by device name e.g. /dev/hda1 // %2$s is replaced by mount point e.g. /home txt = sformat(_("Set mount point of %1$s to %2$s"), dev.c_str(), mp.c_str()); } else { - // displayed text before action, %1$s is replaced by device name e.g. /dev/hda1 + // displayed before action + // %1$s is replaced by device name e.g. /dev/hda1 // %2$s is replaced by "swap" txt = sformat(_("Use %1$s as %2$s"), dev.c_str(), mp.c_str()); } @@ -1462,7 +1481,8 @@ fn = "/etc/crypttab"; if( inCryptotab() ) fn = "/etc/cryptotab"; - // displayed text before action, %1$s is replaced by device name e.g. /dev/hda1 + // displayed before action + // %1$s is replaced by device name e.g. /dev/hda1 // %2$s is replaced by pathname e.g. /etc/fstab txt = sformat(_("Remove %1$s from %2$s"), dev.c_str(), fn.c_str()); } @@ -1823,36 +1843,30 @@ } Text Volume::losetupText( bool doing ) const - { - Text txt; - if( doing ) - { - // displayed text during action, %1$s is replaced by device name e.g. /dev/hda1 - txt = sformat(_("Setting up encrypted loop device on %1$s"), dev.c_str()); - } - else - { - // displayed text before action, %1$s is replaced by device name e.g. /dev/hda1 - txt = sformat(_("Set up encrypted loop device on %1$s"), dev.c_str()); - } - return( txt ); - } +{ + Text txt = doing + ? // displayed during action + // %1$s is replaced by device name e.g. /dev/hda1 + _("Setting up encrypted loop device on %1$s") + : // displayed before action + // %1$s is replaced by device name e.g. /dev/hda1 + _("Set up encrypted loop device on %1$s") + ; + return sformat(txt, dev.c_str()); +} Text Volume::crsetupText( bool doing ) const - { - Text txt; - if( doing ) - { - // displayed text during action, %1$s is replaced by device name e.g. /dev/hda1 - txt = sformat(_("Setting up encrypted dm device on %1$s"), dev.c_str()); - } - else - { - // displayed text before action, %1$s is replaced by device name e.g. /dev/hda1 - txt = sformat(_("Set up encrypted dm device on %1$s"), dev.c_str()); - } - return( txt ); - } +{ + Text txt = doing + ? // displayed during action + // %1$s is replaced by device name e.g. /dev/hda1 + _("Setting up encrypted dm device on %1$s") + : // displayed before action + // %1$s is replaced by device name e.g. /dev/hda1 + _("Set up encrypted dm device on %1$s") + ; + return sformat(txt, dev.c_str()); +} bool Volume::loopStringNum( const string& name, unsigned& num ) { @@ -2185,7 +2199,7 @@ bool luks_ok = false; do { - ofstream pwdfile( fname.c_str() ); + ofstream pwdfile(fname); classic(pwdfile); pwdfile << crypt_pwd; pwdfile.close(); @@ -2312,7 +2326,7 @@ if( !dmcrypt() ) { fname = getStorage()->tmpDir() + "/pwdf"; - ofstream pwdfile( fname.c_str() ); + ofstream pwdfile(fname); classic(pwdfile); pwdfile << crypt_pwd << endl; pwdfile.close(); @@ -2444,7 +2458,7 @@ if( ret==0 ) { string fname = getStorage()->tmpDir() + "/pwdf"; - ofstream pwdfile( fname.c_str() ); + ofstream pwdfile(fname); classic(pwdfile); pwdfile << crypt_pwd; pwdfile.close(); @@ -2544,38 +2558,26 @@ } Text Volume::labelText( bool doing ) const - { +{ Text txt; - if( doing ) - { - if( label.empty() ) - { - // displayed text during action, %1$s is replaced by device name e.g. /dev/hda1 - txt = sformat(_("Clearing label on %1$s"), dev.c_str()); - } - else - { - // displayed text during action, %1$s is replaced by device name e.g. /dev/hda1 - // %2$s is replaced by a name e.g. ROOT - txt = sformat(_("Setting label on %1$s to %2$s"), dev.c_str(), label.c_str()); - } - } - else - { - if( label.empty() ) - { - // displayed text before action, %1$s is replaced by device name e.g. /dev/hda1 - txt = sformat(_("Clear label on %1$s"), dev.c_str()); - } - else - { - // displayed text before action, %1$s is replaced by device name e.g. /dev/hda1 - // %2$s is replaced by a name e.g. ROOT - txt = sformat(_("Set label on %1$s to %2$s"), dev.c_str(), label.c_str()); - } - } - return( txt ); - } + // key: (doing, has-label) + std::map<std::pair<bool, bool>, Text> msgs; + // displayed during action + // %1$s is replaced by device name e.g. /dev/hda1 + msgs[std::make_pair(1, 0)] = _("Clearing label on %1$s"); + // displayed during action + // %1$s is replaced by device name e.g. /dev/hda1 + // %2$s is replaced by a name e.g. ROOT + msgs[std::make_pair(1, 1)] = _("Setting label on %1$s to %2$s"); + // displayed before action + // %1$s is replaced by device name e.g. /dev/hda1 + msgs[std::make_pair(0, 0)] = _("Clear label on %1$s"); + // displayed before action + // %1$s is replaced by device name e.g. /dev/hda1 + // %2$s is replaced by a name e.g. ROOT + msgs[std::make_pair(0, 1)] = _("Set label on %1$s to %2$s"); + return sformat(msgs[std::make_pair(doing, !label.empty())], dev.c_str(), label.c_str()); +} int Volume::doSetLabel() { @@ -3215,11 +3217,19 @@ { c.execute( "/etc/init.d/boot.quota restart" ); } + if (mp == "/" && (fs == EXT3 || fs == EXT4)) + { + string orig_data_mode = getExtDataMode(orig_fstab_opt); + string data_mode = getExtDataMode(fstab_opt); + if (orig_data_mode != data_mode) + doTuneExtDataMode(data_mode); + } } y2mil("changed:" << changed << " ret:" << ret); - return( ret ); + return ret; } + void Volume::fstabUpdateDone() { y2mil("begin"); @@ -3261,145 +3271,130 @@ Text Volume::createText(bool doing) const { - Text txt; + // key: mountpoint + std::map<std::string, Text> msgs_by_mp; + // displayed before action + // %1$s is replaced by device name e.g. /dev/hda1 + // %2$s is replaced by size (e.g. 623.5 MB) + msgs_by_mp["swap"] = _("Create swap volume %1$s (%2$s)"); + // displayed before action + // %1$s is replaced by device name e.g. /dev/hda1 + // %2$s is replaced by size (e.g. 623.5 MB) + // %3$s is replaced by file system type (e.g. reiserfs) + msgs_by_mp["/"] = _("Create root volume %1$s (%2$s) with %3$s"); + // displayed before action + // %1$s is replaced by device name e.g. /dev/hda1 + // %2$s is replaced by size (e.g. 623.5 MB) + // %3$s is replaced by file system type (e.g. reiserfs) + msgs_by_mp[getStorage()->bootMount()] = _("Create boot volume %1$s (%2$s) with %3$s"); + + // key: (has-mountpoint, is-encrypted) + std::map<std::pair<bool, bool>, Text> msgs_by_mpenc; + // displayed before action + // %1$s is replaced by device name e.g. /dev/hda1 + // %2$s is replaced by size (e.g. 623.5 MB) + // %3$s is replaced by file system type (e.g. reiserfs) + // %4$s is replaced by mount point (e.g. /usr) + msgs_by_mpenc[std::make_pair(1, 0)] = _("Create volume %1$s (%2$s) for %4$s with %3$s"); + // displayed before action + // %1$s is replaced by device name e.g. /dev/hda1 + // %2$s is replaced by size (e.g. 623.5 MB) + // %3$s is replaced by file system type (e.g. reiserfs) + // %4$s is replaced by mount point (e.g. /usr) + msgs_by_mpenc[std::make_pair(1, 1)] = _("Create encrypted volume %1$s (%2$s) for %4$s with %3$s"); + // displayed before action + // %1$s is replaced by device name e.g. /dev/hda1 + // %2$s is replaced by size (e.g. 623.5 MB) + msgs_by_mpenc[std::make_pair(0, 0)] = _("Create volume %1$s (%2$s)"); + // displayed before action + // %1$s is replaced by device name e.g. /dev/hda1 + // %2$s is replaced by size (e.g. 623.5 MB) + msgs_by_mpenc[std::make_pair(0, 1)] = _("Create encrypted volume %1$s (%2$s)"); + + // key: partition-id + std::map<int, Text> msgs_by_pid; + // displayed before action + // %1$s is replaced by device name e.g. /dev/hda1 + // %2$s is replaced by size (e.g. 623.5 MB) + msgs_by_pid[Partition::ID_GPT_BIOS] = _("Create BIOS grub volume %1$s (%2$s)"); + // displayed before action + // %1$s is replaced by device name e.g. /dev/hda1 + // %2$s is replaced by size (e.g. 623.5 MB) + msgs_by_pid[Partition::ID_GPT_PREP] = _("Create GPT PReP volume %1$s (%2$s)"); + // displayed before action + // %1$s is replaced by device name e.g. /dev/hda1 + // %2$s is replaced by size (e.g. 623.5 MB) + msgs_by_pid[Partition::ID_PPC_PREP] = _("Create PReP volume %1$s (%2$s)"); + if (doing) + // displayed during action + // %1$s is replaced by device name e.g. /dev/hda1 + return sformat(_("Creating volume %1$s"), dev.c_str()); + + auto msg = msgs_by_mpenc[std::make_pair(!mp.empty(), encryption != ENC_NONE)]; + + if (!mp.empty()) { - // displayed text during action, %1$s is replaced by device name e.g. /dev/hda1 - txt = sformat(_("Creating volume %1$s"), dev.c_str()); + auto it = msgs_by_mp.find(mp); + if (it != msgs_by_mp.end()) + msg = (*it).second; } else { - if (mp == "swap") + if (auto p = dynamic_cast<const Partition*>(this)) { - // displayed text before action, %1$s is replaced by device name e.g. /dev/hda1 - // %2$s is replaced by size (e.g. 623.5 MB) - txt = sformat(_("Create swap volume %1$s (%2$s)"), dev.c_str(), - sizeString().c_str()); - } - else if (mp == "/") - { - // displayed text before action, %1$s is replaced by device name e.g. /dev/hda1 - // %2$s is replaced by size (e.g. 623.5 MB) - // %3$s is replaced by file system type (e.g. reiserfs) - txt = sformat(_("Create root volume %1$s (%2$s) with %3$s"), - dev.c_str(), sizeString().c_str(), fsTypeString().c_str()); - } - else if (mp == getStorage()->bootMount()) - { - // displayed text before action, %1$s is replaced by device name e.g. /dev/hda1 - // %2$s is replaced by size (e.g. 623.5 MB) - // %3$s is replaced by file system type (e.g. reiserfs) - txt = sformat(_("Create boot volume %1$s (%2$s) with %3$s"), - dev.c_str(), sizeString().c_str(), fsTypeString().c_str()); - } - else if (!mp.empty()) - { - if (encryption == ENC_NONE) - { - // displayed text before action, %1$s is replaced by device name e.g. /dev/hda1 - // %2$s is replaced by size (e.g. 623.5 MB) - // %3$s is replaced by file system type (e.g. reiserfs) - // %4$s is replaced by mount point (e.g. /usr) - txt = sformat(_("Create volume %1$s (%2$s) for %4$s with %3$s"), - dev.c_str(), sizeString().c_str(), fsTypeString().c_str(), - mp.c_str()); - } - else - { - // displayed text before action, %1$s is replaced by device name e.g. /dev/hda1 - // %2$s is replaced by size (e.g. 623.5 MB) - // %3$s is replaced by file system type (e.g. reiserfs) - // %4$s is replaced by mount point (e.g. /usr) - txt = sformat(_("Create encrypted volume %1$s (%2$s) for %4$s with %3$s"), - dev.c_str(), sizeString().c_str(), fsTypeString().c_str(), - mp.c_str()); - } - } - else - { - const Partition* p = dynamic_cast<const Partition*>(this); - if (p && p->id()==Partition::ID_GPT_BIOS) - { - // displayed text before action, %1$s is replaced by device name e.g. /dev/hda1 - // %2$s is replaced by size (e.g. 623.5 MB) - txt = sformat(_("Create BIOS grub volume %1$s (%2$s)"), dev.c_str(), sizeString().c_str()); - } - else if (p && p->id() == Partition::ID_PPC_PREP) - { - // displayed text before action, %1$s is replaced by device name e.g. /dev/hda1 - // %2$s is replaced by size (e.g. 623.5 MB) - txt = sformat(_("Create PReP volume %1$s (%2$s)"), dev.c_str(), sizeString().c_str()); - } - else if (p && p->id() == Partition::ID_GPT_PREP) - { - // displayed text before action, %1$s is replaced by device name e.g. /dev/hda1 - // %2$s is replaced by size (e.g. 623.5 MB) - txt = sformat(_("Create GPT PReP volume %1$s (%2$s)"), dev.c_str(), sizeString().c_str()); - } - else if (encryption == ENC_NONE) - { - // displayed text before action, %1$s is replaced by device name e.g. /dev/hda1 - // %2$s is replaced by size (e.g. 623.5 MB) - txt = sformat(_("Create volume %1$s (%2$s)"), dev.c_str(), sizeString().c_str()); - } - else - { - // displayed text before action, %1$s is replaced by device name e.g. /dev/hda1 - // %2$s is replaced by size (e.g. 623.5 MB) - txt = sformat(_("Create encrypted volume %1$s (%2$s)"), dev.c_str(), - sizeString().c_str()); - } + auto it = msgs_by_pid.find(p->id()); + if (it != msgs_by_pid.end()) + msg = (*it).second; } } - return txt; + + return sformat(msg, dev.c_str(), sizeString().c_str(), fsTypeString().c_str(), mp.c_str()); } Text Volume::resizeText( bool doing ) const { - Text txt; + // key: (doing, shrink) + std::map<std::pair<bool, bool>, Text> msgs; + // displayed during action + // %1$s is replaced by device name e.g. /dev/hda1 + // %2$s is replaced by size (e.g. 623.5 MB) + msgs[std::make_pair(1, 1)] = _("Shrinking %1$s to %2$s"); + // displayed during action + // %1$s is replaced by device name e.g. /dev/hda1 + // %2$s is replaced by size (e.g. 623.5 MB) + msgs[std::make_pair(1, 0)] = _("Extending %1$s to %2$s"); + // displayed before action + // %1$s is replaced by device name e.g. /dev/hda1 + // %2$s is replaced by size (e.g. 623.5 MB) + msgs[std::make_pair(0, 1)] = _("Shrink %1$s to %2$s"); + // displayed before action + // %1$s is replaced by device name e.g. /dev/hda1 + // %2$s is replaced by size (e.g. 623.5 MB) + msgs[std::make_pair(0, 0)] = _("Extend %1$s to %2$s"); + + Text txt = sformat(msgs[std::make_pair(doing, needShrink())], dev.c_str(), sizeString().c_str()); if( doing ) { - if( needShrink() ) - // displayed text during action, %1$s is replaced by device name e.g. /dev/hda1 - // %2$s is replaced by size (e.g. 623.5 MB) - txt = sformat(_("Shrinking %1$s to %2$s"), dev.c_str(), sizeString().c_str()); - else - // displayed text during action, %1$s is replaced by device name e.g. /dev/hda1 - // %2$s is replaced by size (e.g. 623.5 MB) - txt = sformat(_("Extending %1$s to %2$s"), dev.c_str(), sizeString().c_str()); txt += Text(" ", " "); // text displayed during action txt += _("(Progress bar will not move. May take very long. DO NOT ABORT!)"); } - else - { - if( needShrink() ) - // displayed text before action, %1$s is replaced by device name e.g. /dev/hda1 - // %2$s is replaced by size (e.g. 623.5 MB) - txt = sformat(_("Shrink %1$s to %2$s"), dev.c_str(), sizeString().c_str()); - else - // displayed text before action, %1$s is replaced by device name e.g. /dev/hda1 - // %2$s is replaced by size (e.g. 623.5 MB) - txt = sformat(_("Extend %1$s to %2$s"), dev.c_str(), sizeString().c_str()); - } return txt; } Text Volume::removeText( bool doing ) const { - Text txt; - if( doing ) - { - // displayed text during action, %1$s is replaced by device name e.g. /dev/hda1 - txt = sformat( _("Removing volume %1$s"), dev.c_str() ); - } - else - { - // displayed text before action, %1$s is replaced by device name e.g. /dev/hda1 - txt = sformat( _("Remove volume %1$s"), dev.c_str() ); - } - return( txt ); + auto msg = doing + ? // displayed during action + // %1$s is replaced by device name e.g. /dev/hda1 + _("Removing volume %1$s") + : // displayed before action + // %1$s is replaced by device name e.g. /dev/hda1 + _("Remove volume %1$s") + ; + return sformat(msg, dev.c_str()); } void Volume::getInfo( VolumeInfo& info ) const diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libstorage-2.25.14/storage/Volume.h new/libstorage-2.25.14/storage/Volume.h --- old/libstorage-2.25.14/storage/Volume.h 2014-06-11 14:18:39.000000000 +0200 +++ new/libstorage-2.25.14/storage/Volume.h 2014-07-14 21:06:43.000000000 +0200 @@ -39,9 +39,9 @@ class SystemCmd; class ProcMounts; class EtcFstab; -class FstabEntry; -class FstabChange; -class FstabKey; +struct FstabEntry; +struct FstabChange; +struct FstabKey; class Container; class Storage; @@ -244,6 +244,7 @@ string getDmcryptName() const; void addDmCryptNames(unsigned long minor); void removeDmCryptNames(); + int doTuneExtDataMode(const string& data_mode); bool needLosetup( bool urgent ) const; bool needCryptsetup() const; int doLosetup(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libstorage-2.25.14/storage/gen_md5sum.cc new/libstorage-2.25.14/storage/gen_md5sum.cc --- old/libstorage-2.25.14/storage/gen_md5sum.cc 2014-06-11 15:02:56.000000000 +0200 +++ new/libstorage-2.25.14/storage/gen_md5sum.cc 2014-07-21 15:21:54.000000000 +0200 @@ -1,5 +1,5 @@ -#define SOURCES_MD5SUM "4d275f7ecc978acd669c977c15f199f5" -#define SOURCES_MD5_DATE " Wed Jun 11 15:02:56 CEST 2014 " +#define SOURCES_MD5SUM "b196a2af6a6fc3ccaf2da7838978a702" +#define SOURCES_MD5_DATE " Mon 21 Jul 15:21:54 CEST 2014 " namespace storage { const char* GetSourceMd5() { return SOURCES_MD5SUM; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libstorage-2.25.14/testsuite/md_create.cc new/libstorage-2.25.14/testsuite/md_create.cc --- old/libstorage-2.25.14/testsuite/md_create.cc 2014-06-11 14:18:39.000000000 +0200 +++ new/libstorage-2.25.14/testsuite/md_create.cc 2014-07-07 18:23:18.000000000 +0200 @@ -12,33 +12,32 @@ StorageInterface *s = 0; -void print_md_info() +void +print_md_info() { deque<MdInfo> plist; - s->getMdInfo( plist ); + s->getMdInfo(plist); - for ( deque<MdInfo>::iterator p = plist.begin(); - p != plist.end(); ++p ) + for (const MdInfo& p : plist) { - cout << ' ' << p->v.name << ' '; - cout << p->v.device << ' '; - cout << p->nr << ' '; - cout << p->type << ' '; - cout << p->chunkSizeK << ' '; + cout << ' ' << p.v.name << ' ' << p.v.device << ' ' << p.nr + << ' ' << p.type << ' ' << p.chunkSizeK << ' ' << p.v.sizeK; } } -void createMD(MdType type, list<string> devs) + +void +createMD(MdType type, list<string> devs) { s = createStorageInterface(TestEnvironment()); int ret = s->createMd("/dev/md0", type, devs, list<string>()); - if( ret==0 ) - ret = s->checkMd( "/dev/md0" ); + if (ret == 0) + ret = s->checkMd("/dev/md0"); cout << "createMD: " << ret; - if(ret==0) + if (ret == 0) print_md_info(); cout << endl; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libstorage-2.25.14/testsuite/single.out/md_create.out new/libstorage-2.25.14/testsuite/single.out/md_create.out --- old/libstorage-2.25.14/testsuite/single.out/md_create.out 2014-06-11 14:18:39.000000000 +0200 +++ new/libstorage-2.25.14/testsuite/single.out/md_create.out 2014-07-07 18:23:18.000000000 +0200 @@ -7,22 +7,22 @@ createMD: -6002 createMD: -6018 Devices: 2 ---------------------- -createMD: 0 md0 /dev/md0 0 1 0 -createMD: 0 md0 /dev/md0 0 2 0 +createMD: 0 md0 /dev/md0 0 1 0 15735635 +createMD: 0 md0 /dev/md0 0 2 0 5253223 createMD: -6002 createMD: -6002 -createMD: 0 md0 /dev/md0 0 5 0 -createMD: 0 md0 /dev/md0 0 6 0 +createMD: 0 md0 /dev/md0 0 5 0 5253223 +createMD: 0 md0 /dev/md0 0 6 0 5253223 createMD: -6018 Devices: 3 ---------------------- -createMD: 0 md0 /dev/md0 0 3 0 +createMD: 0 md0 /dev/md0 0 3 0 10506446 createMD: -6002 Devices: 4 ---------------------- -createMD: 0 md0 /dev/md0 0 4 0 +createMD: 0 md0 /dev/md0 0 4 0 10506446 Devices: 5 ---------------------- -createMD: 0 md0 /dev/md0 0 1 0 -createMD: 0 md0 /dev/md0 0 2 0 -createMD: 0 md0 /dev/md0 0 3 0 -createMD: 0 md0 /dev/md0 0 4 0 -createMD: 0 md0 /dev/md0 0 5 0 -createMD: 0 md0 /dev/md0 0 6 0 +createMD: 0 md0 /dev/md0 0 1 0 57689319 +createMD: 0 md0 /dev/md0 0 2 0 5253223 +createMD: 0 md0 /dev/md0 0 3 0 21012892 +createMD: 0 md0 /dev/md0 0 4 0 15759669 +createMD: 0 md0 /dev/md0 0 5 0 13133057 +createMD: 0 md0 /dev/md0 0 6 0 5253223 -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
