- gpt: Revert to filesystem GUID when setting flag to off (bcl)
- tests: Add a test to make sure GPT GUIDs default to filesystem (bcl) - doc: Document gpt linux-home flag (bcl) - gpt: Add linux-home flag (aschnell) - gpt: Map PED_PARTITON_ flags to GUID values (aschnell)
This commit is contained in:
		
							parent
							
								
									27d77ddc17
								
							
						
					
					
						commit
						fb6ff33ba9
					
				
							
								
								
									
										566
									
								
								0039-gpt-Map-PED_PARTITON_-flags-to-GUID-values.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										566
									
								
								0039-gpt-Map-PED_PARTITON_-flags-to-GUID-values.patch
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,566 @@ | ||||
| From 15c49ec04f7eaff014d2e1eddd0aecf4150db63d Mon Sep 17 00:00:00 2001 | ||||
| From: Arvin Schnell <aschnell@suse.com> | ||||
| Date: Mon, 27 Sep 2021 08:35:31 +0000 | ||||
| Subject: [PATCH 39/43] gpt: Map PED_PARTITON_ flags to GUID values | ||||
| 
 | ||||
| Drop the 14 flags from _GPTPartitionData that correspond to a | ||||
| partition type/uuid. Use the type/uuid directly instead. | ||||
| 
 | ||||
| Signed-off-by: Brian C. Lane <bcl@redhat.com> | ||||
| ---
 | ||||
|  libparted/labels/gpt.c | 477 +++++------------------------------------ | ||||
|  1 file changed, 54 insertions(+), 423 deletions(-) | ||||
| 
 | ||||
| diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c
 | ||||
| index ba9a71a..3ba3cee 100644
 | ||||
| --- a/libparted/labels/gpt.c
 | ||||
| +++ b/libparted/labels/gpt.c
 | ||||
| @@ -165,6 +165,43 @@ typedef struct
 | ||||
|                      PED_CPU_TO_LE16 (0x4262), 0xa3, 0x52, \ | ||||
|                      { 0xb2, 0x75, 0xfd, 0x6f, 0x71, 0x72 }}) | ||||
|   | ||||
| +struct flag_uuid_mapping_t
 | ||||
| +{
 | ||||
| +    enum _PedPartitionFlag flag;
 | ||||
| +    efi_guid_t type_uuid;
 | ||||
| +};
 | ||||
| +
 | ||||
| +static const struct flag_uuid_mapping_t flag_uuid_mapping[] =
 | ||||
| +{
 | ||||
| +    { PED_PARTITION_APPLE_TV_RECOVERY,  PARTITION_APPLE_TV_RECOVERY_GUID },
 | ||||
| +    { PED_PARTITION_BIOS_GRUB,          PARTITION_BIOS_GRUB_GUID },
 | ||||
| +    { PED_PARTITION_BLS_BOOT,           PARTITION_BLS_BOOT_GUID },
 | ||||
| +    { PED_PARTITION_BOOT,               PARTITION_SYSTEM_GUID },
 | ||||
| +    { PED_PARTITION_CHROMEOS_KERNEL,    PARTITION_CHROMEOS_KERNEL_GUID },
 | ||||
| +    { PED_PARTITION_DIAG,               PARTITION_MSFT_RECOVERY },
 | ||||
| +    { PED_PARTITION_ESP,                PARTITION_SYSTEM_GUID },
 | ||||
| +    { PED_PARTITION_HPSERVICE,          PARTITION_HPSERVICE_GUID },
 | ||||
| +    { PED_PARTITION_IRST,               PARTITION_IRST_GUID },
 | ||||
| +    { PED_PARTITION_LVM,                PARTITION_LVM_GUID },
 | ||||
| +    { PED_PARTITION_MSFT_DATA,          PARTITION_BASIC_DATA_GUID },
 | ||||
| +    { PED_PARTITION_MSFT_RESERVED,      PARTITION_MSFT_RESERVED_GUID },
 | ||||
| +    { PED_PARTITION_PREP,               PARTITION_PREP_GUID },
 | ||||
| +    { PED_PARTITION_RAID,               PARTITION_RAID_GUID },
 | ||||
| +    { PED_PARTITION_SWAP,               PARTITION_SWAP_GUID },
 | ||||
| +};
 | ||||
| +
 | ||||
| +static const struct flag_uuid_mapping_t* _GL_ATTRIBUTE_CONST
 | ||||
| +gpt_find_flag_uuid_mapping (PedPartitionFlag flag)
 | ||||
| +{
 | ||||
| +  int n = sizeof(flag_uuid_mapping) / sizeof(flag_uuid_mapping[0]);
 | ||||
| +
 | ||||
| +  for (int i = 0; i < n; ++i)
 | ||||
| +    if (flag_uuid_mapping[i].flag == flag)
 | ||||
| +      return &flag_uuid_mapping[i];
 | ||||
| +
 | ||||
| +  return NULL;
 | ||||
| +}
 | ||||
| +
 | ||||
|  struct __attribute__ ((packed)) _GuidPartitionTableHeader_t | ||||
|  { | ||||
|    uint64_t Signature; | ||||
| @@ -298,20 +335,6 @@ typedef struct _GPTPartitionData
 | ||||
|    efi_char16_t name[37]; | ||||
|    char *translated_name; | ||||
|    GuidPartitionEntryAttributes_t attributes; | ||||
| -  int lvm;
 | ||||
| -  int swap;
 | ||||
| -  int raid;
 | ||||
| -  int boot;
 | ||||
| -  int bios_grub;
 | ||||
| -  int hp_service;
 | ||||
| -  int msftres;
 | ||||
| -  int msftdata;
 | ||||
| -  int atvrecv;
 | ||||
| -  int msftrecv;
 | ||||
| -  int prep;
 | ||||
| -  int irst;
 | ||||
| -  int chromeos_kernel;
 | ||||
| -  int bls_boot;
 | ||||
|  } GPTPartitionData; | ||||
|   | ||||
|  static PedDiskType gpt_disk_type; | ||||
| @@ -827,47 +850,6 @@ _parse_part_entry (PedDisk *disk, GuidPartitionEntry_t *pte)
 | ||||
|    gpt_part_data->translated_name = 0; | ||||
|    gpt_part_data->attributes = pte->Attributes; | ||||
|   | ||||
| -  gpt_part_data->lvm = gpt_part_data->swap
 | ||||
| -    = gpt_part_data->raid
 | ||||
| -    = gpt_part_data->boot = gpt_part_data->hp_service
 | ||||
| -    = gpt_part_data->msftres
 | ||||
| -    = gpt_part_data->msftdata
 | ||||
| -    = gpt_part_data->msftrecv
 | ||||
| -    = gpt_part_data->prep
 | ||||
| -    = gpt_part_data->irst
 | ||||
| -    = gpt_part_data->chromeos_kernel
 | ||||
| -    = gpt_part_data->bls_boot
 | ||||
