]> git.ipfire.org Git - thirdparty/util-linux.git/commit
libfdisk: (gpt) add functionality to move backup header
authorKarel Zak <kzak@redhat.com>
Wed, 5 Feb 2020 13:37:41 +0000 (14:37 +0100)
committerKarel Zak <kzak@redhat.com>
Wed, 5 Feb 2020 13:37:41 +0000 (14:37 +0100)
commit387ac2771f1b16af00c417b226c697d08d1301fe
tree68657b7ad62088eb282d2c036d6e45c4fbbcc4bf
parent99d78b2fefe340219059486b42a5acd141ec2642
libfdisk: (gpt) add functionality to move backup header

- add fdisk_gpt_disable_relocation() to disable move backup header to standard location

- add fdisk_gpt_enable_minimize() to move backup header behind last partition

Note that fdisk_gpt_disable_relocation() has to be used before fdisk_assign_device(),
because automatic relocation is done when libfdisk reads the header from the device.

For example:
lb = fdisk_get_label(cxt, "gpt");

fdisk_gpt_disable_relocation(lb, 1);
fdisk_assign_device(cxt, devname, 0);

For fdisk_gpt_enable_minimize() it's not important as recalculation is
done before write, for example:

fdisk_assign_device(cxt, devname, 0);
fdisk_gpt_enable_minimize(fdisk_get_label(cxt, NULL), 1);

... add partition, etc ...

fdisk_write_disklabel(cxt);

Signed-off-by: Karel Zak <kzak@redhat.com>
libfdisk/docs/libfdisk-sections.txt
libfdisk/src/gpt.c
libfdisk/src/libfdisk.h.in
libfdisk/src/libfdisk.sym