[parted-devel] [PATCH] libparted: preserve GUID-specific attributes for GPT disks
Phillip Susi
psusi at ubuntu.com
Fri Aug 3 20:03:26 BST 2018
Thanks, I have been meaning to fix that. Could you write a NEWS entry
and a test case?
On 8/2/2018 12:56 AM, James Forcier wrote:
> libparted will currently clobber partition type GUID-specific bits in
> partition entries when editing GPT disks in violation of the GPT
> specification (UEFI specification version 2.7, Section 5.3.3, Table 23).
> Preserve them instead.
> ---
> libparted/labels/gpt.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c
> index 4f922b2..1f0b54d 100644
> --- a/libparted/labels/gpt.c
> +++ b/libparted/labels/gpt.c
> @@ -289,6 +289,7 @@ typedef struct _GPTPartitionData
> efi_guid_t uuid;
> efi_char16_t name[37];
> char *translated_name;
> + uint16_t guid_specific_attributes;
> int lvm;
> int swap;
> int raid;
> @@ -818,6 +819,7 @@ _parse_part_entry (PedDisk *disk, GuidPartitionEntry_t *pte)
> gpt_part_data->name[i] = (efi_char16_t) pte->PartitionName[i];
> gpt_part_data->name[i] = 0;
> gpt_part_data->translated_name = 0;
> + gpt_part_data->guid_specific_attributes = pte->Attributes.GuidSpecific;
>
> gpt_part_data->lvm = gpt_part_data->swap
> = gpt_part_data->raid
> @@ -1234,6 +1236,8 @@ _partition_generate_part_entry (PedPartition *part, GuidPartitionEntry_t *pte)
> if (gpt_part_data->legacy_boot)
> pte->Attributes.LegacyBIOSBootable = 1;
>
> + pte->Attributes.GuidSpecific = gpt_part_data->guid_specific_attributes;
> +
> for (i = 0; i < 36; i++)
> pte->PartitionName[i] = gpt_part_data->name[i];
> }
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: OpenPGP digital signature
URL: <http://alioth-lists.debian.net/pipermail/parted-devel/attachments/20180803/e8134bd0/attachment.sig>
More information about the parted-devel
mailing list