| -    = gpt_part_data->bios_grub = gpt_part_data->atvrecv = 0;
 | ||||
| -
 | ||||
| -  if (!guid_cmp (gpt_part_data->type, PARTITION_SYSTEM_GUID))
 | ||||
| -    gpt_part_data->boot = 1;
 | ||||
| -  else if (!guid_cmp (gpt_part_data->type, PARTITION_BIOS_GRUB_GUID))
 | ||||
| -    gpt_part_data->bios_grub = 1;
 | ||||
| -  else if (!guid_cmp (gpt_part_data->type, PARTITION_RAID_GUID))
 | ||||
| -    gpt_part_data->raid = 1;
 | ||||
| -  else if (!guid_cmp (gpt_part_data->type, PARTITION_LVM_GUID))
 | ||||
| -    gpt_part_data->lvm = 1;
 | ||||
| -  else if (!guid_cmp (gpt_part_data->type, PARTITION_SWAP_GUID))
 | ||||
| -    gpt_part_data->swap = 1;
 | ||||
| -  else if (!guid_cmp (gpt_part_data->type, PARTITION_HPSERVICE_GUID))
 | ||||
| -    gpt_part_data->hp_service = 1;
 | ||||
| -  else if (!guid_cmp (gpt_part_data->type, PARTITION_MSFT_RESERVED_GUID))
 | ||||
| -    gpt_part_data->msftres = 1;
 | ||||
| -  else if (!guid_cmp (gpt_part_data->type, PARTITION_BASIC_DATA_GUID))
 | ||||
| -    gpt_part_data->msftdata = 1;
 | ||||
| -  else if (!guid_cmp (gpt_part_data->type, PARTITION_MSFT_RECOVERY))
 | ||||
| -    gpt_part_data->msftrecv = 1;
 | ||||
| -  else if (!guid_cmp (gpt_part_data->type, PARTITION_APPLE_TV_RECOVERY_GUID))
 | ||||
| -    gpt_part_data->atvrecv = 1;
 | ||||
| -  else if (!guid_cmp (gpt_part_data->type, PARTITION_PREP_GUID))
 | ||||
| -    gpt_part_data->prep = 1;
 | ||||
| -  else if (!guid_cmp (gpt_part_data->type, PARTITION_IRST_GUID))
 | ||||
| -    gpt_part_data->irst = 1;
 | ||||
| -  else if (!guid_cmp (gpt_part_data->type, PARTITION_CHROMEOS_KERNEL_GUID))
 | ||||
| -    gpt_part_data->chromeos_kernel = 1;
 | ||||
| -  else if (!guid_cmp (gpt_part_data->type, PARTITION_BLS_BOOT_GUID))
 | ||||
| -    gpt_part_data->bls_boot = 1;
 | ||||
| -
 | ||||
