Hello community,

here is the log from the commit of package libstorage for openSUSE:Factory
checked in at Fri Aug 12 09:41:09 CEST 2011.



--------
--- libstorage/libstorage.changes       2011-07-08 14:20:26.000000000 +0200
+++ /mounts/work_src_done/STABLE/libstorage/libstorage.changes  2011-08-11 
17:38:57.000000000 +0200
@@ -1,0 +2,47 @@
+Wed Aug 10 16:39:19 CEST 2011 - [email protected]
+
+- support label on btrfs 
+- version 2.21.4
+
+-------------------------------------------------------------------
+Tue Aug  9 16:29:08 CEST 2011 - [email protected]
+
+- fix bugs in subvolume handling during install
+
+-------------------------------------------------------------------
+Fri Aug 05 12:06:28 CEST 2011 - [email protected]
+
+- moved lock from to /var/run/libstorage (bnc#710356)
+
+-------------------------------------------------------------------
+Thu Aug  4 17:30:06 CEST 2011 - [email protected]
+
+- avoid crash when btrfs signature is on disk device (bnc#710043)
+  
+-------------------------------------------------------------------
+Tue Aug  2 14:03:30 CEST 2011 - [email protected]
+
+- call waitForDevice in checkDevice to work around possible
+  temporary device node removal by udev (bnc#709464)
+  
+-------------------------------------------------------------------
+Thu Jul 28 12:36:14 CEST 2011 - [email protected]
+
+- changes needed to fix bnc#707472
+
+-------------------------------------------------------------------
+Tue Jul 26 12:21:56 CEST 2011 - [email protected]
+
+- fixed commit action calculation for DASDs (bnc#706911)
+
+-------------------------------------------------------------------
+Tue Jul 19 17:17:10 CEST 2011 - [email protected]
+
+- fixed size calculation for very small partitions (bnc#705566)
+
+-------------------------------------------------------------------
+Tue Jul 19 15:17:48 CEST 2011 - [email protected]
+
+- fix failing testsuite if program without setup_system is first
+
+-------------------------------------------------------------------

calling whatdependson for head-i586


Old:
----
  libstorage-2.21.3.tar.bz2

New:
----
  libstorage-2.21.4.tar.bz2

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ libstorage.spec ++++++
--- /var/tmp/diff_new_pack.TCt90Y/_old  2011-08-12 09:39:44.000000000 +0200
+++ /var/tmp/diff_new_pack.TCt90Y/_new  2011-08-12 09:39:44.000000000 +0200
@@ -19,8 +19,8 @@
 
 
 Name:           libstorage
-Version:        2.21.3
-Release:        5
+Version:        2.21.4
+Release:        1
 License:        GPL
 Group:          System/Libraries
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
@@ -63,7 +63,8 @@
 %install
 make install DESTDIR="$RPM_BUILD_ROOT"
 
-install -d -m 755 $RPM_BUILD_ROOT/var/lock/libstorage
+install -d -m 755 $RPM_BUILD_ROOT/var/run/libstorage
+touch $RPM_BUILD_ROOT/var/run/libstorage/lock
 
 %{find_lang} libstorage
 
@@ -100,7 +101,7 @@
 %files -n libstorage3 -f libstorage.lang
 %defattr(-,root,root)
 %{_libdir}/libstorage.so.*
-%dir /var/lock/libstorage
+%ghost /var/run/libstorage
 /var/adm/fillup-templates/sysconfig.storage-libstorage
 %doc %dir %{prefix}/share/doc/packages/libstorage
 %doc %{prefix}/share/doc/packages/libstorage/AUTHORS

++++++ libstorage-2.21.3.tar.bz2 -> libstorage-2.21.4.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-2.21.3/VERSION 
new/libstorage-2.21.4/VERSION
--- old/libstorage-2.21.3/VERSION       2011-06-10 09:24:57.000000000 +0200
+++ new/libstorage-2.21.4/VERSION       2011-08-11 11:31:23.000000000 +0200
@@ -1 +1 @@
-2.21.3
+2.21.4
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-2.21.3/bindings/python/libstorage.py 
new/libstorage-2.21.4/bindings/python/libstorage.py
--- old/libstorage-2.21.3/bindings/python/libstorage.py 2011-07-05 
14:26:29.000000000 +0200
+++ new/libstorage-2.21.4/bindings/python/libstorage.py 2011-08-11 
17:36:00.000000000 +0200
@@ -428,6 +428,9 @@
     __swig_setmethods__["disklabel"] = _libstorage.DiskInfo_disklabel_set
     __swig_getmethods__["disklabel"] = _libstorage.DiskInfo_disklabel_get
     if _newclass:disklabel = 
_swig_property(_libstorage.DiskInfo_disklabel_get, 
_libstorage.DiskInfo_disklabel_set)
+    __swig_setmethods__["orig_disklabel"] = 
_libstorage.DiskInfo_orig_disklabel_set
+    __swig_getmethods__["orig_disklabel"] = 
_libstorage.DiskInfo_orig_disklabel_get
+    if _newclass:orig_disklabel = 
_swig_property(_libstorage.DiskInfo_orig_disklabel_get, 
_libstorage.DiskInfo_orig_disklabel_set)
     __swig_setmethods__["maxPrimary"] = _libstorage.DiskInfo_maxPrimary_set
     __swig_getmethods__["maxPrimary"] = _libstorage.DiskInfo_maxPrimary_get
     if _newclass:maxPrimary = 
_swig_property(_libstorage.DiskInfo_maxPrimary_get, 
_libstorage.DiskInfo_maxPrimary_set)
@@ -1019,6 +1022,12 @@
     __swig_setmethods__["subvol"] = _libstorage.BtrfsInfo_subvol_set
     __swig_getmethods__["subvol"] = _libstorage.BtrfsInfo_subvol_get
     if _newclass:subvol = _swig_property(_libstorage.BtrfsInfo_subvol_get, 
_libstorage.BtrfsInfo_subvol_set)
+    __swig_setmethods__["subvol_add"] = _libstorage.BtrfsInfo_subvol_add_set
+    __swig_getmethods__["subvol_add"] = _libstorage.BtrfsInfo_subvol_add_get
+    if _newclass:subvol_add = 
_swig_property(_libstorage.BtrfsInfo_subvol_add_get, 
_libstorage.BtrfsInfo_subvol_add_set)
+    __swig_setmethods__["subvol_rem"] = _libstorage.BtrfsInfo_subvol_rem_set
+    __swig_getmethods__["subvol_rem"] = _libstorage.BtrfsInfo_subvol_rem_get
+    if _newclass:subvol_rem = 
_swig_property(_libstorage.BtrfsInfo_subvol_rem_get, 
_libstorage.BtrfsInfo_subvol_rem_set)
     __swig_destroy__ = _libstorage.delete_BtrfsInfo
     __del__ = lambda self : None;
 BtrfsInfo_swigregister = _libstorage.BtrfsInfo_swigregister
@@ -1609,6 +1618,7 @@
     def modifyFileLoop(self, *args): return 
_libstorage.StorageInterface_modifyFileLoop(self, *args)
     def removeFileLoop(self, *args): return 
_libstorage.StorageInterface_removeFileLoop(self, *args)
     def removeDmraid(self, *args): return 
_libstorage.StorageInterface_removeDmraid(self, *args)
+    def existSubvolume(self, *args): return 
_libstorage.StorageInterface_existSubvolume(self, *args)
     def createSubvolume(self, *args): return 
_libstorage.StorageInterface_createSubvolume(self, *args)
     def removeSubvolume(self, *args): return 
_libstorage.StorageInterface_removeSubvolume(self, *args)
     def extendBtrfsVolume(self, *args): return 
_libstorage.StorageInterface_extendBtrfsVolume(self, *args)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-2.21.3/data/sysconfig.storage-libstorage 
new/libstorage-2.21.4/data/sysconfig.storage-libstorage
--- old/libstorage-2.21.3/data/sysconfig.storage-libstorage     2011-06-01 
10:13:38.000000000 +0200
+++ new/libstorage-2.21.4/data/sysconfig.storage-libstorage     2011-07-19 
15:16:45.000000000 +0200
@@ -4,7 +4,7 @@
 # Default mount-by method.
 DEVICE_NAMES="id"
 
-## Type: string(ext2,ext3,ext4,reiser,xfs)
+## Type: string(ext2,ext3,ext4,reiser,xfs,btrfs)
 # Default filesystem type.
 DEFAULT_FS="ext4"
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-2.21.3/libstorage.spec.in 
new/libstorage-2.21.4/libstorage.spec.in
--- old/libstorage-2.21.3/libstorage.spec.in    2011-06-17 11:38:28.000000000 
+0200
+++ new/libstorage-2.21.4/libstorage.spec.in    2011-08-09 13:39:49.000000000 
+0200
@@ -48,7 +48,8 @@
 %install
 make install DESTDIR="$RPM_BUILD_ROOT"
 
-install -d -m 755 $RPM_BUILD_ROOT/var/lock/libstorage
+install -d -m 755 $RPM_BUILD_ROOT/var/run/libstorage
+touch $RPM_BUILD_ROOT/var/run/libstorage/lock
 
 %{find_lang} libstorage
 
@@ -84,7 +85,7 @@
 %files -n libstorage@LIBVERSION_MAJOR@ -f libstorage.lang
 %defattr(-,root,root)
 %{_libdir}/libstorage.so.*
-%dir /var/lock/libstorage
+%ghost /var/run/libstorage
 /var/adm/fillup-templates/sysconfig.storage-libstorage
 %doc %dir %{prefix}/share/doc/packages/libstorage
 %doc %{prefix}/share/doc/packages/libstorage/AUTHORS
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-2.21.3/storage/Btrfs.cc 
new/libstorage-2.21.4/storage/Btrfs.cc
--- old/libstorage-2.21.3/storage/Btrfs.cc      2011-06-10 09:24:57.000000000 
+0200
+++ new/libstorage-2.21.4/storage/Btrfs.cc      2011-08-09 15:39:44.000000000 
+0200
@@ -42,6 +42,7 @@
     {
     y2mil("constructed btrfs vol size:" << sz << " devs:" << devs );
     y2mil("constructed btrfs vol from:" << v );
+    setFs(BTRFS);
     changeMountBy(MOUNTBY_UUID);
     setSize( sz );
     }
@@ -109,6 +110,22 @@
        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 )
+       {
+       ret = !i->deleted() && i->path()==name && (!getFormat()||i->created());
+       if( !ret )
+           ++i;
+       }
+    y2mil( "ret:" << ret );
+    return( ret );
+    }
+
 int
 Btrfs::createSubvolume( const string& name )
     {
@@ -117,12 +134,16 @@
     list<Subvolume>::iterator i=subvol.begin();
     while( i!=subvol.end() && !i->deleted() && i->path()!=name )
        ++i;
-    if( i==subvol.end() || getFormat() )
+    if( i==subvol.end() )
        {
        Subvolume v( name );
        v.setCreated();
        subvol.push_back( v );
        }
+    else if( getFormat() )
+       {
+       i->setCreated();
+       }
     else
        ret = BTRFS_SUBVOL_EXISTS;
     y2mil( "ret:" << ret );
@@ -698,14 +719,30 @@
     info.devices_add = boost::join( dev_add, "\n" );
     info.devices_rem = boost::join( dev_rem, "\n" );
     info.subvol.erase();
+    info.subvol_add.erase();
+    info.subvol_rem.erase();
 
     for( list<Subvolume>::const_iterator i=subvol.begin(); 
         i!=subvol.end(); ++i )
         {
-        if( !info.subvol.empty() )
-           info.subvol += '\n';
-        if( !i->deleted() )
-           info.subvol += i->path();
+        if( i->deleted() )
+            {
+            if( !info.subvol_rem.empty() )
+                info.subvol_rem += '\n';
+            info.subvol_rem += i->path();
+            }
+        else if( i->created() )
+            {
+            if( !info.subvol_add.empty() )
+                info.subvol_add += '\n';
+            info.subvol_add += i->path();
+            }
+        else
+            {
+            if( !info.subvol.empty() )
+                info.subvol += '\n';
+            info.subvol += i->path();
+            }
         }
     tinfo = info;
     }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-2.21.3/storage/Btrfs.h 
new/libstorage-2.21.4/storage/Btrfs.h
--- old/libstorage-2.21.3/storage/Btrfs.h       2011-06-10 09:24:57.000000000 
+0200
+++ new/libstorage-2.21.4/storage/Btrfs.h       2011-08-09 15:39:44.000000000 
+0200
@@ -48,6 +48,7 @@
        void getDevices( list<string>& devs ) const { devs=devices; }
        void getSubvolumes( list<Subvolume>& sv ) const { sv = subvol; }
 
+       bool existSubvolume( const string& name );
        int createSubvolume( const string& name );
        int deleteSubvolume( const string& name );
        int extendVolume( const string& dev );
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-2.21.3/storage/BtrfsCo.cc 
new/libstorage-2.21.4/storage/BtrfsCo.cc
--- old/libstorage-2.21.3/storage/BtrfsCo.cc    2011-06-01 10:13:38.000000000 
+0200
+++ new/libstorage-2.21.4/storage/BtrfsCo.cc    2011-08-09 15:39:44.000000000 
+0200
@@ -112,10 +112,14 @@
                else
                    devs.push_back( *i );
                }
-           Btrfs* b = new Btrfs( *this, *cv, sum_size, devs );
-           y2mil( "alt_names:" << an );
-           b->setAltNames( an );
-           vols.push_back(b);
+           y2mil( "cv:" << cv << " sum:" << sum_size << " devs:" << devs );
+           if( cv!=NULL )
+               {
+               Btrfs* b = new Btrfs( *this, *cv, sum_size, devs );
+               y2mil( "alt_names:" << an );
+               b->setAltNames( an );
+               vols.push_back(b);
+               }
            }
        else
            y2war( "uuid " << *i << " not found" );
@@ -167,6 +171,17 @@
     vols.push_back(b);
     }
 
