Code review please for bug :
   14929 - liborchestrator hits assert during creation of new partition for 
installation
   http://defect.opensolaris.org/bz/show_bug.cgi?id=14929

Webrev at :
   http://cr.opensolaris.org/~mattman/bug-14929/


With change for bug 13993, the GUI when collapsing down primary partitions does 
not remove shuffle primaary partitions upwards leaving all blank ones at the 
end 
of the 1st four pinfo elements.

This was done as fdisk expects primary partitions to exist in the same pinfo 
location as the partition_id, and thus we can preserve partition id's correctly.

There was still some logic in disk_parts.c that depended on the old way, which 
was the cause of this crash.

Whilst investigating this bug I discovered a few other minor ones which I will 
fix with this putback aswell.

disk_parts.c :
- get_next_used_partition()
   - Change to start cycling through partitions after the current one.
- om_validate_and_resize_disk_partitions()
   - Update debug messages to make more readable and include printing of
     partition_order structure element
   - When determing first partition in disk layout, it assumed for primaries
     this partition would be in index 0 if pinfo array, if not it must be an
     extended partition. This logic is incorrect, as the first disk partition
     for primaries could be in any of the 1st 4 pinfo slots.
     Check should be i < FD_NUMPART.

installation-disk-screen.c :
- restore_unused_partitions()
   - Add some extra debug output calls.
- collapse_partitions()
   - libtd when initially reporting disk layout only populates primary elements
     in the pinfo array, it does not show unused chunks, these are calculated
     by the GUI and popped into the pinfo array by the GUI. As such these
     unused chunk elements should be cleared out completely before passing into
     om_validate_and_resize_disk_partitions(), and other used chunks should have
     their partition_order reduced correctly if unsued ones are removed. Added
     code here to perform this initialization.

Reply via email to