|    return part; | ||||
|  } | ||||
|   | ||||
| @@ -1371,21 +1353,7 @@ gpt_partition_new (const PedDisk *disk,
 | ||||
|      goto error_free_part; | ||||
|   | ||||
|    gpt_part_data->type = PARTITION_LINUX_DATA_GUID; | ||||
| -  gpt_part_data->lvm = 0;
 | ||||
| -  gpt_part_data->swap = 0;
 | ||||
| -  gpt_part_data->raid = 0;
 | ||||
| -  gpt_part_data->boot = 0;
 | ||||
| -  gpt_part_data->bios_grub = 0;
 | ||||
| -  gpt_part_data->hp_service = 0;
 | ||||
| -  gpt_part_data->msftres = 0;
 | ||||
| -  gpt_part_data->msftdata = 0;
 | ||||
| -  gpt_part_data->msftrecv = 0;
 | ||||
| -  gpt_part_data->atvrecv = 0;
 | ||||
| -  gpt_part_data->prep = 0;
 | ||||
|    gpt_part_data->translated_name = 0; | ||||
| -  gpt_part_data->irst = 0;
 | ||||
| -  gpt_part_data->chromeos_kernel = 0;
 | ||||
| -  gpt_part_data->bls_boot = 0;
 | ||||
|    uuid_generate ((unsigned char *) &gpt_part_data->uuid); | ||||
|    swap_uuid_and_efi_guid (&gpt_part_data->uuid); | ||||
|    memset (gpt_part_data->name, 0, sizeof gpt_part_data->name); | ||||
| @@ -1457,77 +1425,6 @@ gpt_partition_set_system (PedPartition *part,
 | ||||
|   | ||||
|    part->fs_type = fs_type; | ||||
|   | ||||
| -  if (gpt_part_data->lvm)
 | ||||
| -    {
 | ||||
| -      gpt_part_data->type = PARTITION_LVM_GUID;
 | ||||
| -      return 1;
 | ||||
| -    }
 | ||||
| -  if (gpt_part_data->swap)
 | ||||
| -    {
 | ||||
| -      gpt_part_data->type = PARTITION_SWAP_GUID;
 | ||||
| -      return 1;
 | ||||
| -    }
 | ||||
| -  if (gpt_part_data->raid)
 | ||||
| -    {
 | ||||
| -      gpt_part_data->type = PARTITION_RAID_GUID;
 | ||||
| -      return 1;
 | ||||
| -    }
 | ||||
| -  if (gpt_part_data->prep)
 | ||||
| -    {
 | ||||
| -      gpt_part_data->type = PARTITION_PREP_GUID;
 | ||||
| -      return 1;
 | ||||
| -    }
 | ||||
| -  if (gpt_part_data->boot)
 | ||||
| -    {
 | ||||
| -      gpt_part_data->type = PARTITION_SYSTEM_GUID;
 | ||||
| -      return 1;
 | ||||
| -    }
 | ||||
| -  if (gpt_part_data->bios_grub)
 | ||||
| -    {
 | ||||
| -      gpt_part_data->type = PARTITION_BIOS_GRUB_GUID;
 | ||||
| -      return 1;
 | ||||
| -    }
 | ||||
| -  if (gpt_part_data->hp_service)
 | ||||
| -    {
 | ||||
| -      gpt_part_data->type = PARTITION_HPSERVICE_GUID;
 | ||||
| -      return 1;
 | ||||
| -    }
 | ||||
| -  if (gpt_part_data->msftres)
 | ||||
| -    {
 | ||||
| -      gpt_part_data->type = PARTITION_MSFT_RESERVED_GUID;
 | ||||
| -      return 1;
 | ||||
| -    }
 | ||||
| -  if (gpt_part_data->msftdata)
 | ||||
| -    {
 | ||||
| -      gpt_part_data->type = PARTITION_BASIC_DATA_GUID;
 | ||||
| -      return 1;
 | ||||
| -    }
 | ||||
| -  if (gpt_part_data->msftrecv)
 | ||||
| -    {
 | ||||
| -      gpt_part_data->type = PARTITION_MSFT_RECOVERY;
 | ||||
| -      return 1;
 | ||||
| -    }
 | ||||
| -  if (gpt_part_data->atvrecv)
 | ||||
| -    {
 | ||||
| -      gpt_part_data->type = PARTITION_APPLE_TV_RECOVERY_GUID;
 | ||||
| -      return 1;
 | ||||
| -    }
 | ||||
| -  if (gpt_part_data->irst)
 | ||||
| -    {
 | ||||
| -      gpt_part_data->type = PARTITION_IRST_GUID;
 | ||||
| -      return 1;
 | ||||
| -    }
 | ||||
| -  if (gpt_part_data->chromeos_kernel)
 | ||||
| -    {
 | ||||
| -      gpt_part_data->type = PARTITION_CHROMEOS_KERNEL_GUID;
 | ||||
| -      return 1;
 | ||||
| -    }
 | ||||
| -  if (gpt_part_data->bls_boot)
 | ||||
| -    {
 | ||||
| -      gpt_part_data->type = PARTITION_BLS_BOOT_GUID;
 | ||||
| -      return 1;
 | ||||
| -    }
 | ||||
| -
 | ||||
|    if (fs_type) | ||||
|      { | ||||
|        if (strncmp (fs_type->name, "fat", 3) == 0 | ||||
| @@ -1657,247 +1554,18 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
 | ||||
|    PED_ASSERT (part->disk_specific != NULL); | ||||
|    gpt_part_data = part->disk_specific; | ||||
|   | ||||
| +  const struct flag_uuid_mapping_t* p = gpt_find_flag_uuid_mapping (flag);
 | ||||
| +  if (p)
 | ||||
| +  {
 | ||||
| +    if (state)
 | ||||
| +      gpt_part_data->type = p->type_uuid;
 | ||||
| +    else if (guid_cmp (gpt_part_data->type, p->type_uuid) == 0)
 | ||||
| +      gpt_part_data->type = PARTITION_LINUX_DATA_GUID;
 | ||||
| +    return 1;
 | ||||
| +  }
 | ||||
| +
 | ||||
|    switch (flag) | ||||
|      { | ||||
| -    case PED_PARTITION_ESP:
 | ||||
| -    case PED_PARTITION_BOOT:
 | ||||
| -      gpt_part_data->boot = state;
 | ||||
| -      if (state)
 | ||||
| -        gpt_part_data->raid
 | ||||
| -          = gpt_part_data->lvm
 | ||||
| -          = gpt_part_data->swap
 | ||||
| -          = gpt_part_data->bios_grub
 | ||||
| -          = gpt_part_data->hp_service
 | ||||
| -          = gpt_part_data->msftres
 | ||||
| -          = gpt_part_data->msftdata
 | ||||
| -          = gpt_part_data->msftrecv
 | ||||
| -          = gpt_part_data->prep
 | ||||
| -          = gpt_part_data->irst
 | ||||
| -          = gpt_part_data->chromeos_kernel
 | ||||
| -          = gpt_part_data->bls_boot
 | ||||
| -          = gpt_part_data->atvrecv = 0;
 | ||||
| -      return gpt_partition_set_system (part, part->fs_type);
 | ||||
| -    case PED_PARTITION_BIOS_GRUB:
 | ||||
| -      gpt_part_data->bios_grub = state;
 | ||||
| -      if (state)
 | ||||
| -        gpt_part_data->raid
 | ||||
| -          = gpt_part_data->lvm
 | ||||
| -          = gpt_part_data->swap
 | ||||
| -          = gpt_part_data->boot
 | ||||
| -          = gpt_part_data->hp_service
 | ||||
| -          = gpt_part_data->msftres
 | ||||
| -          = gpt_part_data->msftdata
 | ||||
| -          = gpt_part_data->msftrecv
 | ||||
| -          = gpt_part_data->prep
 | ||||
| -          = gpt_part_data->irst
 | ||||
| -          = gpt_part_data->chromeos_kernel
 | ||||
| -          = gpt_part_data->bls_boot
 | ||||
| -          = gpt_part_data->atvrecv = 0;
 | ||||
| -      return gpt_partition_set_system (part, part->fs_type);
 | ||||
| -    case PED_PARTITION_RAID:
 | ||||
| -      gpt_part_data->raid = state;
 | ||||
| -      if (state)
 | ||||
| -        gpt_part_data->boot
 | ||||
| -          = gpt_part_data->lvm
 | ||||
| -          = gpt_part_data->swap
 | ||||
| -          = gpt_part_data->bios_grub
 | ||||
| -          = gpt_part_data->hp_service
 | ||||
| -          = gpt_part_data->msftres
 | ||||
| -          = gpt_part_data->msftdata
 | ||||
| -          = gpt_part_data->msftrecv
 | ||||
| -          = gpt_part_data->prep
 | ||||
| -          = gpt_part_data->irst
 | ||||
| -          = gpt_part_data->chromeos_kernel
 | ||||
| -          = gpt_part_data->bls_boot
 | ||||
| -          = gpt_part_data->atvrecv = 0;
 | ||||
| -      return gpt_partition_set_system (part, part->fs_type);
 | ||||
| -    case PED_PARTITION_LVM:
 | ||||
| -      gpt_part_data->lvm = state;
 | ||||
| -      if (state)
 | ||||
| -        gpt_part_data->boot
 | ||||
| -          = gpt_part_data->swap
 | ||||
| -          = gpt_part_data->raid
 | ||||
| -          = gpt_part_data->bios_grub
 | ||||
| -          = gpt_part_data->hp_service
 | ||||
| -          = gpt_part_data->msftres
 | ||||
| -          = gpt_part_data->msftdata
 | ||||
| -          = gpt_part_data->msftrecv
 | ||||
| -          = gpt_part_data->prep
 | ||||
| -          = gpt_part_data->irst
 | ||||
| -          = gpt_part_data->chromeos_kernel
 | ||||
| -          = gpt_part_data->bls_boot
 | ||||
| -          = gpt_part_data->atvrecv = 0;
 | ||||
| -      return gpt_partition_set_system (part, part->fs_type);
 | ||||
| -    case PED_PARTITION_SWAP:
 | ||||
| -      gpt_part_data->swap = state;
 | ||||
| -      if (state)
 | ||||
| -        gpt_part_data->boot
 | ||||
| -          = gpt_part_data->lvm
 | ||||
| -          = gpt_part_data->raid
 | ||||
| -          = gpt_part_data->bios_grub
 | ||||
| -          = gpt_part_data->hp_service
 | ||||
| -          = gpt_part_data->msftres
 | ||||
| -          = gpt_part_data->msftdata
 | ||||
| -          = gpt_part_data->msftrecv
 | ||||
| -          = gpt_part_data->prep
 | ||||
| -          = gpt_part_data->irst
 | ||||
| -          = gpt_part_data->chromeos_kernel
 | ||||
| -          = gpt_part_data->bls_boot
 | ||||
| -          = gpt_part_data->atvrecv = 0;
 | ||||
| -      return gpt_partition_set_system (part, part->fs_type);
 | ||||
| -    case PED_PARTITION_HPSERVICE:
 | ||||
| -      gpt_part_data->hp_service = state;
 | ||||
| -      if (state)
 | ||||
| -        gpt_part_data->boot
 | ||||
| -          = gpt_part_data->raid
 | ||||
| -          = gpt_part_data->lvm
 | ||||
| -          = gpt_part_data->swap
 | ||||
| -          = gpt_part_data->bios_grub
 | ||||
| -          = gpt_part_data->msftres
 | ||||
| -          = gpt_part_data->msftdata
 | ||||
| -          = gpt_part_data->msftrecv
 | ||||
| -          = gpt_part_data->prep
 | ||||
| -          = gpt_part_data->irst
 | ||||
| -          = gpt_part_data->chromeos_kernel
 | ||||
| -          = gpt_part_data->bls_boot
 | ||||
| -          = gpt_part_data->atvrecv = 0;
 | ||||
| -      return gpt_partition_set_system (part, part->fs_type);
 | ||||
| -    case PED_PARTITION_MSFT_RESERVED:
 | ||||
| -      gpt_part_data->msftres = state;
 | ||||
| -      if (state)
 | ||||
| -        gpt_part_data->boot
 | ||||
| -          = gpt_part_data->raid
 | ||||
| -          = gpt_part_data->lvm
 | ||||
| -          = gpt_part_data->swap
 | ||||
| -          = gpt_part_data->bios_grub
 | ||||
| -          = gpt_part_data->hp_service
 | ||||
| -          = gpt_part_data->msftdata
 | ||||
| -          = gpt_part_data->msftrecv
 | ||||
| -          = gpt_part_data->prep
 | ||||
| -          = gpt_part_data->irst
 | ||||
| -          = gpt_part_data->chromeos_kernel
 | ||||
| -          = gpt_part_data->bls_boot
 | ||||
| -          = gpt_part_data->atvrecv = 0;
 | ||||
| -      return gpt_partition_set_system (part, part->fs_type);
 | ||||
| -    case PED_PARTITION_MSFT_DATA:
 | ||||
| -      gpt_part_data->msftres = state;
 | ||||
| -      if (state) {
 | ||||
| -        gpt_part_data->boot
 | ||||
| -          = gpt_part_data->raid
 | ||||
| -          = gpt_part_data->lvm
 | ||||
| -          = gpt_part_data->swap
 | ||||
| -          = gpt_part_data->bios_grub
 | ||||
| -          = gpt_part_data->hp_service
 | ||||
| -          = gpt_part_data->msftres
 | ||||
| -          = gpt_part_data->msftrecv
 | ||||
| -          = gpt_part_data->prep
 | ||||
| -          = gpt_part_data->irst
 | ||||
| -          = gpt_part_data->chromeos_kernel
 | ||||
| -          = gpt_part_data->bls_boot
 | ||||
| -          = gpt_part_data->atvrecv = 0;
 | ||||
| -        gpt_part_data->msftdata = 1;
 | ||||
| -      } else {
 | ||||
| -        gpt_part_data->msftdata = 0;
 | ||||
| -      }
 | ||||
| -      return gpt_partition_set_system (part, part->fs_type);
 | ||||
| -    case PED_PARTITION_DIAG:
 | ||||
| -      gpt_part_data->msftrecv = state;
 | ||||
| -      if (state)
 | ||||
| -        gpt_part_data->boot
 | ||||
| -          = gpt_part_data->raid
 | ||||
| -          = gpt_part_data->lvm
 | ||||
| -          = gpt_part_data->swap
 | ||||
| -          = gpt_part_data->bios_grub
 | ||||
| -          = gpt_part_data->hp_service
 | ||||
| -          = gpt_part_data->msftdata
 | ||||
| -          = gpt_part_data->msftres
 | ||||
| -          = gpt_part_data->prep
 | ||||
| -          = gpt_part_data->irst
 | ||||
| -          = gpt_part_data->chromeos_kernel
 | ||||
| -          = gpt_part_data->atvrecv = 0;
 | ||||
| -      return gpt_partition_set_system (part, part->fs_type);
 | ||||
| -    case PED_PARTITION_APPLE_TV_RECOVERY:
 | ||||
| -      gpt_part_data->atvrecv = state;
 | ||||
| -      if (state)
 | ||||
| -        gpt_part_data->boot
 | ||||
| -          = gpt_part_data->raid
 | ||||
| -          = gpt_part_data->lvm
 | ||||
| -          = gpt_part_data->swap
 | ||||
| -          = gpt_part_data->bios_grub
 | ||||
| -          = gpt_part_data->hp_service
 | ||||
| -          = gpt_part_data->msftres
 | ||||
| -          = gpt_part_data->msftdata
 | ||||
| -          = gpt_part_data->prep
 | ||||
| -          = gpt_part_data->chromeos_kernel
 | ||||
| -          = gpt_part_data->msftrecv = 0;
 | ||||
| -      return gpt_partition_set_system (part, part->fs_type);
 | ||||
| -    case PED_PARTITION_PREP:
 | ||||
| -      gpt_part_data->prep = state;
 | ||||
| -      if (state)
 | ||||
| -        gpt_part_data->boot
 | ||||
| -          = gpt_part_data->raid
 | ||||
| -          = gpt_part_data->lvm
 | ||||
| -          = gpt_part_data->swap
 | ||||
| -          = gpt_part_data->bios_grub
 | ||||
| -          = gpt_part_data->hp_service
 | ||||
| -          = gpt_part_data->msftres
 | ||||
| -          = gpt_part_data->irst
 | ||||
| -          = gpt_part_data->atvrecv
 | ||||
| -          = gpt_part_data->chromeos_kernel
 | ||||
| -          = gpt_part_data->bls_boot
 | ||||
| -          = gpt_part_data->msftrecv = 0;
 | ||||
| -      return gpt_partition_set_system (part, part->fs_type);
 | ||||
| -    case PED_PARTITION_IRST:
 | ||||
| -      gpt_part_data->irst = state;
 | ||||
| -      if (state)
 | ||||
| -        gpt_part_data->boot
 | ||||
| -          = gpt_part_data->raid
 | ||||
| -          = gpt_part_data->lvm
 | ||||
| -          = gpt_part_data->swap
 | ||||
| -          = gpt_part_data->bios_grub
 | ||||
| -          = gpt_part_data->hp_service
 | ||||
| -          = gpt_part_data->msftres
 | ||||
| -          = gpt_part_data->msftdata
 | ||||
| -          = gpt_part_data->msftrecv
 | ||||
| -          = gpt_part_data->prep
 | ||||
| -          = gpt_part_data->chromeos_kernel
 | ||||
| -          = gpt_part_data->bls_boot
 | ||||
| -          = gpt_part_data->atvrecv = 0;
 | ||||
| -      return gpt_partition_set_system (part, part->fs_type);
 | ||||
| -    case PED_PARTITION_CHROMEOS_KERNEL:
 | ||||
| -      gpt_part_data->chromeos_kernel = state;
 | ||||
| -      if (state)
 | ||||
| -        gpt_part_data->boot
 | ||||
| -          = gpt_part_data->bios_grub
 | ||||
| -          = gpt_part_data->raid
 | ||||
| -          = gpt_part_data->lvm
 | ||||
| -          = gpt_part_data->swap
 | ||||
| -          = gpt_part_data->hp_service
 | ||||
| -          = gpt_part_data->msftres
 | ||||
| -          = gpt_part_data->msftdata
 | ||||
| -          = gpt_part_data->msftrecv
 | ||||
| -          = gpt_part_data->atvrecv
 | ||||
| -          = gpt_part_data->prep
 | ||||
| -          = gpt_part_data->irst
 | ||||
| -          = gpt_part_data->bls_boot = 0;
 | ||||
| -      return gpt_partition_set_system (part, part->fs_type);
 | ||||
| -    case PED_PARTITION_BLS_BOOT:
 | ||||
| -      gpt_part_data->bls_boot = state;
 | ||||
| -      if (state)
 | ||||
| -        gpt_part_data->boot
 | ||||
| -          = gpt_part_data->raid
 | ||||
| -          = gpt_part_data->lvm
 | ||||
| -          = gpt_part_data->swap
 | ||||
| -          = gpt_part_data->bios_grub
 | ||||
| -          = gpt_part_data->hp_service
 | ||||
| -          = gpt_part_data->msftres
 | ||||
| -          = gpt_part_data->msftdata
 | ||||
| -          = gpt_part_data->msftrecv
 | ||||
| -          = gpt_part_data->prep
 | ||||
| -          = gpt_part_data->irst
 | ||||
| -          = gpt_part_data->chromeos_kernel
 | ||||
| -          = gpt_part_data->atvrecv = 0;
 | ||||
| -      return gpt_partition_set_system (part, part->fs_type);
 | ||||
|      case PED_PARTITION_HIDDEN: | ||||
|        gpt_part_data->attributes.RequiredToFunction = state; | ||||
|        return 1; | ||||
| @@ -1919,41 +1587,16 @@ gpt_partition_get_flag (const PedPartition *part, PedPartitionFlag flag)
 | ||||
|    PED_ASSERT (part->disk_specific != NULL); | ||||
|    gpt_part_data = part->disk_specific; | ||||
|   | ||||
| +  const struct flag_uuid_mapping_t* p = gpt_find_flag_uuid_mapping (flag);
 | ||||
| +  if (p)
 | ||||
| +    return guid_cmp (gpt_part_data->type, p->type_uuid) == 0;
 | ||||
| +
 | ||||
|    switch (flag) | ||||
|      { | ||||
| -    case PED_PARTITION_RAID:
 | ||||
| -      return gpt_part_data->raid;
 | ||||
| -    case PED_PARTITION_LVM:
 | ||||
| -      return gpt_part_data->lvm;
 | ||||
| -    case PED_PARTITION_ESP:
 | ||||
| -    case PED_PARTITION_BOOT:
 | ||||
| -      return gpt_part_data->boot;
 | ||||
| -    case PED_PARTITION_BIOS_GRUB:
 | ||||
| -      return gpt_part_data->bios_grub;
 | ||||
| -    case PED_PARTITION_HPSERVICE:
 | ||||
| -      return gpt_part_data->hp_service;
 | ||||
| -    case PED_PARTITION_MSFT_RESERVED:
 | ||||
| -      return gpt_part_data->msftres;
 | ||||
| -    case PED_PARTITION_MSFT_DATA:
 | ||||
| -      return gpt_part_data->msftdata;
 | ||||
| -    case PED_PARTITION_DIAG:
 | ||||
| -      return gpt_part_data->msftrecv;
 | ||||
| -    case PED_PARTITION_APPLE_TV_RECOVERY:
 | ||||
| -      return gpt_part_data->atvrecv;
 | ||||
|      case PED_PARTITION_HIDDEN: | ||||
|        return gpt_part_data->attributes.RequiredToFunction; | ||||
|      case PED_PARTITION_LEGACY_BOOT: | ||||
|        return gpt_part_data->attributes.LegacyBIOSBootable; | ||||
| -    case PED_PARTITION_PREP:
 | ||||
| -      return gpt_part_data->prep;
 | ||||
| -    case PED_PARTITION_IRST:
 | ||||
| -      return gpt_part_data->irst;
 | ||||
| -    case PED_PARTITION_BLS_BOOT:
 | ||||
| -      return gpt_part_data->bls_boot;
 | ||||
| -    case PED_PARTITION_SWAP:
 | ||||
| -	return gpt_part_data->swap;
 | ||||
| -    case PED_PARTITION_CHROMEOS_KERNEL:
 | ||||
| -      return gpt_part_data->chromeos_kernel;
 | ||||
|      case PED_PARTITION_LBA: | ||||
|      case PED_PARTITION_ROOT: | ||||
|      default: | ||||
| @@ -1966,25 +1609,13 @@ static int
 | ||||
|  gpt_partition_is_flag_available (const PedPartition *part, | ||||
|                                   PedPartitionFlag flag) | ||||
|  { | ||||
| +  if (gpt_find_flag_uuid_mapping (flag))
 | ||||
| +    return 1;
 | ||||
| +
 | ||||
|    switch (flag) | ||||
|      { | ||||
| -    case PED_PARTITION_RAID:
 | ||||
| -    case PED_PARTITION_LVM:
 | ||||
| -    case PED_PARTITION_SWAP:
 | ||||
| -    case PED_PARTITION_BOOT:
 | ||||
| -    case PED_PARTITION_BIOS_GRUB:
 | ||||
| -    case PED_PARTITION_HPSERVICE:
 | ||||
| -    case PED_PARTITION_MSFT_RESERVED:
 | ||||
| -    case PED_PARTITION_MSFT_DATA:
 | ||||
| -    case PED_PARTITION_DIAG:
 | ||||
| -    case PED_PARTITION_APPLE_TV_RECOVERY:
 | ||||
|      case PED_PARTITION_HIDDEN: | ||||
|      case PED_PARTITION_LEGACY_BOOT: | ||||
| -    case PED_PARTITION_PREP:
 | ||||
| -    case PED_PARTITION_IRST:
 | ||||
| -    case PED_PARTITION_ESP:
 | ||||
| -    case PED_PARTITION_CHROMEOS_KERNEL:
 | ||||
| -    case PED_PARTITION_BLS_BOOT:
 | ||||
|        return 1; | ||||
|      case PED_PARTITION_ROOT: | ||||
|      case PED_PARTITION_LBA: | ||||
| -- 
 | ||||
| 2.31.1 | ||||
| 
 | ||||
							
								
								
									
										72
									
								
								0040-gpt-Add-linux-home-flag.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										72
									
								
								0040-gpt-Add-linux-home-flag.patch
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,72 @@ | ||||
| From 6ef2f88d014f267157d9e9300b31c5f1ab4d5e42 Mon Sep 17 00:00:00 2001 | ||||
| From: Arvin Schnell <aschnell@suse.com> | ||||
| Date: Thu, 30 Sep 2021 13:49:30 -0700 | ||||
| Subject: [PATCH 40/43] gpt: Add linux-home flag | ||||
| 
 | ||||
| This sets the partition GUID to the linux home type: | ||||
| 933AC7E1-2EB4-4F13-B844-0E14E2AEF915 | ||||
| 
 | ||||
| Signed-off-by: Brian C. Lane <bcl@redhat.com> | ||||
| ---
 | ||||
|  include/parted/disk.in.h | 5 +++-- | ||||
|  libparted/disk.c         | 2 ++ | ||||
|  libparted/labels/gpt.c   | 5 +++++ | ||||
|  3 files changed, 10 insertions(+), 2 deletions(-) | ||||
| 
 | ||||
| diff --git a/include/parted/disk.in.h b/include/parted/disk.in.h
 | ||||
| index 7ca6453..303f59c 100644
 | ||||
| --- a/include/parted/disk.in.h
 | ||||
| +++ b/include/parted/disk.in.h
 | ||||
| @@ -84,10 +84,11 @@ enum _PedPartitionFlag {
 | ||||
|          PED_PARTITION_IRST=17, | ||||
|          PED_PARTITION_ESP=18, | ||||
|          PED_PARTITION_CHROMEOS_KERNEL=19, | ||||
| -        PED_PARTITION_BLS_BOOT=20
 | ||||
| +        PED_PARTITION_BLS_BOOT=20,
 | ||||
| +        PED_PARTITION_LINUX_HOME=21,
 | ||||
|  }; | ||||
|  #define PED_PARTITION_FIRST_FLAG        PED_PARTITION_BOOT | ||||
| -#define PED_PARTITION_LAST_FLAG         PED_PARTITION_BLS_BOOT
 | ||||
| +#define PED_PARTITION_LAST_FLAG         PED_PARTITION_LINUX_HOME
 | ||||
|   | ||||
|  enum _PedDiskTypeFeature { | ||||
|          PED_DISK_TYPE_EXTENDED=1,       /**< supports extended partitions */ | ||||
| diff --git a/libparted/disk.c b/libparted/disk.c
 | ||||
| index 345b9e7..8496fc0 100644
 | ||||
| --- a/libparted/disk.c
 | ||||
| +++ b/libparted/disk.c
 | ||||
| @@ -2411,6 +2411,8 @@ ped_partition_flag_get_name (PedPartitionFlag flag)
 | ||||
|                  return N_("chromeos_kernel"); | ||||
|  	case PED_PARTITION_BLS_BOOT: | ||||
|  		return N_("bls_boot"); | ||||
| +        case PED_PARTITION_LINUX_HOME:
 | ||||
| +                return N_("linux-home");
 | ||||
|   | ||||
|  	default: | ||||
|  		ped_exception_throw ( | ||||
| diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c
 | ||||
| index 3ba3cee..8b345d5 100644
 | ||||
| --- a/libparted/labels/gpt.c
 | ||||
| +++ b/libparted/labels/gpt.c
 | ||||
| @@ -164,6 +164,10 @@ typedef struct
 | ||||
|      ((efi_guid_t) { PED_CPU_TO_LE32 (0xbc13c2ff), PED_CPU_TO_LE16 (0x59e6), \ | ||||
|                      PED_CPU_TO_LE16 (0x4262), 0xa3, 0x52, \ | ||||
|                      { 0xb2, 0x75, 0xfd, 0x6f, 0x71, 0x72 }}) | ||||
| +#define PARTITION_LINUX_HOME_GUID \
 | ||||
| +    ((efi_guid_t) { PED_CPU_TO_LE32 (0x933ac7e1), PED_CPU_TO_LE16 (0x2eb4), \
 | ||||
| +                    PED_CPU_TO_LE16 (0x4f13), 0xb8, 0x44, \
 | ||||
| +                    { 0x0e, 0x14, 0xe2, 0xae, 0xf9, 0x15 }})
 | ||||
|   | ||||
|  struct flag_uuid_mapping_t | ||||
|  { | ||||
| @@ -182,6 +186,7 @@ static const struct flag_uuid_mapping_t flag_uuid_mapping[] =
 | ||||
|      { PED_PARTITION_ESP,                PARTITION_SYSTEM_GUID }, | ||||
|      { PED_PARTITION_HPSERVICE,          PARTITION_HPSERVICE_GUID }, | ||||
|      { PED_PARTITION_IRST,               PARTITION_IRST_GUID }, | ||||
| +    { PED_PARTITION_LINUX_HOME,         PARTITION_LINUX_HOME_GUID },
 | ||||
|      { PED_PARTITION_LVM,                PARTITION_LVM_GUID }, | ||||
|      { PED_PARTITION_MSFT_DATA,          PARTITION_BASIC_DATA_GUID }, | ||||
|      { PED_PARTITION_MSFT_RESERVED,      PARTITION_MSFT_RESERVED_GUID }, | ||||
| -- 
 | ||||
| 2.31.1 | ||||
| 
 | ||||
							
								
								
									
										42
									
								
								0041-doc-Document-gpt-linux-home-flag.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										42
									
								
								0041-doc-Document-gpt-linux-home-flag.patch
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,42 @@ | ||||
| From 87d78ee78ca8d09de0d4850280cfd0ea9d9662fd Mon Sep 17 00:00:00 2001 | ||||
| From: "Brian C. Lane" <bcl@redhat.com> | ||||
| Date: Thu, 30 Sep 2021 13:46:40 -0700 | ||||
| Subject: [PATCH 41/43] doc: Document gpt linux-home flag | ||||
| 
 | ||||
| ---
 | ||||
|  doc/C/parted.8  | 3 ++- | ||||
|  doc/parted.texi | 4 ++++ | ||||
|  2 files changed, 6 insertions(+), 1 deletion(-) | ||||
| 
 | ||||
| diff --git a/doc/C/parted.8 b/doc/C/parted.8
 | ||||
| index 46b30ad..afca9f2 100644
 | ||||
| --- a/doc/C/parted.8
 | ||||
| +++ b/doc/C/parted.8
 | ||||
| @@ -118,7 +118,8 @@ or an LVM logical volume if necessary.
 | ||||
|  .B set \fIpartition\fP \fIflag\fP \fIstate\fP | ||||
|  Change the state of the \fIflag\fP on \fIpartition\fP to \fIstate\fP. | ||||
|  Supported flags are: "boot", "root", "swap", "hidden", "raid", "lvm", "lba", | ||||
| -"legacy_boot", "irst", "msftres", "esp", "chromeos_kernel", "bls_boot" and "palo".
 | ||||
| +"legacy_boot", "irst", "msftres", "esp", "chromeos_kernel", "bls_boot", "linux-home",
 | ||||
| +and "palo".
 | ||||
|  \fIstate\fP should be either "on" or "off". | ||||
|  .TP | ||||
|  .B unit \fIunit\fP | ||||
| diff --git a/doc/parted.texi b/doc/parted.texi
 | ||||
| index 57ceb55..4344328 100644
 | ||||
| --- a/doc/parted.texi
 | ||||
| +++ b/doc/parted.texi
 | ||||
| @@ -904,6 +904,10 @@ MS Windows ME based operating systems to use Linear (LBA) mode.
 | ||||
|  (Mac) - this flag should be enabled if the partition is the root device | ||||
|  to be used by Linux. | ||||
|   | ||||
| +@item linux-home
 | ||||
| +(GPT) - Enable this to indicate that the selected partition is a
 | ||||
| +Linux /home partition.
 | ||||
| +
 | ||||
|  @item swap | ||||
|  (MS-DOS, GPT, Mac) - this flag should be enabled if the partition is the | ||||
|  swap device to be used by Linux. | ||||
| -- 
 | ||||
| 2.31.1 | ||||
| 
 | ||||
							
								
								
									
										144
									
								
								0042-tests-Add-a-test-to-make-sure-GPT-GUIDs-default-to-f.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										144
									
								
								0042-tests-Add-a-test-to-make-sure-GPT-GUIDs-default-to-f.patch
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,144 @@ | ||||
| From 10ad2aac0453f10b2e355a0df03618e0ebc593be Mon Sep 17 00:00:00 2001 | ||||
| From: "Brian C. Lane" <bcl@redhat.com> | ||||
| Date: Wed, 29 Sep 2021 15:57:50 -0700 | ||||
| Subject: [PATCH 42/43] tests: Add a test to make sure GPT GUIDs default to | ||||
|  filesystem | ||||
| 
 | ||||
| When no flag is set on a GPT partition the GUID should fall back to the | ||||
| filesystem type for fat32, swap, and hfs+ and if no filesystem is found | ||||
| it should default to linux filesystem data type, showing no filesystem | ||||
| and no flags. | ||||
| ---
 | ||||
|  tests/Makefile.am              |   1 + | ||||
|  tests/t3210-gpt-type-change.sh | 107 +++++++++++++++++++++++++++++++++ | ||||
|  2 files changed, 108 insertions(+) | ||||
|  create mode 100755 tests/t3210-gpt-type-change.sh | ||||
| 
 | ||||
| diff --git a/tests/Makefile.am b/tests/Makefile.am
 | ||||
| index 3dc6e72..5cb7aa3 100644
 | ||||
| --- a/tests/Makefile.am
 | ||||
| +++ b/tests/Makefile.am
 | ||||
| @@ -60,6 +60,7 @@ TESTS = \
 | ||||
|    t3000-resize-fs.sh \ | ||||
|    t3200-resize-partition.sh \ | ||||
|    t3200-type-change.sh \ | ||||
| +  t3210-gpt-type-change.sh \
 | ||||
|    t3300-palo-prep.sh \ | ||||
|    t3310-flags.sh \ | ||||
|    t3400-whole-disk-FAT-partition.sh \ | ||||
| diff --git a/tests/t3210-gpt-type-change.sh b/tests/t3210-gpt-type-change.sh
 | ||||
| new file mode 100755 | ||||
| index 0000000..57000d9
 | ||||
| --- /dev/null
 | ||||
| +++ b/tests/t3210-gpt-type-change.sh
 | ||||
| @@ -0,0 +1,107 @@
 | ||||
| +#!/bin/sh
 | ||||
| +# Ensure parted changes GUID back to match its FS.
 | ||||
| +
 | ||||
| +# Copyright (C) 2021 Free Software Foundation, Inc.
 | ||||
| +
 | ||||
| +# This program is free software; you can redistribute it and/or modify
 | ||||
| +# it under the terms of the GNU General Public License as published by
 | ||||
| +# the Free Software Foundation; either version 3 of the License, or
 | ||||
| +# (at your option) any later version.
 | ||||
| +
 | ||||
| +# This program is distributed in the hope that it will be useful,
 | ||||
| +# but WITHOUT ANY WARRANTY; without even the implied warranty of
 | ||||
| +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | ||||
| +# GNU General Public License for more details.
 | ||||
| +
 | ||||
| +# You should have received a copy of the GNU General Public License
 | ||||
| +# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | ||||
| +
 | ||||
| +. "${srcdir=.}/init.sh"; path_prepend_ ../parted
 | ||||
| +
 | ||||
| +require_root_
 | ||||
| +require_scsi_debug_module_
 | ||||
| +
 | ||||
| +grep '^#define USE_BLKID 1' "$CONFIG_HEADER" > /dev/null ||
 | ||||
| +  skip_ 'this system lacks a new-enough libblkid'
 | ||||
| +
 | ||||
| +# What filesystem tools are present?
 | ||||
| +FSTYPES=""
 | ||||
| +
 | ||||
| +# Is mkfs.hfsplus available?
 | ||||
| +mkfs.hfsplus 2>&1 | grep '^usage:' && FSTYPES="hfs+"
 | ||||
| +
 | ||||
| +# Is mkfs.vfat available?
 | ||||
| +mkfs.vfat 2>&1 | grep '^Usage:' && FSTYPES="$FSTYPES fat32"
 | ||||
| +
 | ||||
| +# Is mkswap available?
 | ||||
| +mkswap -V 2>&1 | grep '^mkswap' && FSTYPES="$FSTYPES linux-swap"
 | ||||
| +
 | ||||
| +[ -n "$FSTYPES" ] || skip_ "No supported filesystem tools (vfat, hfs+, swap) installed"
 | ||||
| +
 | ||||
| +
 | ||||
| +# create memory-backed device
 | ||||
| +scsi_debug_setup_ dev_size_mb=25 > dev-name ||
 | ||||
| +  skip_ 'failed to create scsi_debug device'
 | ||||
| +scsi_dev=$(cat dev-name)
 | ||||
| +
 | ||||
| +# Create a formatted partition. 
 | ||||
| +# Set a different partition type on it, eg. lvm, then unset it.
 | ||||
| +# The partition flag should return to the detected filesystem type.
 | ||||
| +
 | ||||
| +for fs_type in $FSTYPES; do
 | ||||
| +  echo "fs_type=$fs_type"
 | ||||
| +
 | ||||
| +
 | ||||
| +  parted -s $scsi_dev mklabel gpt mkpart first $fs_type 1MB 25MB > out 2>&1 || fail=1
 | ||||
| +  # expect no output
 | ||||
| +  compare /dev/null out || fail=1
 | ||||
| +
 | ||||
| +  p1=${scsi_dev}1
 | ||||
| +  wait_for_dev_to_appear_ $p1 || fail=1
 | ||||
| +
 | ||||
| +  case $fs_type in
 | ||||
| +    fat32) mkfs.vfat $p1 || fail=1 ;;
 | ||||
| +    hfs*) mkfs.hfsplus $p1 || fail=1;;
 | ||||
| +    linux-swap) mkswap $p1 || fail=1;;
 | ||||
| +    *) error "internal error: unhandled fs type: $fs_type";;
 | ||||
| +  esac
 | ||||
| +
 | ||||
| +  # Confirm the filesystem and flags are as expected
 | ||||
| +  parted -s $scsi_dev u s p > out || fail=1
 | ||||
| +  case $fs_type in
 | ||||
| +    fat32) grep 'fat16.*msftdata$' out || { fail=1; cat out; } ;;
 | ||||
| +    hfs*) grep 'hfs+.*first$' out || { fail=1; cat out; } ;;
 | ||||
| +    linux-swap) grep 'linux-swap.*swap$' out || { fail=1; cat out; } ;;
 | ||||
| +    *) error "internal error: unhandled fs type: $fs_type";;
 | ||||
| +  esac
 | ||||
| +
 | ||||
| +  # Set the lvm GUID on the partition
 | ||||
| +  parted -s $scsi_dev set 1 lvm on > out 2>&1 || fail=1
 | ||||
| +  # expect no output
 | ||||
| +  compare /dev/null out || fail=1
 | ||||
| +
 | ||||
| +  # Confirm filesystem probe is the same, but flags are now lvm
 | ||||
| +  parted -s $scsi_dev u s p > out || fail=1
 | ||||
| +  case $fs_type in
 | ||||
| +    fat32) grep 'fat16.*lvm$' out || { fail=1; cat out; } ;;
 | ||||
| +    hfs*) grep 'hfs+.*lvm$' out || { fail=1; cat out; } ;;
 | ||||
| +    linux-swap) grep 'linux-swap.*lvm$' out || { fail=1; cat out; } ;;
 | ||||
