Hello community, here is the log from the commit of package libstorage for openSUSE:Factory checked in at 2013-12-17 07:23:06 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 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 2013-12-04 12:30:10.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.libstorage.new/libstorage.changes 2013-12-17 07:23:07.000000000 +0100 @@ -1,0 +2,16 @@ +Mon Dec 16 14:34:18 CET 2013 - aschn...@suse.de + +- during installation add btrfs subvolumes to fstab (fate#316541) +- version 2.25.5 + +------------------------------------------------------------------- +Fri Dec 13 14:57:59 CET 2013 - aschn...@suse.de + +- added support for NVMe devices (see fate#315662) + +------------------------------------------------------------------- +Thu Dec 12 16:47:33 CET 2013 - aschn...@suse.de + +- fixed fstab handling for certain remove operations + +------------------------------------------------------------------- Old: ---- libstorage-2.25.4.tar.bz2 New: ---- libstorage-2.25.5.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libstorage.spec ++++++ --- /var/tmp/diff_new_pack.u06oZl/_old 2013-12-17 07:23:08.000000000 +0100 +++ /var/tmp/diff_new_pack.u06oZl/_new 2013-12-17 07:23:08.000000000 +0100 @@ -17,7 +17,7 @@ Name: libstorage -Version: 2.25.4 +Version: 2.25.5 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build Source: libstorage-%{version}.tar.bz2 ++++++ libstorage-2.25.4.tar.bz2 -> libstorage-2.25.5.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.25.4/VERSION new/libstorage-2.25.5/VERSION --- old/libstorage-2.25.4/VERSION 2013-12-03 18:00:09.000000000 +0100 +++ new/libstorage-2.25.5/VERSION 2013-12-16 15:49:57.000000000 +0100 @@ -1 +1 @@ -2.25.4 +2.25.5 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.25.4/bindings/python/libstorage.py new/libstorage-2.25.5/bindings/python/libstorage.py --- old/libstorage-2.25.4/bindings/python/libstorage.py 2013-12-03 19:03:37.000000000 +0100 +++ new/libstorage-2.25.5/bindings/python/libstorage.py 2013-12-13 14:32:52.000000000 +0100 @@ -357,10 +357,42 @@ ContentInfo_swigregister = _libstorage.ContentInfo_swigregister ContentInfo_swigregister(ContentInfo) -class ContainerInfo(_object): +class DeviceInfo(_object): __swig_setmethods__ = {} + __setattr__ = lambda self, name, value: _swig_setattr(self, DeviceInfo, name, value) + __swig_getmethods__ = {} + __getattr__ = lambda self, name: _swig_getattr(self, DeviceInfo, name) + __repr__ = _swig_repr + def __init__(self): + this = _libstorage.new_DeviceInfo() + try: self.this.append(this) + except: self.this = this + __swig_setmethods__["device"] = _libstorage.DeviceInfo_device_set + __swig_getmethods__["device"] = _libstorage.DeviceInfo_device_get + if _newclass:device = _swig_property(_libstorage.DeviceInfo_device_get, _libstorage.DeviceInfo_device_set) + __swig_setmethods__["name"] = _libstorage.DeviceInfo_name_set + __swig_getmethods__["name"] = _libstorage.DeviceInfo_name_get + if _newclass:name = _swig_property(_libstorage.DeviceInfo_name_get, _libstorage.DeviceInfo_name_set) + __swig_setmethods__["udevPath"] = _libstorage.DeviceInfo_udevPath_set + __swig_getmethods__["udevPath"] = _libstorage.DeviceInfo_udevPath_get + if _newclass:udevPath = _swig_property(_libstorage.DeviceInfo_udevPath_get, _libstorage.DeviceInfo_udevPath_set) + __swig_setmethods__["udevId"] = _libstorage.DeviceInfo_udevId_set + __swig_getmethods__["udevId"] = _libstorage.DeviceInfo_udevId_get + if _newclass:udevId = _swig_property(_libstorage.DeviceInfo_udevId_get, _libstorage.DeviceInfo_udevId_set) + __swig_setmethods__["usedBy"] = _libstorage.DeviceInfo_usedBy_set + __swig_getmethods__["usedBy"] = _libstorage.DeviceInfo_usedBy_get + if _newclass:usedBy = _swig_property(_libstorage.DeviceInfo_usedBy_get, _libstorage.DeviceInfo_usedBy_set) + __swig_destroy__ = _libstorage.delete_DeviceInfo + __del__ = lambda self : None; +DeviceInfo_swigregister = _libstorage.DeviceInfo_swigregister +DeviceInfo_swigregister(DeviceInfo) + +class ContainerInfo(DeviceInfo): + __swig_setmethods__ = {} + for _s in [DeviceInfo]: __swig_setmethods__.update(getattr(_s,'__swig_setmethods__',{})) __setattr__ = lambda self, name, value: _swig_setattr(self, ContainerInfo, name, value) __swig_getmethods__ = {} + for _s in [DeviceInfo]: __swig_getmethods__.update(getattr(_s,'__swig_getmethods__',{})) __getattr__ = lambda self, name: _swig_getattr(self, ContainerInfo, name) __repr__ = _swig_repr def __init__(self): @@ -370,21 +402,6 @@ __swig_setmethods__["type"] = _libstorage.ContainerInfo_type_set __swig_getmethods__["type"] = _libstorage.ContainerInfo_type_get if _newclass:type = _swig_property(_libstorage.ContainerInfo_type_get, _libstorage.ContainerInfo_type_set) - __swig_setmethods__["device"] = _libstorage.ContainerInfo_device_set - __swig_getmethods__["device"] = _libstorage.ContainerInfo_device_get - if _newclass:device = _swig_property(_libstorage.ContainerInfo_device_get, _libstorage.ContainerInfo_device_set) - __swig_setmethods__["name"] = _libstorage.ContainerInfo_name_set - __swig_getmethods__["name"] = _libstorage.ContainerInfo_name_get - if _newclass:name = _swig_property(_libstorage.ContainerInfo_name_get, _libstorage.ContainerInfo_name_set) - __swig_setmethods__["udevPath"] = _libstorage.ContainerInfo_udevPath_set - __swig_getmethods__["udevPath"] = _libstorage.ContainerInfo_udevPath_get - if _newclass:udevPath = _swig_property(_libstorage.ContainerInfo_udevPath_get, _libstorage.ContainerInfo_udevPath_set) - __swig_setmethods__["udevId"] = _libstorage.ContainerInfo_udevId_set - __swig_getmethods__["udevId"] = _libstorage.ContainerInfo_udevId_get - if _newclass:udevId = _swig_property(_libstorage.ContainerInfo_udevId_get, _libstorage.ContainerInfo_udevId_set) - __swig_setmethods__["usedBy"] = _libstorage.ContainerInfo_usedBy_set - __swig_getmethods__["usedBy"] = _libstorage.ContainerInfo_usedBy_get - if _newclass:usedBy = _swig_property(_libstorage.ContainerInfo_usedBy_get, _libstorage.ContainerInfo_usedBy_set) __swig_setmethods__["readonly"] = _libstorage.ContainerInfo_readonly_set __swig_getmethods__["readonly"] = _libstorage.ContainerInfo_readonly_get if _newclass:readonly = _swig_property(_libstorage.ContainerInfo_readonly_get, _libstorage.ContainerInfo_readonly_set) @@ -561,10 +578,12 @@ DmmultipathCoInfo_swigregister = _libstorage.DmmultipathCoInfo_swigregister DmmultipathCoInfo_swigregister(DmmultipathCoInfo) -class VolumeInfo(_object): +class VolumeInfo(DeviceInfo): __swig_setmethods__ = {} + for _s in [DeviceInfo]: __swig_setmethods__.update(getattr(_s,'__swig_setmethods__',{})) __setattr__ = lambda self, name, value: _swig_setattr(self, VolumeInfo, name, value) __swig_getmethods__ = {} + for _s in [DeviceInfo]: __swig_getmethods__.update(getattr(_s,'__swig_getmethods__',{})) __getattr__ = lambda self, name: _swig_getattr(self, VolumeInfo, name) __repr__ = _swig_repr def __init__(self): @@ -580,12 +599,6 @@ __swig_setmethods__["minor"] = _libstorage.VolumeInfo_minor_set __swig_getmethods__["minor"] = _libstorage.VolumeInfo_minor_get if _newclass:minor = _swig_property(_libstorage.VolumeInfo_minor_get, _libstorage.VolumeInfo_minor_set) - __swig_setmethods__["name"] = _libstorage.VolumeInfo_name_set - __swig_getmethods__["name"] = _libstorage.VolumeInfo_name_get - if _newclass:name = _swig_property(_libstorage.VolumeInfo_name_get, _libstorage.VolumeInfo_name_set) - __swig_setmethods__["device"] = _libstorage.VolumeInfo_device_set - __swig_getmethods__["device"] = _libstorage.VolumeInfo_device_get - if _newclass:device = _swig_property(_libstorage.VolumeInfo_device_get, _libstorage.VolumeInfo_device_set) __swig_setmethods__["mount"] = _libstorage.VolumeInfo_mount_set __swig_getmethods__["mount"] = _libstorage.VolumeInfo_mount_get if _newclass:mount = _swig_property(_libstorage.VolumeInfo_mount_get, _libstorage.VolumeInfo_mount_set) @@ -595,15 +608,6 @@ __swig_setmethods__["mount_by"] = _libstorage.VolumeInfo_mount_by_set __swig_getmethods__["mount_by"] = _libstorage.VolumeInfo_mount_by_get if _newclass:mount_by = _swig_property(_libstorage.VolumeInfo_mount_by_get, _libstorage.VolumeInfo_mount_by_set) - __swig_setmethods__["udevPath"] = _libstorage.VolumeInfo_udevPath_set - __swig_getmethods__["udevPath"] = _libstorage.VolumeInfo_udevPath_get - if _newclass:udevPath = _swig_property(_libstorage.VolumeInfo_udevPath_get, _libstorage.VolumeInfo_udevPath_set) - __swig_setmethods__["udevId"] = _libstorage.VolumeInfo_udevId_set - __swig_getmethods__["udevId"] = _libstorage.VolumeInfo_udevId_get - if _newclass:udevId = _swig_property(_libstorage.VolumeInfo_udevId_get, _libstorage.VolumeInfo_udevId_set) - __swig_setmethods__["usedBy"] = _libstorage.VolumeInfo_usedBy_set - __swig_getmethods__["usedBy"] = _libstorage.VolumeInfo_usedBy_get - if _newclass:usedBy = _swig_property(_libstorage.VolumeInfo_usedBy_get, _libstorage.VolumeInfo_usedBy_set) __swig_setmethods__["ignore_fstab"] = _libstorage.VolumeInfo_ignore_fstab_set __swig_getmethods__["ignore_fstab"] = _libstorage.VolumeInfo_ignore_fstab_get if _newclass:ignore_fstab = _swig_property(_libstorage.VolumeInfo_ignore_fstab_get, _libstorage.VolumeInfo_ignore_fstab_set) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.25.4/storage/Btrfs.cc new/libstorage-2.25.5/storage/Btrfs.cc --- old/libstorage-2.25.4/storage/Btrfs.cc 2013-12-03 19:02:44.000000000 +0100 +++ new/libstorage-2.25.5/storage/Btrfs.cc 2013-12-16 14:37:47.000000000 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) [2004-2011] Novell, Inc. + * Copyright (c) [2004-2013] Novell, Inc. * * All Rights Reserved. * @@ -145,19 +145,29 @@ if( !mp.empty() ) { clearSubvol(); - SystemCmd cmd( BTRFSBIN " subvolume list " + mp ); + SystemCmd cmd(BTRFSBIN " subvolume list " + quote(mp)); for( vector<string>::const_iterator s=cmd.stdout().begin(); s!=cmd.stdout().end(); ++s ) { - string subvol; - string::size_type pos = s->find( " path " ); - if( pos!=string::npos ) - pos = s->find_first_not_of( app_ws, pos+5 ); - if( pos!=string::npos ) - subvol = s->substr( pos, s->find_last_not_of( app_ws ) ); - if( !subvol.empty() ) - addSubvol( subvol ); - } + string level; + string::size_type pos1 = s->find(" level "); + if (pos1 != string::npos) + pos1 = s->find_first_not_of(app_ws, pos1 + 6); + if (pos1 != string::npos) + level = s->substr(pos1, s->find_last_not_of(app_ws)); + + string subvol; + string::size_type pos2 = s->find(" path "); + if (pos2 != string::npos) + pos2 = s->find_first_not_of(app_ws, pos2 + 5); + if (pos2 != string::npos) + subvol = s->substr(pos2, s->find_last_not_of(app_ws)); + + // Subvolume can already be deleted, in which case level is "0" + // (and path "DELETED"). That is a temporary state. + if (level != "0" && !subvol.empty()) + addSubvol(subvol); + } } if( mounted ) { @@ -426,13 +436,13 @@ if( ret==0 ) { SystemCmd c; - string cmd = BTRFSBIN " subvolume delete " + m + '/'; + string cmd = BTRFSBIN " subvolume delete "; for( list<Subvolume>::iterator i=subvol.begin(); i!=subvol.end(); ++i ) { if( i->deleted() ) { getStorage()->showInfoCb( deleteSubvolText(true,i->path()),silent); - c.execute( cmd + i->path() ); + c.execute(cmd + quote(m + '/' + i->path())); if( c.retcode()==0 ) i->setDeleted(false); else @@ -469,7 +479,7 @@ y2mil( "create path:" << dir ); createPath( dir ); } - c.execute( cmd + path ); + c.execute(cmd + quote(path)); if( c.retcode()==0 ) i->setCreated(false); else @@ -486,8 +496,7 @@ list<string> Btrfs::getSubvolAddDel( bool add ) const { list<string> ret; - list<Subvolume>::const_iterator i; - for( i=subvol.begin(); i!=subvol.end(); ++i ) + for (list<Subvolume>::const_iterator i = subvol.begin(); i != subvol.end(); ++i) { if( !add && i->deleted() ) ret.push_back(i->path()); @@ -718,16 +727,13 @@ } } } + + for (list<string>::const_iterator it = dev_add.begin(); it != dev_add.end(); ++it) + l.push_back(commitAction(INCREASE, cont->type(), extendText(false, *it), this, true)); + for (list<string>::const_iterator it = dev_rem.begin(); it != dev_rem.end(); ++it) + l.push_back(commitAction(DECREASE, cont->type(), reduceText(false, *it), this, false)); + unsigned rem, add; - list<string>::const_iterator i; - if( !dev_add.empty() ) - for( i=dev_add.begin(); i!=dev_add.end(); ++i ) - l.push_back(commitAction(INCREASE, cont->type(), - extendText(false, *i), this, true)); - if( !dev_rem.empty() ) - for( i=dev_rem.begin(); i!=dev_rem.end(); ++i ) - l.push_back(commitAction(DECREASE, cont->type(), - reduceText(false, *i), this, false)); countSubvolAddDel( add, rem ); if( rem>0 ) { @@ -745,6 +751,66 @@ } } + + int + Btrfs::extraFstabAdd(EtcFstab* fstab, const FstabChange& change) + { + if (getMount() == "/") + { + for (list<Subvolume>::iterator it = subvol.begin(); it != subvol.end(); ++it) + { + FstabChange tmp_change = change; + tmp_change.mount += (tmp_change.mount == "/" ? "" : "/") + it->path(); + tmp_change.opts.remove("defaults"); + tmp_change.opts.remove_if(string_starts_with("subvol=")); + tmp_change.opts.push_back("subvol=" + it->path()); + fstab->addEntry(tmp_change); + } + } + + return 0; + } + + + int + Btrfs::extraFstabUpdate(EtcFstab* fstab, const FstabKey& key, const FstabChange& change) + { + if (getMount() == "/") + { + for (list<Subvolume>::iterator it = subvol.begin(); it != subvol.end(); ++it) + { + FstabKey tmp_key(key); + tmp_key.mount += (tmp_key.mount == "/" ? "" : "/") + it->path(); + FstabChange tmp_change = change; + tmp_change.mount += (tmp_change.mount == "/" ? "" : "/") + it->path(); + tmp_change.opts.remove("defaults"); + tmp_change.opts.remove_if(string_starts_with("subvol=")); + tmp_change.opts.push_back("subvol=" + it->path()); + fstab->updateEntry(tmp_key, tmp_change); + } + } + + return 0; + } + + + int + Btrfs::extraFstabRemove(EtcFstab* fstab, const FstabKey& key) + { + if (getMount() == "/") + { + for (list<Subvolume>::iterator it = subvol.begin(); it != subvol.end(); ++it) + { + FstabKey tmp_key(key); + tmp_key.mount += (tmp_key.mount == "/" ? "" : "/") + it->path(); + fstab->removeEntry(tmp_key); + } + } + + return 0; + } + + Text Btrfs::extendText(bool doing, const string& dev) const { @@ -905,8 +971,7 @@ log << " DevRem:" << tmp; tmp.erase(); - list<Subvolume>::const_iterator s; - for( s=subvol.begin(); s!=subvol.end(); ++s ) + for (list<Subvolume>::const_iterator s = subvol.begin(); s != subvol.end(); ++s) { if( s->deleted() ) tmp += "<--" + s->path(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.25.4/storage/Btrfs.h new/libstorage-2.25.5/storage/Btrfs.h --- old/libstorage-2.25.4/storage/Btrfs.h 2013-09-30 09:45:17.000000000 +0200 +++ new/libstorage-2.25.5/storage/Btrfs.h 2013-12-16 14:37:47.000000000 +0100 @@ -103,6 +103,10 @@ list<Subvolume> subvol; Volume const * findRealVolume() const; + virtual int extraFstabAdd(EtcFstab* fstab, const FstabChange& change) override; + virtual int extraFstabUpdate(EtcFstab* fstab, const FstabKey& key, const FstabChange& change) override; + virtual int extraFstabRemove(EtcFstab* fstab, const FstabKey& key) override; + private: Btrfs& operator=(const Btrfs& v); // disallow diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.25.4/storage/BtrfsCo.cc new/libstorage-2.25.5/storage/BtrfsCo.cc --- old/libstorage-2.25.4/storage/BtrfsCo.cc 2013-06-14 10:35:56.000000000 +0200 +++ new/libstorage-2.25.5/storage/BtrfsCo.cc 2013-12-16 14:37:47.000000000 +0100 @@ -31,7 +31,6 @@ #include "storage/ProcMounts.h" #include "storage/AppUtil.h" #include "storage/Storage.h" -#include "storage/EtcFstab.h" #include "storage/StorageDefines.h" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.25.4/storage/Container.cc new/libstorage-2.25.5/storage/Container.cc --- old/libstorage-2.25.4/storage/Container.cc 2013-12-03 18:00:09.000000000 +0100 +++ new/libstorage-2.25.5/storage/Container.cc 2013-12-12 15:07:58.000000000 +0100 @@ -385,14 +385,9 @@ void Container::getInfo(storage::ContainerInfo& info) const { - info.type = type(); - info.name = name(); - info.device = device(); - - info.udevPath = udevPath(); - info.udevId = udevId(); + Device::getInfo(info); - info.usedBy = list<UsedByInfo>(uby.begin(), uby.end()); + info.type = type(); info.readonly = readonly(); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.25.4/storage/Device.cc new/libstorage-2.25.5/storage/Device.cc --- old/libstorage-2.25.4/storage/Device.cc 2013-11-07 18:32:56.000000000 +0100 +++ new/libstorage-2.25.5/storage/Device.cc 2013-12-12 15:07:58.000000000 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) [2004-2010] Novell, Inc. + * Copyright (c) [2004-2013] Novell, Inc. * * All Rights Reserved. * @@ -165,6 +165,19 @@ } + void + Device::getInfo(DeviceInfo& info) const + { + info.name = name(); + info.device = device(); + + info.udevPath = udevPath(); + info.udevId = udevId(); + + info.usedBy = list<UsedByInfo>(uby.begin(), uby.end()); + } + + void Device::logDifference(std::ostream& log, const Device& rhs) const { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.25.4/storage/Device.h new/libstorage-2.25.5/storage/Device.h --- old/libstorage-2.25.4/storage/Device.h 2012-04-25 11:46:34.000000000 +0200 +++ new/libstorage-2.25.5/storage/Device.h 2013-12-12 15:07:58.000000000 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) [2004-2010] Novell, Inc. + * Copyright (c) [2004-2013] Novell, Inc. * * All Rights Reserved. * @@ -95,6 +95,8 @@ virtual list<string> getUsing() const { return list<string>(); } + void getInfo(DeviceInfo& info) const; + void logDifference(std::ostream& log, const Device& rhs) const; friend std::ostream& operator<<(std::ostream& s, const Device& d); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.25.4/storage/Disk.cc new/libstorage-2.25.5/storage/Disk.cc --- old/libstorage-2.25.4/storage/Disk.cc 2013-12-03 18:00:09.000000000 +0100 +++ new/libstorage-2.25.5/storage/Disk.cc 2013-12-13 15:03:42.000000000 +0100 @@ -733,7 +733,7 @@ const string Disk::p_disks[] = { "cciss/", "ida/", "ataraid/", "etherd/", "rd/", "mmcblk[0-9]+", - "md[0-9]+", "rsxx[0-9]+" }; + "md[0-9]+", "rsxx[0-9]+", "nvme[0-9]+n[0-9]+" }; bool diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.25.4/storage/EtcFstab.cc new/libstorage-2.25.5/storage/EtcFstab.cc --- old/libstorage-2.25.4/storage/EtcFstab.cc 2013-12-02 17:49:02.000000000 +0100 +++ new/libstorage-2.25.5/storage/EtcFstab.cc 2013-12-12 16:37:11.000000000 +0100 @@ -697,6 +697,21 @@ y2mil( "new line:" << line ); } + + void + EtcFstab::dump() const + { + y2mil("fstab ops dump"); + + for (list<Entry>::const_iterator it = co.begin(); it != co.end(); ++it) + { + y2mil("op:" << toString(it->op) << " old.device:" << it->old.device << + " old.mount:" << it->old.mount << " new.device:" << it->nnew.device << + " new.mount:" << it->nnew.mount); + } + } + + int EtcFstab::flush() { int ret = 0; @@ -714,7 +729,7 @@ { case Entry::REMOVE: { - y2mil( "REMOVE:" << i->old.device ); + y2mil("REMOVE:" << i->old.device << " " << i->old.mount); int lineno; cur = findFile( i->old, fstab, cryptotab, lineno ); if( lineno>=0 ) @@ -737,7 +752,7 @@ case Entry::UPDATE: { - y2mil( "UPDATE:" << i->nnew.device ); + y2mil("UPDATE:" << i->nnew.device << " " << i->nnew.mount); int lineno; cur = findFile( i->old, fstab, cryptotab, lineno ); if( lineno<0 ) @@ -798,12 +813,13 @@ } else ret = FSTAB_UPDATE_ENTRY_NOT_FOUND; + ++i; } break; case Entry::ADD: { int lineno; - y2mil( "ADD:" << i->nnew.device ); + y2mil("ADD:" << i->nnew.device << " " << i->nnew.mount); cur = findFile( i->nnew, fstab, cryptotab, lineno ); string line = createTabLine( i->nnew ); string before_dev; @@ -846,12 +862,13 @@ } i->old = i->nnew; i->op = Entry::NONE; + ++i; } break; default: + ++i; break; } - ++i; } if( fstab != NULL ) { @@ -1023,4 +1040,9 @@ const unsigned EtcFstab::cryptotabFields[] = { 11, 15, 20, 10, 10, 1 }; const unsigned EtcFstab::crypttabFields[] = { 15, 20, 10, 1 }; + + const vector<string> EnumInfo<EtcFstab::Entry::Operation>::names({ + "NONE", "ADD", "UPDATE", "REMOVE" + }); + } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.25.4/storage/EtcFstab.h new/libstorage-2.25.5/storage/EtcFstab.h --- old/libstorage-2.25.4/storage/EtcFstab.h 2013-12-02 17:49:02.000000000 +0100 +++ new/libstorage-2.25.5/storage/EtcFstab.h 2013-12-12 16:37:11.000000000 +0100 @@ -29,6 +29,7 @@ #include "storage/StorageInterface.h" #include "storage/AppUtil.h" +#include "storage/Enum.h" namespace storage @@ -139,9 +140,9 @@ struct Entry { - enum operation { NONE, ADD, REMOVE, UPDATE }; - Entry(operation op = NONE) : op(op) {} - operation op; + enum Operation { NONE, ADD, UPDATE, REMOVE }; + Entry(Operation op = NONE) : op(op) {} + Operation op; FstabEntry nnew; FstabEntry old; }; @@ -175,6 +176,8 @@ static string fstabEncode(const string&); static string fstabDecode(const string&); + void dump() const; + static const unsigned fstabFields[6]; static const unsigned cryptotabFields[6]; static const unsigned crypttabFields[6]; @@ -183,6 +186,9 @@ list<Entry> co; }; + + template <> struct EnumInfo<EtcFstab::Entry::Operation> { static const vector<string> names; }; + } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.25.4/storage/Storage.cc new/libstorage-2.25.5/storage/Storage.cc --- old/libstorage-2.25.4/storage/Storage.cc 2013-12-03 18:00:09.000000000 +0100 +++ new/libstorage-2.25.5/storage/Storage.cc 2013-12-12 15:07:58.000000000 +0100 @@ -4866,8 +4866,7 @@ void Storage::getCommitInfos(list<CommitInfo>& infos) const { - static list<CommitInfo> s_infos; // workaround for broken ycp bindings - s_infos.clear(); + infos.clear(); const list<commitAction> ca = getCommitActions(); for (list<commitAction>::const_iterator i = ca.begin(); i != ca.end(); ++i) @@ -4881,10 +4880,9 @@ info.text += ". "; info.text += v->getDescText(); } - s_infos.push_back(info); + infos.push_back(info); } - infos = s_infos; y2mil("infos.size:" << infos.size()); } @@ -5313,11 +5311,10 @@ int Storage::getContVolInfo(const string& device, ContVolInfo& info) { - static ContVolInfo s_info; // workaround for broken ycp bindings int ret = STORAGE_VOLUME_NOT_FOUND; ConstContIterator c; ConstVolIterator v; - s_info.ctype = CUNKNOWN; + info.ctype = CUNKNOWN; assertInit(); if (findVolume(device, c, v)) { @@ -5330,24 +5327,23 @@ findVolume(b->device(), c, v, true); } } - s_info.ctype = c->type(); - s_info.cname = c->name(); - s_info.cdevice = c->device(); - s_info.vname = v->name(); - s_info.vdevice = v->device(); + info.ctype = c->type(); + info.cname = c->name(); + info.cdevice = c->device(); + info.vname = v->name(); + info.vdevice = v->device(); if( v->isNumeric() ) - s_info.num = v->nr(); + info.num = v->nr(); } else if (findContainer(device, c)) { ret = 0; - s_info.ctype = c->type(); - s_info.cname = c->name(); - s_info.cdevice = c->device(); - s_info.vname = ""; - s_info.vdevice = ""; + info.ctype = c->type(); + info.cname = c->name(); + info.cdevice = c->device(); + info.vname = ""; + info.vdevice = ""; } - info = s_info; y2mil("device:" << device << " ret:" << ret << " cname:" << info.cname << " vname:" << info.vname); return ret; @@ -7037,9 +7033,8 @@ bool Storage::readFstab( const string& dir, deque<VolumeInfo>& infos ) { - static deque<VolumeInfo> s_infos; // workaround for broken ycp bindings static Regex disk_part( "^/dev/[sh]d[a-z]+[0-9]+$" ); - s_infos.clear(); + infos.clear(); bool ret = false; ConstVolIterator vol; assertInit(); @@ -7060,7 +7055,7 @@ info.mount_by = MOUNTBY_DEVICE; info.fs = toValueWithFallback(i->fs, FSUNKNOWN); info.fstab_options = boost::join( i->opts, "," ); - s_infos.push_back(info); + infos.push_back(info); } else if( findVolume( i->dentry, vol )||findVolume( i->device, vol ) ) { @@ -7068,10 +7063,9 @@ vol->getInfo( info ); vol->mergeFstabInfo( info, *i ); y2mil( "volume:" << *vol ); - s_infos.push_back(info); + infos.push_back(info); } } - infos = s_infos; ret = !infos.empty(); y2mil("ret:" << ret); return ret; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.25.4/storage/StorageInterface.h new/libstorage-2.25.5/storage/StorageInterface.h --- old/libstorage-2.25.4/storage/StorageInterface.h 2013-12-03 19:02:44.000000000 +0100 +++ new/libstorage-2.25.5/storage/StorageInterface.h 2013-12-12 15:07:58.000000000 +0100 @@ -276,18 +276,27 @@ }; - /** - * Contains info about a generic container. - */ - struct ContainerInfo + struct DeviceInfo { - ContainerInfo() {} - CType type; + DeviceInfo() {} + string device; string name; + string udevPath; list<string> udevId; + list<UsedByInfo> usedBy; + }; + + + /** + * Contains info about a generic container. + */ + struct ContainerInfo : public DeviceInfo + { + ContainerInfo() {} + CType type; bool readonly; }; @@ -359,20 +368,15 @@ /** * Contains info about a volume. */ - struct VolumeInfo + struct VolumeInfo : public DeviceInfo { VolumeInfo() {} unsigned long long sizeK; unsigned long major; unsigned long minor; - string name; - string device; string mount; string crypt_device; MountByType mount_by; - string udevPath; - list<string> udevId; - list<UsedByInfo> usedBy; bool ignore_fstab; string fstab_options; string uuid; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.25.4/storage/Volume.cc new/libstorage-2.25.5/storage/Volume.cc --- old/libstorage-2.25.4/storage/Volume.cc 2013-12-03 18:00:09.000000000 +0100 +++ new/libstorage-2.25.5/storage/Volume.cc 2013-12-16 14:37:47.000000000 +0100 @@ -3053,6 +3053,8 @@ getStorage()->showInfoCb(fstab->removeText(true, entry.cryptotab, entry.mount), silent); y2mil("before removeEntry"); ret = fstab->removeEntry(FstabKey(entry.device, entry.mount)); + if (ret == 0) + ret = extraFstabRemove(fstab, FstabKey(entry.device, entry.mount)); } else if ((!mp.empty() || pvEncryption()) && !deleted()) { @@ -3119,6 +3121,8 @@ } y2mil( "update fstab: " << che ); ret = fstab->updateEntry(FstabKey(che.device, orig_mp), che); + if (ret == 0) + ret = extraFstabUpdate(fstab, FstabKey(che.device, orig_mp), che); } } else @@ -3144,6 +3148,8 @@ getStorage()->showInfoCb( fstab->addText( true, inCryptotab(), che.mount ),silent); ret = fstab->addEntry( che ); + if (ret == 0) + ret = extraFstabAdd(fstab, che); fstab_added = true; } } @@ -3359,21 +3365,16 @@ void Volume::getInfo( VolumeInfo& info ) const { + Device::getInfo(info); + info.sizeK = size_k; info.major = mjr; info.minor = mnr; - info.name = nm; - info.device = dev; if( dmcrypt() ) info.crypt_device = dmcrypt_dev; info.mount = mp; info.mount_by = mount_by; - info.udevPath = udevPath(); - info.udevId = udevId(); - - info.usedBy = list<UsedByInfo>(uby.begin(), uby.end()); - info.ignore_fstab = ignore_fstab; info.fstab_options = fstab_opt; info.uuid = uuid; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.25.4/storage/Volume.h new/libstorage-2.25.5/storage/Volume.h --- old/libstorage-2.25.4/storage/Volume.h 2013-09-30 09:45:17.000000000 +0200 +++ new/libstorage-2.25.5/storage/Volume.h 2013-12-16 14:37:47.000000000 +0100 @@ -40,6 +40,8 @@ class ProcMounts; class EtcFstab; class FstabEntry; +class FstabChange; +class FstabKey; class Container; class Storage; @@ -254,6 +256,11 @@ storage::EncryptType detectEncryption(); string getFilesysSysfsPath() const; + virtual int extraFstabAdd(EtcFstab* fstab, const FstabChange& change) { return 0; } + virtual int extraFstabUpdate(EtcFstab* fstab, const FstabKey& key, + const FstabChange& change) { return 0; } + virtual int extraFstabRemove(EtcFstab* fstab, const FstabKey& key) { return 0; } + const Container* const cont; bool numeric; bool format; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.25.4/storage/gen_md5sum.cc new/libstorage-2.25.5/storage/gen_md5sum.cc --- old/libstorage-2.25.4/storage/gen_md5sum.cc 2013-12-03 19:03:31.000000000 +0100 +++ new/libstorage-2.25.5/storage/gen_md5sum.cc 2013-12-16 14:38:56.000000000 +0100 @@ -1,5 +1,5 @@ -#define SOURCES_MD5SUM "d64421ade2c79b6575eec868e10e6ef3" -#define SOURCES_MD5_DATE " Tue 3 Dec 19:03:31 CET 2013 " +#define SOURCES_MD5SUM "f76090c7c625b521bc92127c5ca7abee" +#define SOURCES_MD5_DATE " Mon 16 Dec 14:38:56 CET 2013 " namespace storage { const char* GetSourceMd5() { return SOURCES_MD5SUM; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.25.4/testsuite/fstab-ng-remove.cc new/libstorage-2.25.5/testsuite/fstab-ng-remove.cc --- old/libstorage-2.25.4/testsuite/fstab-ng-remove.cc 2013-11-29 18:11:51.000000000 +0100 +++ new/libstorage-2.25.5/testsuite/fstab-ng-remove.cc 2013-12-12 16:33:48.000000000 +0100 @@ -84,6 +84,38 @@ } +void +test4() +{ + cout << "test4" << endl; + + setup_system("empty"); + + write_fstab({ "LABEL=test /test1 btrfs defaults 0 0", + "LABEL=test /test1/sub1 btrfs defaults 0 0", + "LABEL=test /test1/sub2 btrfs defaults 0 0", + "LABEL=test /test1/sub3 btrfs defaults 0 0" }); + EtcFstab fstab("tmp/etc"); + + fstab.setDevice("/dev/sdb1", {}, "", "test", {}, ""); + + FstabKey key1("/dev/sdb1", "/test1"); + FstabKey key2("/dev/sdb1", "/test1/sub1"); + FstabKey key3("/dev/sdb1", "/test1/sub2"); + FstabKey key4("/dev/sdb1", "/test1/sub3"); + + fstab.removeEntry(key1); + fstab.removeEntry(key2); + fstab.removeEntry(key3); + fstab.removeEntry(key4); + fstab.flush(); + + print_fstab(); + + cout << endl; +} + + int main() { @@ -92,4 +124,5 @@ test1(); test2(); test3(); + test4(); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.25.4/testsuite/single.out/fstab-ng-remove.out new/libstorage-2.25.5/testsuite/single.out/fstab-ng-remove.out --- old/libstorage-2.25.4/testsuite/single.out/fstab-ng-remove.out 2013-11-29 11:35:10.000000000 +0100 +++ new/libstorage-2.25.5/testsuite/single.out/fstab-ng-remove.out 2013-12-12 16:33:48.000000000 +0100 @@ -16,3 +16,7 @@ LABEL=test /test1/sub2 btrfs defaults 0 0 end of fstab +test4 +begin of fstab +end of fstab + -- To unsubscribe, e-mail: opensuse-commit+unsubscr...@opensuse.org For additional commands, e-mail: opensuse-commit+h...@opensuse.org