Hello community, here is the log from the commit of package libstorage for openSUSE:Factory checked in at 2014-03-27 06:14:22 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 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-03-21 12:14:23.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.libstorage.new/libstorage.changes 2014-03-27 06:14:23.000000000 +0100 @@ -1,0 +2,11 @@ +Tue Mar 25 16:58:09 CET 2014 - aschn...@suse.de + +- fixed type visibility for gcc 4.9 + +------------------------------------------------------------------- +Tue Mar 25 13:54:38 CET 2014 - aschn...@suse.de + +- fixed btrfs subvolume detection (bnc#869764) +- 2.25.11 + +------------------------------------------------------------------- Old: ---- libstorage-2.25.10.tar.bz2 New: ---- libstorage-2.25.11.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libstorage.spec ++++++ --- /var/tmp/diff_new_pack.Ihjfty/_old 2014-03-27 06:14:24.000000000 +0100 +++ /var/tmp/diff_new_pack.Ihjfty/_new 2014-03-27 06:14:24.000000000 +0100 @@ -17,7 +17,7 @@ Name: libstorage -Version: 2.25.10 +Version: 2.25.11 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build Source: libstorage-%{version}.tar.bz2 ++++++ libstorage-2.25.10.tar.bz2 -> libstorage-2.25.11.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.25.10/VERSION new/libstorage-2.25.11/VERSION --- old/libstorage-2.25.10/VERSION 2014-03-17 14:46:40.000000000 +0100 +++ new/libstorage-2.25.11/VERSION 2014-03-25 14:10:55.000000000 +0100 @@ -1 +1 @@ -2.25.10 +2.25.11 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.25.10/examples/SystemInfo/Makefile.am new/libstorage-2.25.11/examples/SystemInfo/Makefile.am --- old/libstorage-2.25.10/examples/SystemInfo/Makefile.am 2014-03-13 14:54:46.000000000 +0100 +++ new/libstorage-2.25.11/examples/SystemInfo/Makefile.am 2014-03-20 15:47:41.000000000 +0100 @@ -7,7 +7,7 @@ LDADD = ../../storage/libstorage.la noinst_PROGRAMS = test-blkid test-cmdbtrfsshow test-cmddmsetupinfo \ - test-cmdvgdisplay test-cmdvgs test-lsscsi test-majorminor \ + test-cmdvgdisplay test-cmdvgs test-dir test-lsscsi test-majorminor \ test-mdadmdetail test-mdadmexamine test-mdlinks test-parted \ test-procmdstat test-procmounts test-procparts test-udevmap @@ -16,6 +16,7 @@ test_cmddmsetupinfo_SOURCES = test-cmddmsetupinfo.cc test_cmdvgdisplay_SOURCES = test-cmdvgdisplay.cc test_cmdvgs_SOURCES = test-cmdvgs.cc +test_dir_SOURCES = test-dir.cc test_lsscsi_SOURCES = test-lsscsi.cc test_majorminor_SOURCES = test-majorminor.cc test_mdadmdetail_SOURCES = test-mdadmdetail.cc diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.25.10/examples/SystemInfo/Makefile.in new/libstorage-2.25.11/examples/SystemInfo/Makefile.in --- old/libstorage-2.25.10/examples/SystemInfo/Makefile.in 2014-03-19 10:27:34.000000000 +0100 +++ new/libstorage-2.25.11/examples/SystemInfo/Makefile.in 2014-03-25 17:12:58.000000000 +0100 @@ -84,7 +84,7 @@ host_triplet = @host@ noinst_PROGRAMS = test-blkid$(EXEEXT) test-cmdbtrfsshow$(EXEEXT) \ test-cmddmsetupinfo$(EXEEXT) test-cmdvgdisplay$(EXEEXT) \ - test-cmdvgs$(EXEEXT) test-lsscsi$(EXEEXT) \ + test-cmdvgs$(EXEEXT) test-dir$(EXEEXT) test-lsscsi$(EXEEXT) \ test-majorminor$(EXEEXT) test-mdadmdetail$(EXEEXT) \ test-mdadmexamine$(EXEEXT) test-mdlinks$(EXEEXT) \ test-parted$(EXEEXT) test-procmdstat$(EXEEXT) \ @@ -126,6 +126,10 @@ test_cmdvgs_OBJECTS = $(am_test_cmdvgs_OBJECTS) test_cmdvgs_LDADD = $(LDADD) test_cmdvgs_DEPENDENCIES = ../../storage/libstorage.la +am_test_dir_OBJECTS = test-dir.$(OBJEXT) +test_dir_OBJECTS = $(am_test_dir_OBJECTS) +test_dir_LDADD = $(LDADD) +test_dir_DEPENDENCIES = ../../storage/libstorage.la am_test_lsscsi_OBJECTS = test-lsscsi.$(OBJEXT) test_lsscsi_OBJECTS = $(am_test_lsscsi_OBJECTS) test_lsscsi_LDADD = $(LDADD) @@ -202,20 +206,20 @@ am__v_CXXLD_1 = SOURCES = $(test_blkid_SOURCES) $(test_cmdbtrfsshow_SOURCES) \ $(test_cmddmsetupinfo_SOURCES) $(test_cmdvgdisplay_SOURCES) \ - $(test_cmdvgs_SOURCES) $(test_lsscsi_SOURCES) \ - $(test_majorminor_SOURCES) $(test_mdadmdetail_SOURCES) \ - $(test_mdadmexamine_SOURCES) $(test_mdlinks_SOURCES) \ - $(test_parted_SOURCES) $(test_procmdstat_SOURCES) \ - $(test_procmounts_SOURCES) $(test_procparts_SOURCES) \ - $(test_udevmap_SOURCES) + $(test_cmdvgs_SOURCES) $(test_dir_SOURCES) \ + $(test_lsscsi_SOURCES) $(test_majorminor_SOURCES) \ + $(test_mdadmdetail_SOURCES) $(test_mdadmexamine_SOURCES) \ + $(test_mdlinks_SOURCES) $(test_parted_SOURCES) \ + $(test_procmdstat_SOURCES) $(test_procmounts_SOURCES) \ + $(test_procparts_SOURCES) $(test_udevmap_SOURCES) DIST_SOURCES = $(test_blkid_SOURCES) $(test_cmdbtrfsshow_SOURCES) \ $(test_cmddmsetupinfo_SOURCES) $(test_cmdvgdisplay_SOURCES) \ - $(test_cmdvgs_SOURCES) $(test_lsscsi_SOURCES) \ - $(test_majorminor_SOURCES) $(test_mdadmdetail_SOURCES) \ - $(test_mdadmexamine_SOURCES) $(test_mdlinks_SOURCES) \ - $(test_parted_SOURCES) $(test_procmdstat_SOURCES) \ - $(test_procmounts_SOURCES) $(test_procparts_SOURCES) \ - $(test_udevmap_SOURCES) + $(test_cmdvgs_SOURCES) $(test_dir_SOURCES) \ + $(test_lsscsi_SOURCES) $(test_majorminor_SOURCES) \ + $(test_mdadmdetail_SOURCES) $(test_mdadmexamine_SOURCES) \ + $(test_mdlinks_SOURCES) $(test_parted_SOURCES) \ + $(test_procmdstat_SOURCES) $(test_procmounts_SOURCES) \ + $(test_procparts_SOURCES) $(test_udevmap_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ @@ -392,6 +396,7 @@ test_cmddmsetupinfo_SOURCES = test-cmddmsetupinfo.cc test_cmdvgdisplay_SOURCES = test-cmdvgdisplay.cc test_cmdvgs_SOURCES = test-cmdvgs.cc +test_dir_SOURCES = test-dir.cc test_lsscsi_SOURCES = test-lsscsi.cc test_majorminor_SOURCES = test-majorminor.cc test_mdadmdetail_SOURCES = test-mdadmdetail.cc @@ -466,6 +471,10 @@ @rm -f test-cmdvgs$(EXEEXT) $(AM_V_CXXLD)$(CXXLINK) $(test_cmdvgs_OBJECTS) $(test_cmdvgs_LDADD) $(LIBS) +test-dir$(EXEEXT): $(test_dir_OBJECTS) $(test_dir_DEPENDENCIES) $(EXTRA_test_dir_DEPENDENCIES) + @rm -f test-dir$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(test_dir_OBJECTS) $(test_dir_LDADD) $(LIBS) + test-lsscsi$(EXEEXT): $(test_lsscsi_OBJECTS) $(test_lsscsi_DEPENDENCIES) $(EXTRA_test_lsscsi_DEPENDENCIES) @rm -f test-lsscsi$(EXEEXT) $(AM_V_CXXLD)$(CXXLINK) $(test_lsscsi_OBJECTS) $(test_lsscsi_LDADD) $(LIBS) @@ -517,6 +526,7 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-cmddmsetupinfo.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-cmdvgdisplay.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-cmdvgs.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-dir.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-lsscsi.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-majorminor.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-mdadmdetail.Po@am__quote@ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.25.10/examples/SystemInfo/test-dir.cc new/libstorage-2.25.11/examples/SystemInfo/test-dir.cc --- old/libstorage-2.25.10/examples/SystemInfo/test-dir.cc 1970-01-01 01:00:00.000000000 +0100 +++ new/libstorage-2.25.11/examples/SystemInfo/test-dir.cc 2014-03-20 15:47:41.000000000 +0100 @@ -0,0 +1,34 @@ + +#include <iostream> + +#include <storage/SystemInfo/SystemInfo.h> + +using namespace std; +using namespace storage; + + +void +test_dir(SystemInfo& systeminfo, const string& path) +{ + try + { + const Dir& dir = systeminfo.getDir(path); + cout << "Dir success for '" << path << "'" << endl; + cout << dir << endl; + } + catch (const exception& e) + { + cerr << "Dir failed for '" << path << "'" << endl; + } +} + + +int +main() +{ + createLogger("/var/log/YaST2", "libstorage"); + + SystemInfo systeminfo; + + test_dir(systeminfo, "/sys/block"); +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.25.10/storage/AppUtil.cc new/libstorage-2.25.11/storage/AppUtil.cc --- old/libstorage-2.25.10/storage/AppUtil.cc 2014-03-14 15:23:48.000000000 +0100 +++ new/libstorage-2.25.11/storage/AppUtil.cc 2014-03-20 15:47:41.000000000 +0100 @@ -525,6 +525,39 @@ } + list<string> + getDir(const string& path) + { + int fd = open(path.c_str(), O_RDONLY | O_CLOEXEC); + if (fd < 0) + { + throw runtime_error("open failed for " + path); + } + + DIR* dir = fdopendir(fd); + if (dir == NULL) + { + close(fd); + throw runtime_error("fdopendir failed for " + path); + } + + list<string> entries; + + struct dirent* entry; + while ((entry = readdir(dir)) != NULL) + { + if (strcmp(entry->d_name, ".") == 0 || strcmp(entry->d_name, "..") == 0) + continue; + + entries.push_back(entry->d_name); + } + + closedir(dir); + + return entries; + } + + map<string, string> getDirLinks(const string& path) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.25.10/storage/AppUtil.h new/libstorage-2.25.11/storage/AppUtil.h --- old/libstorage-2.25.10/storage/AppUtil.h 2014-03-14 15:23:48.000000000 +0100 +++ new/libstorage-2.25.11/storage/AppUtil.h 2014-03-20 15:47:41.000000000 +0100 @@ -76,6 +76,7 @@ string udevEncode(const string&); string udevDecode(const string&); + list<string> getDir(const string& path); map<string, string> getDirLinks(const string& path); bool mkdtemp(string& path); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.25.10/storage/Btrfs.cc new/libstorage-2.25.11/storage/Btrfs.cc --- old/libstorage-2.25.10/storage/Btrfs.cc 2014-03-06 17:30:22.000000000 +0100 +++ new/libstorage-2.25.11/storage/Btrfs.cc 2014-03-25 14:03:16.000000000 +0100 @@ -145,7 +145,7 @@ if( !mp.empty() ) { clearSubvol(); - SystemCmd cmd(BTRFSBIN " subvolume list " + quote(mp)); + SystemCmd cmd(BTRFSBIN " subvolume list -a " + quote(mp)); for( vector<string>::const_iterator s=cmd.stdout().begin(); s!=cmd.stdout().end(); ++s ) { @@ -162,6 +162,8 @@ 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)); + if (boost::starts_with(subvol, "<FS_TREE>/")) + subvol.erase(0, 10); // Subvolume can already be deleted, in which case level is "0" // (and path "DELETED"). That is a temporary state. @@ -767,7 +769,7 @@ { string def_subvol = getStorage()->getDefaultSubvolName(); - for (list<Subvolume>::iterator it = subvol.begin(); it != subvol.end(); ++it) + for (list<Subvolume>::const_iterator it = subvol.begin(); it != subvol.end(); ++it) { string path = it->path(); if (!def_subvol.empty() && boost::starts_with(it->path(), def_subvol + "/")) @@ -793,14 +795,14 @@ { string def_subvol = getStorage()->getDefaultSubvolName(); - for (list<Subvolume>::iterator it = subvol.begin(); it != subvol.end(); ++it) + for (list<Subvolume>::const_iterator it = subvol.begin(); it != subvol.end(); ++it) { string path = it->path(); if (!def_subvol.empty() && boost::starts_with(it->path(), def_subvol + "/")) path = path.substr(def_subvol.size() + 1); FstabKey tmp_key(key); - tmp_key.mount += (tmp_key.mount == "/" ? "" : "/") + it->path(); + tmp_key.mount += (tmp_key.mount == "/" ? "" : "/") + path; FstabChange tmp_change = change; tmp_change.mount += (tmp_change.mount == "/" ? "" : "/") + path; tmp_change.opts.remove("defaults"); @@ -821,7 +823,7 @@ { string def_subvol = getStorage()->getDefaultSubvolName(); - for (list<Subvolume>::iterator it = subvol.begin(); it != subvol.end(); ++it) + for (list<Subvolume>::const_iterator it = subvol.begin(); it != subvol.end(); ++it) { string path = it->path(); if (!def_subvol.empty() && boost::starts_with(it->path(), def_subvol + "/")) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.25.10/storage/EtcFstab.h new/libstorage-2.25.11/storage/EtcFstab.h --- old/libstorage-2.25.10/storage/EtcFstab.h 2014-01-22 10:39:57.000000000 +0100 +++ new/libstorage-2.25.11/storage/EtcFstab.h 2014-03-25 17:12:43.000000000 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) [2004-2013] Novell, Inc. + * Copyright (c) [2004-2014] Novell, Inc. * * All Rights Reserved. * @@ -151,6 +151,8 @@ FstabEntry old; }; + friend EnumInfo<Entry::Operation>; + void readFiles(); int findPrefix( const AsciiFile& tab, const string& mount ) const; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.25.10/storage/Storage.cc new/libstorage-2.25.11/storage/Storage.cc --- old/libstorage-2.25.10/storage/Storage.cc 2014-03-14 15:23:48.000000000 +0100 +++ new/libstorage-2.25.11/storage/Storage.cc 2014-03-21 17:06:30.000000000 +0100 @@ -765,47 +765,43 @@ } -bool Storage::getDiskList( list< pair< string, Disk::SysfsInfo > >& dlist ) + list<pair<string, Disk::SysfsInfo>> + Storage::getDiskList(SystemInfo& systeminfo) { - dlist.clear(); - DIR *Dir; - if( (Dir=opendir(SYSFSDIR))!=NULL ) + list<pair<string, Disk::SysfsInfo>> dlist; + + try { - struct dirent* Entry; - while( (Entry=readdir( Dir ))!=NULL ) + const Dir& dir = systeminfo.getDir(SYSFSDIR); + for (const string& dn : dir) { - string dn = Entry->d_name; - - if (dn == "." || dn == "..") - continue; - // we do not treat mds as disks although they can be partitioned since kernel 2.6.28 - if (boost::starts_with(dn, "md")||boost::starts_with(dn, "loop")) - continue; - - Disk::SysfsInfo sysfsinfo; - if (!Disk::getSysfsInfo(SYSFSDIR "/" + dn, sysfsinfo)) - continue; + // we do not treat mds as disks although they can be partitioned since kernel 2.6.28 + if (boost::starts_with(dn, "md") || boost::starts_with(dn, "loop")) + continue; + + Disk::SysfsInfo sysfsinfo; + if (!Disk::getSysfsInfo(SYSFSDIR "/" + dn, sysfsinfo)) + continue; - if( (sysfsinfo.range>1 && (sysfsinfo.size>0 || dn.find("dasd")==0)) || - (sysfsinfo.range==1 && sysfsinfo.size>0 && sysfsinfo.vbd) ) + if ((sysfsinfo.range > 1 && ( sysfsinfo.size > 0 || dn.find("dasd") == 0)) || + (sysfsinfo.range == 1 && sysfsinfo.size > 0 && sysfsinfo.vbd)) { - dlist.push_back( make_pair( dn, sysfsinfo ) ); + dlist.push_back(make_pair(dn, sysfsinfo)); } } - closedir( Dir ); } - else + catch (const runtime_error& e) { - y2err("Failed to open:" SYSFSDIR); + y2err("failed to get disks, " << e.what()); } - return( !dlist.empty() ); + + return dlist; } void Storage::autodetectDisks(SystemInfo& systeminfo) { - list< pair< string, Disk::SysfsInfo > > dlist; - getDiskList( dlist ); + list<pair<string, Disk::SysfsInfo>> dlist = getDiskList(systeminfo); list< pair< string, Disk::SysfsInfo > >::const_iterator i = dlist.begin(); list<DiskData> dl; while( i!=dlist.end() ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.25.10/storage/Storage.h new/libstorage-2.25.11/storage/Storage.h --- old/libstorage-2.25.10/storage/Storage.h 2014-03-04 18:04:21.000000000 +0100 +++ new/libstorage-2.25.11/storage/Storage.h 2014-03-20 15:47:41.000000000 +0100 @@ -582,7 +582,7 @@ static bool loadModuleIfNeeded( const string& module ); static void clean_tmpdir(); - static bool getDiskList( list< pair< string, Disk::SysfsInfo > >& dlist ); + static list<pair<string, Disk::SysfsInfo>> getDiskList(SystemInfo& systeminfo); void getDiskList( bool (* CheckFnc)( const Disk& ), list<Disk*>& dl ); void changeDeviceName( const string& old, const string& nw ); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.25.10/storage/SystemInfo/Dev.cc new/libstorage-2.25.11/storage/SystemInfo/Dev.cc --- old/libstorage-2.25.10/storage/SystemInfo/Dev.cc 2014-03-12 10:15:23.000000000 +0100 +++ new/libstorage-2.25.11/storage/SystemInfo/Dev.cc 1970-01-01 01:00:00.000000000 +0100 @@ -1,137 +0,0 @@ -/* - * Copyright (c) [2004-2014] Novell, Inc. - * - * All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, contact Novell, Inc. - * - * To contact Novell about this file by physical or electronic mail, you may - * find current contact information at www.novell.com. - */ - - -#include <stdexcept> -#include <boost/algorithm/string.hpp> - -#include "storage/SystemInfo/Dev.h" -#include "storage/AppUtil.h" - - -namespace storage -{ - using namespace std; - - - MajorMinor::MajorMinor(const string& device, bool do_probe) - : device(device) - { - if (do_probe) - probe(); - } - - - void - MajorMinor::probe() - { - struct stat buf; - if (stat(device.c_str(), &buf) != 0) - throw runtime_error(device + " not found"); - - if (!S_ISBLK(buf.st_mode)) - throw runtime_error(device + " not block device"); - - majorminor = buf.st_rdev; - - y2mil(*this); - } - - - std::ostream& operator<<(std::ostream& s, const MajorMinor& majorminor) - { - s << "device:" << majorminor.device << " majorminor:" << majorminor.getMajor() - << ":" << majorminor.getMinor(); - - return s; - } - - - std::ostream& operator<<(std::ostream& s, const DevLinks& devlinks) - { - for (const DevLinks::value_type& it : devlinks) - s << "data[" << it.first << "] -> " << boost::join(it.second, " ") << endl; - - return s; - } - - - UdevMap::UdevMap(const string& path, bool do_probe) - : path(path) - { - if (do_probe) - probe(); - } - - - void - UdevMap::probe() - { - map<string, string> links = getDirLinks(path); - for (const map<string, string>::value_type& it : links) - { - string::size_type pos = it.second.find_first_not_of("./"); - if (pos != string::npos) - { - string tmp = it.second.substr(pos); - if (boost::starts_with(tmp, "dev/")) - tmp.erase(0, 4); - data[tmp].push_back(udevDecode(it.first)); - } - } - - y2mil(*this); - } - - - std::ostream& operator<<(std::ostream& s, const UdevMap& udevmap) - { - s << "path:" << udevmap.path << endl; - s << dynamic_cast<const DevLinks&>(udevmap); - - return s; - } - - - MdLinks::MdLinks(bool do_probe) - { - if (do_probe) - probe(); - } - - - void - MdLinks::probe() - { - map<string, string> links = getDirLinks("/dev/md"); - for (const map<string, string>::value_type& it : links) - { - string::size_type pos = it.second.find_first_not_of("./"); - if (pos != string::npos) - { - data[it.second.substr(pos)].push_back(it.first); - } - } - - y2mil(*this); - } - -} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.25.10/storage/SystemInfo/Dev.h new/libstorage-2.25.11/storage/SystemInfo/Dev.h --- old/libstorage-2.25.10/storage/SystemInfo/Dev.h 2014-03-12 10:15:23.000000000 +0100 +++ new/libstorage-2.25.11/storage/SystemInfo/Dev.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,115 +0,0 @@ -/* - * Copyright (c) [2004-2014] Novell, Inc. - * - * All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, contact Novell, Inc. - * - * To contact Novell about this file by physical or electronic mail, you may - * find current contact information at www.novell.com. - */ - - -#ifndef DEV_H -#define DEV_H - - -#include <sys/types.h> -#include <sys/stat.h> -#include <unistd.h> - -#include <string> -#include <map> -#include <list> - - -namespace storage -{ - using std::string; - using std::map; - using std::list; - - - class MajorMinor - { - public: - - MajorMinor(const string& device, bool do_probe = true); - - void probe(); - - friend std::ostream& operator<<(std::ostream& s, const MajorMinor& majorminor); - - dev_t getMajorMinor() const { return majorminor; } - unsigned int getMajor() const { return gnu_dev_major(majorminor); } - unsigned int getMinor() const { return gnu_dev_minor(majorminor); } - - private: - - string device; - dev_t majorminor; - - }; - - - class DevLinks - { - public: - - typedef map<string, list<string>>::value_type value_type; - typedef map<string, list<string>>::const_iterator const_iterator; - - const_iterator begin() const { return data.begin(); } - const_iterator end() const { return data.end(); } - - const_iterator find(const string& nm) const { return data.find(nm); } - - friend std::ostream& operator<<(std::ostream& s, const DevLinks& devlinks); - - protected: - - map<string, list<string>> data; - - }; - - - class UdevMap : public DevLinks - { - public: - - UdevMap(const string& path, bool do_probe = true); - - void probe(); - - friend std::ostream& operator<<(std::ostream& s, const UdevMap& udevmap); - - private: - - string path; - - }; - - - class MdLinks : public DevLinks - { - public: - - MdLinks(bool do_probe = true); - - void probe(); - - }; - -} - -#endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.25.10/storage/SystemInfo/DevAndSys.cc new/libstorage-2.25.11/storage/SystemInfo/DevAndSys.cc --- old/libstorage-2.25.10/storage/SystemInfo/DevAndSys.cc 1970-01-01 01:00:00.000000000 +0100 +++ new/libstorage-2.25.11/storage/SystemInfo/DevAndSys.cc 2014-03-20 15:47:41.000000000 +0100 @@ -0,0 +1,163 @@ +/* + * Copyright (c) [2004-2014] Novell, Inc. + * + * All Rights Reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of version 2 of the GNU General Public License as published + * by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, contact Novell, Inc. + * + * To contact Novell about this file by physical or electronic mail, you may + * find current contact information at www.novell.com. + */ + + +#include <stdexcept> +#include <boost/algorithm/string.hpp> + +#include "storage/SystemInfo/DevAndSys.h" +#include "storage/AppUtil.h" +#include "storage/StorageTmpl.h" + + +namespace storage +{ + using namespace std; + + + MajorMinor::MajorMinor(const string& device, bool do_probe) + : device(device) + { + if (do_probe) + probe(); + } + + + void + MajorMinor::probe() + { + struct stat buf; + if (stat(device.c_str(), &buf) != 0) + throw runtime_error(device + " not found"); + + if (!S_ISBLK(buf.st_mode)) + throw runtime_error(device + " not block device"); + + majorminor = buf.st_rdev; + + y2mil(*this); + } + + + std::ostream& operator<<(std::ostream& s, const MajorMinor& majorminor) + { + s << "device:" << majorminor.device << " majorminor:" << majorminor.getMajor() + << ":" << majorminor.getMinor(); + + return s; + } + + + std::ostream& operator<<(std::ostream& s, const DevLinks& devlinks) + { + for (const DevLinks::value_type& it : devlinks) + s << "data[" << it.first << "] -> " << boost::join(it.second, " ") << endl; + + return s; + } + + + Dir::Dir(const string& path, bool do_probe) + : path(path) + { + if (do_probe) + probe(); + } + + + void + Dir::probe() + { + entries = getDir(path); + + y2mil(*this); + } + + + std::ostream& operator<<(std::ostream& s, const Dir& dir) + { + s << "path:" << dir.path << " entries:" << dir.entries << endl; + + return s; + } + + + UdevMap::UdevMap(const string& path, bool do_probe) + : path(path) + { + if (do_probe) + probe(); + } + + + void + UdevMap::probe() + { + map<string, string> links = getDirLinks(path); + for (const map<string, string>::value_type& it : links) + { + string::size_type pos = it.second.find_first_not_of("./"); + if (pos != string::npos) + { + string tmp = it.second.substr(pos); + if (boost::starts_with(tmp, "dev/")) + tmp.erase(0, 4); + data[tmp].push_back(udevDecode(it.first)); + } + } + + y2mil(*this); + } + + + std::ostream& operator<<(std::ostream& s, const UdevMap& udevmap) + { + s << "path:" << udevmap.path << endl; + s << dynamic_cast<const DevLinks&>(udevmap); + + return s; + } + + + MdLinks::MdLinks(bool do_probe) + { + if (do_probe) + probe(); + } + + + void + MdLinks::probe() + { + map<string, string> links = getDirLinks("/dev/md"); + for (const map<string, string>::value_type& it : links) + { + string::size_type pos = it.second.find_first_not_of("./"); + if (pos != string::npos) + { + data[it.second.substr(pos)].push_back(it.first); + } + } + + y2mil(*this); + } + +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.25.10/storage/SystemInfo/DevAndSys.h new/libstorage-2.25.11/storage/SystemInfo/DevAndSys.h --- old/libstorage-2.25.10/storage/SystemInfo/DevAndSys.h 1970-01-01 01:00:00.000000000 +0100 +++ new/libstorage-2.25.11/storage/SystemInfo/DevAndSys.h 2014-03-21 17:06:30.000000000 +0100 @@ -0,0 +1,138 @@ +/* + * Copyright (c) [2004-2014] Novell, Inc. + * + * All Rights Reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of version 2 of the GNU General Public License as published + * by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, contact Novell, Inc. + * + * To contact Novell about this file by physical or electronic mail, you may + * find current contact information at www.novell.com. + */ + + +#ifndef DEV_H +#define DEV_H + + +#include <sys/types.h> +#include <sys/stat.h> +#include <unistd.h> + +#include <string> +#include <map> +#include <list> + + +namespace storage +{ + using std::string; + using std::map; + using std::list; + + + class MajorMinor + { + public: + + MajorMinor(const string& device, bool do_probe = true); + + void probe(); + + friend std::ostream& operator<<(std::ostream& s, const MajorMinor& majorminor); + + dev_t getMajorMinor() const { return majorminor; } + unsigned int getMajor() const { return gnu_dev_major(majorminor); } + unsigned int getMinor() const { return gnu_dev_minor(majorminor); } + + private: + + string device; + dev_t majorminor; + + }; + + + class Dir + { + public: + + Dir(const string& path, bool do_probe = true); + + void probe(); + + typedef list<string>::const_iterator const_iterator; + + const_iterator begin() const { return entries.begin(); } + const_iterator end() const { return entries.end(); } + + friend std::ostream& operator<<(std::ostream& s, const Dir& dir); + + private: + + string path; + list<string> entries; + + }; + + + class DevLinks + { + public: + + typedef map<string, list<string>>::value_type value_type; + typedef map<string, list<string>>::const_iterator const_iterator; + + const_iterator begin() const { return data.begin(); } + const_iterator end() const { return data.end(); } + + const_iterator find(const string& nm) const { return data.find(nm); } + + friend std::ostream& operator<<(std::ostream& s, const DevLinks& devlinks); + + protected: + + map<string, list<string>> data; + + }; + + + class UdevMap : public DevLinks + { + public: + + UdevMap(const string& path, bool do_probe = true); + + void probe(); + + friend std::ostream& operator<<(std::ostream& s, const UdevMap& udevmap); + + private: + + string path; + + }; + + + class MdLinks : public DevLinks + { + public: + + MdLinks(bool do_probe = true); + + void probe(); + + }; + +} + +#endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.25.10/storage/SystemInfo/Makefile.am new/libstorage-2.25.11/storage/SystemInfo/Makefile.am --- old/libstorage-2.25.10/storage/SystemInfo/Makefile.am 2014-03-11 15:00:47.000000000 +0100 +++ new/libstorage-2.25.11/storage/SystemInfo/Makefile.am 2014-03-20 15:47:41.000000000 +0100 @@ -16,7 +16,7 @@ CmdLvm.cc CmdLvm.h \ CmdMultipath.cc CmdMultipath.h \ CmdParted.cc CmdParted.h \ - Dev.cc Dev.h \ + DevAndSys.cc DevAndSys.h \ ProcMdstat.cc ProcMdstat.h \ ProcMounts.cc ProcMounts.h \ ProcParts.cc ProcParts.h diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.25.10/storage/SystemInfo/Makefile.in new/libstorage-2.25.11/storage/SystemInfo/Makefile.in --- old/libstorage-2.25.10/storage/SystemInfo/Makefile.in 2014-03-19 10:27:34.000000000 +0100 +++ new/libstorage-2.25.11/storage/SystemInfo/Makefile.in 2014-03-25 17:12:58.000000000 +0100 @@ -97,8 +97,8 @@ libsysteminfo_la_LIBADD = am_libsysteminfo_la_OBJECTS = SystemInfo.lo CmdBlkid.lo CmdBtrfs.lo \ CmdCryptsetup.lo CmdDasdview.lo CmdDmraid.lo CmdDmsetup.lo \ - CmdLsscsi.lo CmdLvm.lo CmdMultipath.lo CmdParted.lo Dev.lo \ - ProcMdstat.lo ProcMounts.lo ProcParts.lo + CmdLsscsi.lo CmdLvm.lo CmdMultipath.lo CmdParted.lo \ + DevAndSys.lo ProcMdstat.lo ProcMounts.lo ProcParts.lo libsysteminfo_la_OBJECTS = $(am_libsysteminfo_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) @@ -340,7 +340,7 @@ CmdLvm.cc CmdLvm.h \ CmdMultipath.cc CmdMultipath.h \ CmdParted.cc CmdParted.h \ - Dev.cc Dev.h \ + DevAndSys.cc DevAndSys.h \ ProcMdstat.cc ProcMdstat.h \ ProcMounts.cc ProcMounts.h \ ProcParts.cc ProcParts.h @@ -410,7 +410,7 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CmdLvm.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CmdMultipath.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CmdParted.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Dev.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DevAndSys.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ProcMdstat.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ProcMounts.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ProcParts.Plo@am__quote@ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.25.10/storage/SystemInfo/SystemInfo.h new/libstorage-2.25.11/storage/SystemInfo/SystemInfo.h --- old/libstorage-2.25.10/storage/SystemInfo/SystemInfo.h 2014-03-13 14:54:46.000000000 +0100 +++ new/libstorage-2.25.11/storage/SystemInfo/SystemInfo.h 2014-03-21 17:06:30.000000000 +0100 @@ -39,7 +39,7 @@ #include "storage/SystemInfo/CmdMultipath.h" #include "storage/SystemInfo/CmdBtrfs.h" #include "storage/SystemInfo/CmdLvm.h" -#include "storage/SystemInfo/Dev.h" +#include "storage/SystemInfo/DevAndSys.h" namespace storage @@ -56,6 +56,7 @@ SystemInfo(); ~SystemInfo(); + const Dir& getDir(const string& path) { return dirs.get(path); } const UdevMap& getUdevMap(const string& path) { return udevmaps.get(path); } const MdLinks& getMdLinks() { return mdlinks.get(); } const ProcParts& getProcParts() { return procparts.get(); } @@ -141,6 +142,7 @@ }; + LazyObjects<Dir> dirs; LazyObjects<UdevMap> udevmaps; LazyObject<MdLinks> mdlinks; LazyObject<ProcParts> procparts; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.25.10/storage/Utils.cc new/libstorage-2.25.11/storage/Utils.cc --- old/libstorage-2.25.10/storage/Utils.cc 2014-03-06 17:30:22.000000000 +0100 +++ new/libstorage-2.25.11/storage/Utils.cc 2014-03-20 15:47:41.000000000 +0100 @@ -34,10 +34,11 @@ list<string> getPresentDisks() { + SystemInfo systeminfo; + list<string> ret; - list<pair<string, Disk::SysfsInfo>> dlist; - Storage::getDiskList(dlist); + list<pair<string, Disk::SysfsInfo>> dlist = Storage::getDiskList(systeminfo); for (list<pair<string, Disk::SysfsInfo>>::const_iterator it = dlist.begin(); it != dlist.end(); ++it) ret.push_back("/dev/" + Disk::sysfsToDev(it->first)); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-2.25.10/storage/gen_md5sum.cc new/libstorage-2.25.11/storage/gen_md5sum.cc --- old/libstorage-2.25.10/storage/gen_md5sum.cc 2014-03-18 16:59:59.000000000 +0100 +++ new/libstorage-2.25.11/storage/gen_md5sum.cc 2014-03-25 17:14:01.000000000 +0100 @@ -1,5 +1,5 @@ -#define SOURCES_MD5SUM "e7689412f32615a5b5d996c9809064b7" -#define SOURCES_MD5_DATE " Tue 18 Mar 16:59:59 CET 2014 " +#define SOURCES_MD5SUM "7a86d4f2ac7025d9f57924e68be845ec" +#define SOURCES_MD5_DATE " Tue 25 Mar 17:14:01 CET 2014 " namespace storage { const char* GetSourceMd5() { return SOURCES_MD5SUM; } -- To unsubscribe, e-mail: opensuse-commit+unsubscr...@opensuse.org For additional commands, e-mail: opensuse-commit+h...@opensuse.org