+bool BtrfsCo::existSubvolume( const string& device, const string& name )
+    {
+    bool ret = false;
+    y2mil( "device:" << device << " name:" << name );
+    BtrfsIter i;
+    if( findBtrfs( device, i ))
+       ret = i->existSubvolume( name );
+    y2mil( "ret:" << ret );
+    return( ret );
+    }
+
 int BtrfsCo::createSubvolume( const string& device, const string& name )
     {
     int ret = 0;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-2.21.3/storage/BtrfsCo.h 
new/libstorage-2.21.4/storage/BtrfsCo.h
--- old/libstorage-2.21.3/storage/BtrfsCo.h     2011-06-01 10:13:38.000000000 
+0200
+++ new/libstorage-2.21.4/storage/BtrfsCo.h     2011-08-09 15:39:44.000000000 
+0200
@@ -46,6 +46,7 @@
        void addFromVolume( const Volume& v, string& uuid );
        void eraseVolume( Volume* v );
 
+       bool existSubvolume( const string& device, const string& name );
        int createSubvolume( const string& device, const string& name );
        int removeSubvolume( const string& device, const string& name );
        int extendVolume( const string& device, const string& dev );
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-2.21.3/storage/Dasd.cc 
new/libstorage-2.21.4/storage/Dasd.cc
--- old/libstorage-2.21.3/storage/Dasd.cc       2011-06-01 10:13:38.000000000 
+0200
+++ new/libstorage-2.21.4/storage/Dasd.cc       2011-07-28 12:34:08.000000000 
+0200
@@ -349,6 +349,7 @@
                ret = DISK_REMOVE_PARTITION_LIST_ERASE;
            ++pr;
            }