| +    *) error "internal error: unhandled fs type: $fs_type";;
 | ||||
| +  esac
 | ||||
| +
 | ||||
| +  # Unset the lvm GUID on both partitions
 | ||||
| +  parted -s $scsi_dev set 1 lvm off > out 2>&1 || fail=1
 | ||||
| +  # expect no output
 | ||||
| +  compare /dev/null out || fail=1
 | ||||
| +
 | ||||
| +  # Confirm the filesystem and flags are as expected
 | ||||
| +  parted -s $scsi_dev u s p > out || fail=1
 | ||||
| +  case $fs_type in
 | ||||
| +    fat32) grep 'fat16.*msftdata$' out || { fail=1; cat out; } ;;
 | ||||
| +    hfs*) grep 'hfs+.*first$' out || { fail=1; cat out; } ;;
 | ||||
| +    linux-swap) grep 'linux-swap.*swap$' out || { fail=1; cat out; } ;;
 | ||||
| +    *) error "internal error: unhandled fs type: $fs_type";;
 | ||||
| +  esac
 | ||||
| +done
 | ||||
| +
 | ||||
| +Exit $fail
 | ||||
| -- 
 | ||||
| 2.31.1 | ||||
| 
 | ||||
| @ -0,0 +1,25 @@ | ||||
| From a1f8bcde22bbd97ef7abae3c83ede77fc25a301c Mon Sep 17 00:00:00 2001 | ||||
| From: "Brian C. Lane" <bcl@redhat.com> | ||||
| Date: Thu, 30 Sep 2021 13:16:12 -0700 | ||||
| Subject: [PATCH 43/43] gpt: Revert to filesystem GUID when setting flag to off | ||||
| 
 | ||||
