diff options
author | Brian C. Lane <bcl@redhat.com> | 2013-09-11 12:25:03 -0700 |
---|---|---|
committer | Phillip Susi <psusi@ubuntu.com> | 2014-03-02 19:16:39 -0500 |
commit | 4d0cd271069997e7d44ed3b52426ccf2570048c8 (patch) | |
tree | 5eb2f7c8e94adf9d3d23753064b968f9af11e464 /libparted/labels/gpt.c | |
parent | 6a3194bf13d23c4e7fcc346f7188060d50f3cedc (diff) | |
download | parted-4d0cd271069997e7d44ed3b52426ccf2570048c8.tar.gz |
libparted: Add Intel Rapid Start Technology partition flag.
This adds support for the irst partition type flag. Sets the type to
0x84 on MS-DOS and D3BFE2DE-3DAF-11DF-BA-40-E3A556D89593 on GPT.
* NEWS (New Features): Mention it.
* doc/C/parted.8: Document irst flag.
* doc/parted.texti: Document irst flag.
* include/parted/disk.in.h (_PedPartitionFlag): Add PED_PARTITION_IRST flag
* libparted/disk.c (ped_partition_flag_get_name): Add irst flag
* libparted/labels/dos.c (DosPartitionData): Likewise
(raw_part_parse): Likewise
(msdos_partition_new): Likewise
(msdos_partition_duplicate): Likewise
(msdos_partition_set_system): Likewise
(clear_flags): Likewise
(msdos_partition_set_flag): Likewise
(msdos_partition_get_flag): Likewise
(msdos_partition_is_flag_available): Likewise
* libparted/labels/gpt.c: Add PARTITION_IRST_GUID
(GPTPartitionData): Add irst flag
(_parse_part_entry): Likewise
(gpt_partition_new): Likewise
(gpt_partition_set_system): Likewise
(gpt_partition_set_flag): Likewise
(gpt_partition_get_flag): Likewise
(gpt_partition_is_flag_available): Likewise
Diffstat (limited to 'libparted/labels/gpt.c')
-rw-r--r-- | libparted/labels/gpt.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c index 6fd8880..ff87708 100644 --- a/libparted/labels/gpt.c +++ b/libparted/labels/gpt.c @@ -152,6 +152,10 @@ typedef struct ((efi_guid_t) { PED_CPU_TO_LE32 (0x9e1a2d38), PED_CPU_TO_LE16 (0xc612), \ PED_CPU_TO_LE16 (0x4316), 0xaa, 0x26, \ { 0x8b, 0x49, 0x52, 0x1e, 0x5a, 0x8b }}) +#define PARTITION_IRST_GUID \ + ((efi_guid_t) { PED_CPU_TO_LE32 (0xD3BFE2DE), PED_CPU_TO_LE16 (0x3DAF), \ + PED_CPU_TO_LE16 (0x11DF), 0xba, 0x40, \ + { 0xE3, 0xA5, 0x56, 0xD8, 0x95, 0x93 }}) struct __attribute__ ((packed)) _GuidPartitionTableHeader_t { @@ -297,6 +301,7 @@ typedef struct _GPTPartitionData int msftrecv; int legacy_boot; int prep; + int irst; } GPTPartitionData; static PedDiskType gpt_disk_type; @@ -814,6 +819,7 @@ _parse_part_entry (PedDisk *disk, GuidPartitionEntry_t *pte) = gpt_part_data->msftrecv = gpt_part_data->legacy_boot = gpt_part_data->prep + = gpt_part_data->irst = gpt_part_data->bios_grub = gpt_part_data->atvrecv = 0; if (pte->Attributes.RequiredToFunction & 0x1) @@ -841,6 +847,8 @@ _parse_part_entry (PedDisk *disk, GuidPartitionEntry_t *pte) 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; return part; } @@ -1359,6 +1367,7 @@ gpt_partition_new (const PedDisk *disk, gpt_part_data->legacy_boot = 0; gpt_part_data->prep = 0; gpt_part_data->translated_name = 0; + gpt_part_data->irst = 0; uuid_generate ((unsigned char *) &gpt_part_data->uuid); swap_uuid_and_efi_guid ((unsigned char *) (&gpt_part_data->uuid)); memset (gpt_part_data->name, 0, sizeof gpt_part_data->name); @@ -1477,6 +1486,11 @@ gpt_partition_set_system (PedPartition *part, 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 (fs_type) { @@ -1619,6 +1633,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state) = gpt_part_data->msftdata = gpt_part_data->msftrecv = gpt_part_data->prep + = gpt_part_data->irst = gpt_part_data->atvrecv = 0; return gpt_partition_set_system (part, part->fs_type); case PED_PARTITION_BIOS_GRUB: @@ -1632,6 +1647,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state) = gpt_part_data->msftdata = gpt_part_data->msftrecv = gpt_part_data->prep + = gpt_part_data->irst = gpt_part_data->atvrecv = 0; return gpt_partition_set_system (part, part->fs_type); case PED_PARTITION_RAID: @@ -1645,6 +1661,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state) = gpt_part_data->msftdata = gpt_part_data->msftrecv = gpt_part_data->prep + = gpt_part_data->irst = gpt_part_data->atvrecv = 0; return gpt_partition_set_system (part, part->fs_type); case PED_PARTITION_LVM: @@ -1658,6 +1675,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state) = gpt_part_data->msftdata = gpt_part_data->msftrecv = gpt_part_data->prep + = gpt_part_data->irst = gpt_part_data->atvrecv = 0; return gpt_partition_set_system (part, part->fs_type); case PED_PARTITION_HPSERVICE: @@ -1671,6 +1689,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state) = gpt_part_data->msftdata = gpt_part_data->msftrecv = gpt_part_data->prep + = gpt_part_data->irst = gpt_part_data->atvrecv = 0; return gpt_partition_set_system (part, part->fs_type); case PED_PARTITION_MSFT_RESERVED: @@ -1684,6 +1703,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state) = gpt_part_data->msftdata = gpt_part_data->msftrecv = gpt_part_data->prep + = gpt_part_data->irst = gpt_part_data->atvrecv = 0; return gpt_partition_set_system (part, part->fs_type); case PED_PARTITION_MSFT_DATA: @@ -1697,6 +1717,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state) = gpt_part_data->msftres = gpt_part_data->msftrecv = gpt_part_data->prep + = gpt_part_data->irst = gpt_part_data->atvrecv = 0; gpt_part_data->msftdata = 1; } else { @@ -1714,6 +1735,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state) = gpt_part_data->msftdata = gpt_part_data->msftres = gpt_part_data->prep + = gpt_part_data->irst = gpt_part_data->atvrecv = 0; return gpt_partition_set_system (part, part->fs_type); case PED_PARTITION_APPLE_TV_RECOVERY: @@ -1738,7 +1760,22 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state) = 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->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->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->atvrecv = 0; return gpt_partition_set_system (part, part->fs_type); case PED_PARTITION_HIDDEN: @@ -1789,6 +1826,8 @@ gpt_partition_get_flag (const PedPartition *part, PedPartitionFlag flag) return gpt_part_data->legacy_boot; case PED_PARTITION_PREP: return gpt_part_data->prep; + case PED_PARTITION_IRST: + return gpt_part_data->irst; case PED_PARTITION_SWAP: case PED_PARTITION_LBA: case PED_PARTITION_ROOT: @@ -1816,6 +1855,7 @@ gpt_partition_is_flag_available (const PedPartition *part, case PED_PARTITION_HIDDEN: case PED_PARTITION_LEGACY_BOOT: case PED_PARTITION_PREP: + case PED_PARTITION_IRST: return 1; case PED_PARTITION_SWAP: case PED_PARTITION_ROOT: |