[yast-commit] r57316 - /trunk/storage/storage/src/include/ep-hd.ycp
Author: kmachalkova Date: Tue May 26 13:35:26 2009 New Revision: 57316 URL: http://svn.opensuse.org/viewcvs/yast?rev=57316&view=rev Log: Sort the partitions by start cylinder Handle two partitions end/start on the same cylinder Modified: trunk/storage/storage/src/include/ep-hd.ycp Modified: trunk/storage/storage/src/include/ep-hd.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/storage/src/include/ep-hd.ycp?rev=57316&r1=57315&r2=57316&view=diff ============================================================================== --- trunk/storage/storage/src/include/ep-hd.ycp (original) +++ trunk/storage/storage/src/include/ep-hd.ycp Tue May 26 13:35:26 2009 @@ -296,9 +296,13 @@ integer ccyl = 0; integer endcyl = ddata["cyl_count"]:1; + list <map> partitions = (list <map> ) sort (map m, map n, ddata["partitions"]:[], { + return Region::Start( m["region"]:[] ) < Region::Start( n["region"]:[] ); + }); + while(ccyl < endcyl) { - map part = ddata["partitions", i]:$[]; + map part = partitions[ i ]:$[]; // skip extended ones if ( part["type"]:`primary == `extended) { @@ -331,8 +335,12 @@ labels = add( labels, descr); // Now there is some xtra space between the end of this partition and the start of the next one - // or the end of the disk - if ( (Region::End( region) +1) != next_cyl ) + // or the end of the disk if + // 1. end +1th cyl is not the next one + // 2. end cyl is not the same as the next one (yeah, partitions may share a cylinder) + if ( (Region::End( region ) != next_cyl) && + ( (Region::End( region) + 1) != next_cyl ) + ) { integer tmp2 = 100*( next_cyl - Region::End(region))/ddata["cyl_count"]:1; bits = add( bits, (tmp2 < 1) ? 1 : tmp2); -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
kmachalkova@svn.opensuse.org