| ---
 | ||||
|  libparted/labels/gpt.c | 2 +- | ||||
|  1 file changed, 1 insertion(+), 1 deletion(-) | ||||
| 
 | ||||
| diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c
 | ||||
| index 8b345d5..c5d7bb3 100644
 | ||||
| --- a/libparted/labels/gpt.c
 | ||||
| +++ b/libparted/labels/gpt.c
 | ||||
| @@ -1565,7 +1565,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
 | ||||
|      if (state) | ||||
|        gpt_part_data->type = p->type_uuid; | ||||
|      else if (guid_cmp (gpt_part_data->type, p->type_uuid) == 0) | ||||
| -      gpt_part_data->type = PARTITION_LINUX_DATA_GUID;
 | ||||
| +      return gpt_partition_set_system (part, part->fs_type);
 | ||||
|      return 1; | ||||
|    } | ||||
|   | ||||
| -- 
 | ||||
| 2.31.1 | ||||
| 
 | ||||
							
								
								
									
										15
									
								
								parted.spec
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								parted.spec
									
									
									
									
									
								
							| @ -1,7 +1,7 @@ | ||||
| Summary: The GNU disk partition manipulation program | ||||
| Name:    parted | ||||
| Version: 3.4 | ||||
| Release: 9%{?dist} | ||||
| Release: 10%{?dist} | ||||
| License: GPLv3+ | ||||
| URL:     http://www.gnu.org/software/parted | ||||
| 
 | ||||