+       del_ptable = false;
        }
     unlink( inpname.c_str() );
     y2mil("ret:" << ret);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-2.21.3/storage/Disk.cc 
new/libstorage-2.21.4/storage/Disk.cc
--- old/libstorage-2.21.3/storage/Disk.cc       2011-06-01 10:13:38.000000000 
+0200
+++ new/libstorage-2.21.4/storage/Disk.cc       2011-07-28 12:34:30.000000000 
+0200
@@ -1531,7 +1531,6 @@
     Container::getCommitActions( l );
     if( del_ptable )
        {
-       l.remove_if(stage_is(DECREASE));
        l.push_front(commitAction(DECREASE, staticType(), 
setDiskLabelText(false), this, true));
        }
     }
@@ -1583,6 +1582,7 @@
     else
        {
        del_ptable = false;
+       detected_label = label;
        removeFromMemory();
        }
     if( ret==0 )
@@ -1833,6 +1833,13 @@
     { return( p.type()==LOGICAL && p.created() ); }
 
 
+inline unsigned long
+sub_sat(unsigned long a, unsigned long b)
+{
+    return a - min(a, b);
+}
+
+
 int Disk::doCreate( Volume* v )
     {
     Partition * p = dynamic_cast<Partition *>(v);
@@ -1850,8 +1857,6 @@
        if( detected_label != label )
            {
            ret = doCreateLabel();
-           if( ret==0 )
-               detected_label = label;
            }
        if( ret==0 && gpt_enlarge )
            {
@@ -1924,7 +1929,7 @@
                {
                y2mil( "i " << *i );
                if( i->cylStart()<maxc && i->cylStart()<end &&
-                   i->cylEnd()-fuzz_cyl>p->cylStart() )
+                   sub_sat(i->cylEnd(), fuzz_cyl) > p->cylStart() )
                    {
                    maxc=i->cylStart();
                    y2mil( "new maxc " << maxc );
@@ -2401,6 +2406,8 @@
     info.sectorSize = sectorSize();
     info.cylSize = geometry.cylinderSize();
     info.disklabel = labelName();
+    if( label!=detected_label )
+       info.orig_disklabel = detected_label;
     info.maxPrimary = maxPrimary();
     info.extendedPossible = extendedPossible();
     info.maxLogical = maxLogical();
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-2.21.3/storage/Lock.cc 
new/libstorage-2.21.4/storage/Lock.cc
--- old/libstorage-2.21.3/storage/Lock.cc       2011-06-01 10:16:18.000000000 
+0200
+++ new/libstorage-2.21.4/storage/Lock.cc       2011-08-09 13:39:49.000000000 
+0200
@@ -56,13 +56,12 @@
 
        y2mil("getting " << (readonly ? "read-only" : "read-write") << " lock");
 
-       if (mkdir("/var/lock/libstorage", 0755) < 0)
+       if (mkdir("/var/run/libstorage", 0755) == -1 && errno != EEXIST)
        {
-           // Creating directory failed. Not fatal (it should already exist).
-           y2deb("creating directory for lock-file failed: " << 
strerror(errno));
+           y2err("creating directory for lock-file failed: " << 
strerror(errno));
        }
 
-       fd = open("/var/lock/libstorage/lock", (readonly ? O_RDONLY : O_WRONLY) 
| O_CREAT,
+       fd = open("/var/run/libstorage/lock", (readonly ? O_RDONLY : O_WRONLY) 
| O_CREAT,
                  S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);
        if (fd < 0)
        {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-2.21.3/storage/Partition.h 
new/libstorage-2.21.4/storage/Partition.h
--- old/libstorage-2.21.3/storage/Partition.h   2011-06-01 10:13:38.000000000 
+0200
+++ new/libstorage-2.21.4/storage/Partition.h   2011-08-09 13:36:56.000000000 
+0200
@@ -83,7 +83,7 @@
        Text resizeText(bool doing) const;
        void getCommitActions(list<commitAction>& l) const;
        Text setTypeText(bool doing) const;
-       int setFormat( bool format=true, storage::FsType fs=storage::REISERFS );
+       int setFormat( bool format, storage::FsType fs );
        int changeMount( const string& val );
        const Disk* disk() const;
        bool isWindows() const;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-2.21.3/storage/Storage.cc 
new/libstorage-2.21.4/storage/Storage.cc
--- old/libstorage-2.21.3/storage/Storage.cc    2011-07-07 12:22:15.000000000 
+0200
+++ new/libstorage-2.21.4/storage/Storage.cc    2011-08-10 16:42:40.000000000 
+0200
@@ -188,7 +188,7 @@
            if (!toValue(val, fs_type, false))
                y2war("unknown default filesystem '" << val << "' in " 
SYSCONFIGFILE);
            else if (fs_type != EXT2 && fs_type != EXT3 && fs_type != EXT4 &&
-                    fs_type != REISERFS && fs_type != XFS)
+                    fs_type != REISERFS && fs_type != XFS && fs_type != BTRFS)
                y2war("unallowed default filesystem '" << val << "' in " 
SYSCONFIGFILE);
            else
                setDefaultFs(fs_type);
@@ -903,7 +903,7 @@
     void
     Storage::logContainersAndVolumes(const string& Dir) const
     {
-       if (max_log_num > 0)
+       if (max_log_num > 0 && checkDir(Dir))
        {
            for (CCIter i = cont.begin(); i != cont.end(); ++i)
                (*i)->logData(Dir);
@@ -4370,6 +4370,20 @@
     return( ret );
     }
 
+bool Storage::existSubvolume( const string& device, const string& name )
+    {
+    int ret = false;
+    assertInit();
+    y2mil("device:" << device << " name:" << name);
+    BtrfsCo* co;
+    if( haveBtrfs(co) )
+       {
+       ret = co->existSubvolume( device, name );
+       }
+    y2mil("ret:" << ret);
+    return( ret );
+    }
+
 int Storage::createSubvolume( const string& device, const string& name )
     {
     int ret = 0;
@@ -5518,8 +5532,8 @@
     static FsCapabilitiesX ext4Caps (true, true, true, false, true, true,
                                     true, 16, 32*1024);
 
-    static FsCapabilitiesX btrfsCaps (false, false, false, false, true, false,
-                                     false, 0, 256*1024);
+    static FsCapabilitiesX btrfsCaps (false, false, false, false, true, true,
+                                     false, 16, 256*1024);
 
     static FsCapabilitiesX xfsCaps (true, true, false, false, true, true,
                                    false, 12, 40*1024);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-2.21.3/storage/Storage.h 
new/libstorage-2.21.4/storage/Storage.h
--- old/libstorage-2.21.3/storage/Storage.h     2011-06-10 09:24:57.000000000 
+0200
+++ new/libstorage-2.21.4/storage/Storage.h     2011-08-09 15:39:44.000000000 
+0200
@@ -540,6 +540,7 @@
 
        int removeDmraid( const string& name );
 
+       bool existSubvolume( const string& device, const string& name );
        int createSubvolume( const string& device, const string& name );
        int removeSubvolume( const string& device, const string& name );
        int extendBtrfsVolume( const string& device, const string& dev );
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-2.21.3/storage/StorageInterface.h 
new/libstorage-2.21.4/storage/StorageInterface.h
--- old/libstorage-2.21.3/storage/StorageInterface.h    2011-07-05 
14:25:34.000000000 +0200
+++ new/libstorage-2.21.4/storage/StorageInterface.h    2011-08-09 
15:39:44.000000000 +0200
@@ -304,6 +304,7 @@
        unsigned long sectors;
        unsigned int sectorSize;
        string disklabel;
+       string orig_disklabel;
        unsigned maxPrimary;
        bool extendedPossible;
        unsigned maxLogical;
@@ -542,6 +543,8 @@
        string devices_add;
        string devices_rem;
        string subvol;
+       string subvol_add;
+       string subvol_rem;
     };
 
     /**
@@ -2223,6 +2226,15 @@
        virtual int removeDmraid( const string& name ) = 0;
 
        /**
+        * Check for existence of a BTRFS subvolume
+        *
+        * @param device of the main BTRFS volume
+        * @param name of subvolume
+        * @return true if subvolume exists, false otherwise
+        */
+       virtual bool existSubvolume( const string& device, const string& name ) 
= 0;
+
+       /**
         * Create a BTRFS subvolume
         *
         * @param device of the main BTRFS volume
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-2.21.3/storage/StorageTypes.cc 
new/libstorage-2.21.4/storage/StorageTypes.cc
--- old/libstorage-2.21.3/storage/StorageTypes.cc       2011-06-01 
10:13:38.000000000 +0200
+++ new/libstorage-2.21.4/storage/StorageTypes.cc       2011-08-04 
17:31:19.000000000 +0200
@@ -168,4 +168,14 @@
       << " logical:" << a.logicalSlot << " poss:" << a.logicalPossible;
     return s;
     };
+
+std::ostream& operator<<(std::ostream& s, const FsCapabilities& a)
+    {
+    s << "ext:" << a.isExtendable << " extm:" << a.isExtendableWhileMounted
+      << " red:" << a.isReduceable << " redm:" << a.isReduceableWhileMounted
+      << " uuid:" << a.supportsUuid << " label:" << a.supportsLabel
+      << " lwm:" << a.labelWhileMounted << " ll:" << a.labelLength
+      << " minfsk:" << a.minimalFsSizeK;
+    return s;
+    };
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-2.21.3/storage/StorageTypes.h 
new/libstorage-2.21.4/storage/StorageTypes.h
--- old/libstorage-2.21.3/storage/StorageTypes.h        2011-06-01 
10:13:38.000000000 +0200
+++ new/libstorage-2.21.4/storage/StorageTypes.h        2011-08-04 
17:31:19.000000000 +0200
@@ -92,6 +92,7 @@
     };
 
 std::ostream& operator<<(std::ostream& s, const PartitionSlotInfo& a);
+std::ostream& operator<<(std::ostream& s, const FsCapabilities& a);
 
     enum CommitStage { DECREASE, INCREASE, FORMAT, MOUNT, SUBVOL };
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-2.21.3/storage/Volume.cc 
new/libstorage-2.21.4/storage/Volume.cc
--- old/libstorage-2.21.3/storage/Volume.cc     2011-06-10 09:24:57.000000000 
+0200
+++ new/libstorage-2.21.4/storage/Volume.cc     2011-08-10 16:42:40.000000000 
+0200
@@ -561,6 +561,10 @@
        }
     }
 
+int Volume::setFormat( bool format )
+    {
+    return setFormat( format, getStorage()->getDefaultFs() );
+    }
 
 int Volume::setFormat( bool val, storage::FsType new_fs )
     {
@@ -665,6 +669,7 @@
                     (mby==MOUNTBY_LABEL && !caps.supportsLabel) ||
                     (mby==MOUNTBY_UUID && !caps.supportsUuid))
                {
+               y2mil( "fs:" << toString(fs) << " caps:" << caps );
                ret = VOLUME_MOUNTBY_UNSUPPORTED_BY_FS;
                }
            }
@@ -721,7 +726,7 @@
        else
            ret = VOLUME_CANNOT_TMP_MOUNT;
        }
-    y2mil( "ret:" << " mp:" << m << " needUmount:" << needUmount ); 
+    y2mil( "ret:" << ret << " mp:" << m << " needUmount:" << needUmount ); 
     return( ret );
     }
 
@@ -828,6 +833,8 @@
     SystemCmd c;
     string defvol = getStorage()->getDefaultSubvolName();
     string cmd = "/sbin/mkfs.btrfs " + quote(mountDevice());
+    if( !label.empty() )
+       cmd += " -L" + label;
     c.execute( cmd );
     if( c.retcode()!=0 )
        {
@@ -1106,7 +1113,7 @@
            uuid = "testmode-0123-4567-6666-98765432"+decString(fcount++);
            }
        }
-    if( ret==0 && !label.empty() )
+    if( ret==0 && !label.empty() && fs!=BTRFS )
        {
        ret = doSetLabel();
        }
@@ -1367,11 +1374,14 @@
 int Volume::checkDevice(const string& device) const
     {
     struct stat sbuf;
-    int ret = 0;
-    if( stat(device.c_str(), &sbuf)<0 )
-       ret = VOLUME_DEVICE_NOT_PRESENT;
-    else if( !S_ISBLK(sbuf.st_mode) )
-       ret = VOLUME_DEVICE_NOT_BLOCK;
+    int ret = getStorage()->waitForDevice(device);
+    if( ret!=0 )
+       {
+       if( stat(device.c_str(), &sbuf)<0 )
+           ret = VOLUME_DEVICE_NOT_PRESENT;
+       else if( !S_ISBLK(sbuf.st_mode) )
+           ret = VOLUME_DEVICE_NOT_BLOCK;
+       }
     y2mil("checkDevice:" << device << " ret:" << ret);
     return( ret );
     }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libstorage-2.21.3/storage/Volume.h 
new/libstorage-2.21.4/storage/Volume.h
--- old/libstorage-2.21.3/storage/Volume.h      2011-06-10 09:24:57.000000000 
+0200
+++ new/libstorage-2.21.4/storage/Volume.h      2011-08-09 13:37:05.000000000 
+0200
@@ -78,7 +78,8 @@
 
        void getFsInfo( const Volume* source );
 
-       virtual int setFormat( bool format=true, storage::FsType 
fs=storage::REISERFS );
+       int setFormat( bool format=true );
+       virtual int setFormat( bool format, storage::FsType fs );
        void formattingDone() { format=false; fs=detected_fs; }
        bool getFormat() const { return format; }
        int changeFstabOptions( const string& options );


++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++



Remember to have fun...

-- 
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to