Fix efi_use_whole_disk() when efi_nparts == 128.
authorEtienne Dechamps <etienne.dechamps@ovh.net>
Wed, 11 Jul 2012 15:47:10 +0000 (17:47 +0200)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Thu, 12 Jul 2012 15:59:22 +0000 (08:59 -0700)
commitcee43a7477501669920445f29990443679142336
tree47bd0a9f4cc014c0214001d463690e399d654530
parent7608bd0dd01829a130cd8a4d244e197ce8fa590a
Fix efi_use_whole_disk() when efi_nparts == 128.

Commit e5dc681a changed EFI_NUMPAR from 9 to 128. This means that the
on-disk EFI label has efi_nparts = 128 instead of 9. The index of the
reserved partition, however, is still 8. This breaks
efi_use_whole_disk(), which uses efi_nparts-1 as the index of the
reserved partition.

This commit fixes efi_use_whole_disk() when the index of the reserved
partition is not efi_nparts-1. It rewrites the algorithm and makes it
more robust by using the order of the partitions instead of their
numbering. It assumes that the last non-empty partition is the reserved
partition, and that the non-empty partition before that is the data
partition.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Issue #808
lib/libefi/rdwr_efi.c