| @ -49,6 +49,12 @@ Patch0035: 0035-hurd-Fix-partition-paths.patch | ||||
| Patch0036: 0036-hurd-Support-rumpdisk-based-device-names.patch | ||||
| Patch0037: 0037-hurd-Implement-partition-table-rereading.patch | ||||
| Patch0038: 0038-keep-GUID-specific-attributes.patch | ||||
| Patch0039: 0039-gpt-Map-PED_PARTITON_-flags-to-GUID-values.patch | ||||
| Patch0040: 0040-gpt-Add-linux-home-flag.patch | ||||
| Patch0041: 0041-doc-Document-gpt-linux-home-flag.patch | ||||
| Patch0042: 0042-tests-Add-a-test-to-make-sure-GPT-GUIDs-default-to-f.patch | ||||
| Patch0043: 0043-gpt-Revert-to-filesystem-GUID-when-setting-flag-to-o.patch | ||||
| 
 | ||||
| 
 | ||||
| BuildRequires: gcc | ||||
| BuildRequires: e2fsprogs-devel | ||||
| @ -152,6 +158,13 @@ make check | ||||
| 
 | ||||
| 
 | ||||
| %changelog | ||||
| * Wed Oct 06 2021 Brian C. Lane <bcl@redhat.com> - 3.4-10 | ||||
| - gpt: Revert to filesystem GUID when setting flag to off (bcl) | ||||
| - tests: Add a test to make sure GPT GUIDs default to filesystem (bcl) | ||||
| - doc: Document gpt linux-home flag (bcl) | ||||
| - gpt: Add linux-home flag (aschnell) | ||||
| - gpt: Map PED_PARTITON_ flags to GUID values (aschnell) | ||||
| 
 | ||||
| * Thu Sep 23 2021 Brian C. Lane <bcl@redhat.com> - 3.4-9 | ||||
| - keep GUID specific attributes (aschnell) | ||||
| - hurd: Implement partition table rereading (cjwatson) | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user