Author: aschnell Date: Wed Oct 15 17:44:05 2008 New Revision: 52273 URL: http://svn.opensuse.org/viewcvs/yast?rev=52273&view=rev Log: - fixed calculation of unused disk areas (bnc #423660) Modified: trunk/storage/VERSION trunk/storage/libstorage/src/Disk.cc trunk/storage/package/yast2-storage.changes Modified: trunk/storage/VERSION URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/VERSION?rev=52273&r1=52272&r2=52273&view=diff ============================================================================== --- trunk/storage/VERSION (original) +++ trunk/storage/VERSION Wed Oct 15 17:44:05 2008 @@ -1 +1 @@ -2.17.38 +2.17.39 Modified: trunk/storage/libstorage/src/Disk.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/Disk.cc?rev=52273&r1=52272&r2=52273&view=diff ============================================================================== --- trunk/storage/libstorage/src/Disk.cc (original) +++ trunk/storage/libstorage/src/Disk.cc Wed Oct 15 17:44:05 2008 @@ -1215,41 +1215,63 @@ return( !p.created() && p.type()==PRIMARY ); } -void Disk::getUnusedSpace( list<Region>& free, bool all, bool logical ) - { - y2milestone( "all:%d logical:%d", all, logical ); + +void +Disk::getUnusedSpace(list<Region>& free, bool all, bool logical) +{ + y2mil("all:" << all << " logical:" << logical); + free.clear(); - if( all || !logical ) - { - PartPair p = partPair( notDeletedNotLog ); + + if (all || !logical) + { + PartPair p = partPair(notDeletedNotLog); + unsigned long start = 1; - for( PartIter i=p.begin(); i!=p.end(); ++i ) - { - if( i->cylStart()>start ) - free.push_back( Region( start, i->cylStart()-start )); - start = i->cylEnd()+1; - } - if( cylinders()>start ) - free.push_back( Region( start, cylinders()-start )); - } - if( all || logical ) + unsigned long end = cylinders(); + + list<Region> tmp; + for (PartIter i = p.begin(); i != p.end(); ++i) + tmp.push_back(i->cylStart(), i->cylEnd() - i->cylStart() + 1); + tmp.sort(); + + for (list<Region>::const_iterator i=tmp.begin(); i!=tmp.end(); ++i) { + if (i->start()>start) + free.push_back(Region(start, i->start() - start)); + start = i->end() + 1; + } + if (end > start) + free.push_back(Region(start, end - start)); + } + + if (all || logical) + { PartPair ext = partPair(notDeletedExt); - if( !ext.empty() ) - { - PartPair p = partPair( notDeletedLog ); + if (!ext.empty()) + { + PartPair p = partPair(notDeletedLog); + unsigned long start = ext.begin()->cylStart(); - for( PartIter i=p.begin(); i!=p.end(); ++i ) - { - if( i->cylStart()>start ) - free.push_back( Region( start, i->cylStart()-start )); - start = i->cylEnd()+1; - } - if( ext.begin()->cylEnd()>start ) - free.push_back( Region( start, ext.begin()->cylEnd()-start )); + unsigned long end = ext.begin()->cylEnd(); + + list<Region> tmp; + for (PartIter i = p.begin(); i != p.end(); ++i) + tmp.push_back(i->cylStart(), i->cylEnd() - i->cylStart() + 1); + tmp.sort(); + + for (list<Region>::const_iterator i = tmp.begin(); i != tmp.end(); ++i) + { + if (i->start() > start) + free.push_back(Region(start, i->start() - start)); + start = i->end() + 1; } + if (end > start) + free.push_back(Region(start, end - start)); } } +} + static bool regions_sort_size( const Region& rhs, const Region& lhs ) { Modified: trunk/storage/package/yast2-storage.changes URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/package/yast2-storage.changes?rev=52273&r1=52272&r2=52273&view=diff ============================================================================== --- trunk/storage/package/yast2-storage.changes (original) +++ trunk/storage/package/yast2-storage.changes Wed Oct 15 17:44:05 2008 @@ -1,4 +1,10 @@ ------------------------------------------------------------------- +Wed Oct 15 17:37:53 CEST 2008 - aschnell@suse.de + +- fixed calculation of unused disk areas (bnc #423660) +- 2.17.39 + +------------------------------------------------------------------- Tue Oct 14 16:41:10 CEST 2008 - aschnell@suse.de - fixed changing of fsid (part of bnc #431591) -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org