parted: fix EOF and ctrl-c handling

feof() seems to not detect EOF after readline() hits it, so parted went
into an infinite loop prompting for input on EOF.  Change test to use the
got_ctrl_c variable instead, which is set when readline hits EOF and
returns NULL.  This also makes parted properly exit on ctrl-c.
tests: t6003-dm-hide: don't hang on exception

If the parted -l found any exceptions, it would print the prompt, which was
redirected to the log, then hang waiting for input, which never came.  Use
script mode to disable the prompts.
gpt: Revert small device commits

The following commit broke the position of the LastUsableLBA:

48f236f9: gpt: permit "mklabel gpt" on a 67-sector device

It introduced an off by one error, leaving LastUsableLBA pointing to
the first sector of the backup partition table instead.

This effectively reverts that commit, as well as adjusting the subsequent
commits to instead use 68 sectors as the minimum length.  I believe
this is the minimum legal size as at 67 sectors, there is no valid
value for FirstUsableLBA and LastUsableLBA.
libparted: handle logical partitions starting immediately after the EBR

_blkpg_add_partition() set the length of the extended partition
to 2 sectors to allow LILO to be installed there, beacuse the
linux kernel does this.  If a logical partition used that second
sector, adding it would fail beacuse of the overlap.  Now
_blkpg_add_partition() will limit the length to only the first
sector if the second is used by a logical partition.

Previously parted did create the partition table, and after a
reboot, the kernel would recognize the table, and happily create
the extended partition as 2 sectors long, thus overlapping the
logical partition, but when parted tried to recreate the same
table with BLKPG, the kernel rightly rejected it.
libparted: fix gpt end of disk handling

There are two checks for problems with the end of disk.  The first checks
to make sure that the backup gpt is actually at the end of the disk as it
should be.  The second checks to see that the gpt's idea of where the disk
ends is correct.  The handling of the backup gpt location was wrong because
if you chose not to fix the error, then as soon as you made any changes the
backup would be written to the end of the disk anyhow, only the previous
backup would not be zeroed.

This patch fixes the write path to put the backup gpt where the gpt says
it goes, not where we think the disk ends.  This allows you to choose
not to fix the problems, and the backup gpt will be written to the same
place it was before, not the new end of disk.
libparted: allow some common errors to be ignored

Partitions that overlap or extend beyond the end of the disk are common
errors that usually result in people having to use other tools to correct
because parted refuses to operate when it sees them.  Change these errors
to allow you to ignore them and use parted to correct the problem.
Revert "linux-commit: do not unnecessarily open partition device nodes"

This reverts commit 2a6936fab4d4499a4b812dd330d3db50549029e0.  The commit
disabled flushing the block buffer caches on the partition nodes to ensure
cache consistency on 2.6 kernels, supposedly because this was no longer
required.  It appears this was incorrect, and the caches DO still need
flushed, otherwise a new fs written to the partition device does not show
up in the disk device cache, causing parted to still identify the old fs.
libparted: avoid disturbing partitions

The partition sync logic was first removing all
partitions, then trying to re-add them.  This resulted in many
udev events triggering annoying behavior like auto mounting.
Refactor the code to avoid removing and re-adding unmodified
partitions.
Fix test compilation

The tests were not being linked against libpthread but were using
it, and recent versions of gcc refuse to implicitly pull it in.
GPT: add support for PReP GUID

PReP (PowerPC Reference Platform) boot partition is the first partition used in
PowerPC platform for containing the bootable kernel or bootloader. The firmware
searches for this partition and jumps to it for booting. So far no GUID was
specified for this partition type and hence booting from GPT disk was not
supported on this platform. A new GUID 9e1a2d38-c612-4316-aa26-8b49521e5a8b for
PReP partition is proposed to be included in GPT.
libparted: make sure not to treat percentages as exact

If 1% of the drive size worked out ot be an even power of
two, it would trigger the exact placement.  Add an exception
for the percent units.