OSDN Git Service

libparted: gpt: rewrite even a 9-partition-entry table properly
authorJim Meyering <meyering@redhat.com>
Sat, 21 Jan 2012 11:50:59 +0000 (12:50 +0100)
committerJim Meyering <meyering@redhat.com>
Sun, 22 Jan 2012 20:13:46 +0000 (21:13 +0100)
commit6d69c7183ec30e245834ed04b8755e3bc938b455
tree2cc339da46afcb4f3da84f9cd7d6e273f1ff131f
parentb1e4a02c3f905ca566175e3c62cfa0c2a7cb1c1a
libparted: gpt: rewrite even a 9-partition-entry table properly

The vast majority of GPT partition tables have 128 PTEs (partition
table entries.  However, zfs-related ones have only 9, and when
rewriting one (which can happen only in interactive mode), parted
would fail to write the full PTE array whenever the PTE array size
was not a multiple of the sector size.  This fixes the same type
of bug as v3.0-45-gce85c51.
* libparted/labels/gpt.c (gpt_write): When computing how many sectors
to write for the PTE array, round up rather than truncating.  This
matters only when n_PTEs * 128 is not a multiple of the sector size.
For details on how to reproduce see the test or
http://thread.gmane.org/gmane.comp.gnu.parted.bugs/10691/focus=10695
* NEWS (Bug fixes): Mention it.
NEWS
libparted/labels/gpt.c