OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/parted?expand=0&rev=105
319 lines
11 KiB
Diff
319 lines
11 KiB
Diff
From e6a23531e0cb40c2cc75f1e8fbb86ab872cb6f1b Mon Sep 17 00:00:00 2001
|
|
From: "Brian C. Lane" <bcl@redhat.com>
|
|
Date: Mon, 26 Aug 2013 16:27:00 -0700
|
|
Subject: [PATCH 65/69] 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.
|
|
|
|
---
|
|
doc/C/parted.8 | 2 +-
|
|
include/parted/disk.in.h | 5 +++--
|
|
libparted/disk.c | 2 ++
|
|
libparted/labels/dos.c | 21 +++++++++++++++++++++
|
|
libparted/labels/gpt.c | 37 +++++++++++++++++++++++++++++++++++++
|
|
5 files changed, 64 insertions(+), 3 deletions(-)
|
|
|
|
Index: parted-3.1/doc/C/parted.8
|
|
===================================================================
|
|
--- parted-3.1.orig/doc/C/parted.8
|
|
+++ parted-3.1/doc/C/parted.8
|
|
@@ -104,7 +104,7 @@ 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" and "palo".
|
|
+"legacy_boot", "irst" and "palo".
|
|
\fIstate\fP should be either "on" or "off".
|
|
.TP
|
|
.B unit \fIunit\fP
|
|
Index: parted-3.1/include/parted/disk.in.h
|
|
===================================================================
|
|
--- parted-3.1.orig/include/parted/disk.in.h
|
|
+++ parted-3.1/include/parted/disk.in.h
|
|
@@ -73,10 +73,11 @@ enum _PedPartitionFlag {
|
|
PED_PARTITION_APPLE_TV_RECOVERY=13,
|
|
PED_PARTITION_DIAG=14,
|
|
PED_PARTITION_LEGACY_BOOT=15,
|
|
- PED_PARTITION_TYPE=16
|
|
+ PED_PARTITION_TYPE=16,
|
|
+ PED_PARTITION_IRST=17
|
|
};
|
|
#define PED_PARTITION_FIRST_FLAG PED_PARTITION_BOOT
|
|
-#define PED_PARTITION_LAST_FLAG PED_PARTITION_TYPE
|
|
+#define PED_PARTITION_LAST_FLAG PED_PARTITION_IRST
|
|
|
|
enum _PedDiskTypeFeature {
|
|
PED_DISK_TYPE_EXTENDED=1, /**< supports extended partitions */
|
|
Index: parted-3.1/libparted/disk.c
|
|
===================================================================
|
|
--- parted-3.1.orig/libparted/disk.c
|
|
+++ parted-3.1/libparted/disk.c
|
|
@@ -2474,6 +2474,8 @@ ped_partition_flag_get_name (PedPartitio
|
|
return N_("diag");
|
|
case PED_PARTITION_LEGACY_BOOT:
|
|
return N_("legacy_boot");
|
|
+ case PED_PARTITION_IRST:
|
|
+ return N_("irst");
|
|
|
|
default:
|
|
ped_exception_throw (
|
|
Index: parted-3.1/libparted/labels/dos.c
|
|
===================================================================
|
|
--- parted-3.1.orig/libparted/labels/dos.c
|
|
+++ parted-3.1/libparted/labels/dos.c
|
|
@@ -85,6 +85,7 @@ static const char MBR_BOOT_CODE[] = {
|
|
#define PARTITION_LDM 0x42
|
|
#define PARTITION_LINUX_SWAP 0x82
|
|
#define PARTITION_LINUX 0x83
|
|
+#define PARTITION_IRST 0x84
|
|
#define PARTITION_LINUX_EXT 0x85
|
|
#define PARTITION_LINUX_LVM 0x8e
|
|
#define PARTITION_HFS 0xaf
|
|
@@ -159,6 +160,7 @@ typedef struct {
|
|
int palo;
|
|
int prep;
|
|
int diag;
|
|
+ int irst;
|
|
OrigState* orig; /* used for CHS stuff */
|
|
} DosPartitionData;
|
|
|
|
@@ -924,6 +926,7 @@ raw_part_parse (const PedDisk* disk, con
|
|
dos_data->lba = raw_part_is_lba (raw_part);
|
|
dos_data->palo = raw_part->type == PARTITION_PALO;
|
|
dos_data->prep = raw_part->type == PARTITION_PREP;
|
|
+ dos_data->irst = raw_part->type == PARTITION_IRST;
|
|
dos_data->orig = ped_malloc (sizeof (OrigState));
|
|
if (!dos_data->orig) {
|
|
ped_partition_destroy (part);
|
|
@@ -1339,6 +1342,7 @@ msdos_partition_new (const PedDisk* disk
|
|
dos_data->lba = 0;
|
|
dos_data->palo = 0;
|
|
dos_data->prep = 0;
|
|
+ dos_data->irst = 0;
|
|
} else {
|
|
part->disk_specific = NULL;
|
|
}
|
|
@@ -1374,6 +1378,7 @@ msdos_partition_duplicate (const PedPart
|
|
new_dos_data->lba = old_dos_data->lba;
|
|
new_dos_data->palo = old_dos_data->palo;
|
|
new_dos_data->prep = old_dos_data->prep;
|
|
+ new_dos_data->irst = old_dos_data->irst;
|
|
|
|
if (old_dos_data->orig) {
|
|
new_dos_data->orig = ped_malloc (sizeof (OrigState));
|
|
@@ -1422,6 +1427,7 @@ msdos_partition_set_system (PedPartition
|
|
dos_data->lvm = 0;
|
|
dos_data->palo = 0;
|
|
dos_data->prep = 0;
|
|
+ dos_data->irst = 0;
|
|
if (dos_data->lba)
|
|
dos_data->system = PARTITION_EXT_LBA;
|
|
else
|
|
@@ -1454,6 +1460,10 @@ msdos_partition_set_system (PedPartition
|
|
dos_data->system = PARTITION_PREP;
|
|
return 1;
|
|
}
|
|
+ if (dos_data->irst) {
|
|
+ dos_data->system = PARTITION_IRST;
|
|
+ return 1;
|
|
+ }
|
|
|
|
if (!fs_type)
|
|
dos_data->system = PARTITION_LINUX;
|
|
@@ -1490,6 +1500,7 @@ clear_flags (DosPartitionData *dos_data)
|
|
dos_data->lvm = 0;
|
|
dos_data->palo = 0;
|
|
dos_data->prep = 0;
|
|
+ dos_data->irst = 0;
|
|
dos_data->raid = 0;
|
|
}
|
|
|
|
@@ -1572,6 +1583,12 @@ msdos_partition_set_flag (PedPartition*
|
|
dos_data->prep = state;
|
|
return ped_partition_set_system (part, part->fs_type);
|
|
|
|
+ case PED_PARTITION_IRST:
|
|
+ if (state)
|
|
+ clear_flags (dos_data);
|
|
+ dos_data->irst = state;
|
|
+ return ped_partition_set_system (part, part->fs_type);
|
|
+
|
|
default:
|
|
return 0;
|
|
}
|
|
@@ -1617,6 +1634,9 @@ msdos_partition_get_flag (const PedParti
|
|
case PED_PARTITION_PREP:
|
|
return dos_data->prep;
|
|
|
|
+ case PED_PARTITION_IRST:
|
|
+ return dos_data->irst;
|
|
+
|
|
default:
|
|
return 0;
|
|
}
|
|
@@ -1640,6 +1660,7 @@ msdos_partition_is_flag_available (const
|
|
case PED_PARTITION_TYPE:
|
|
case PED_PARTITION_PALO:
|
|
case PED_PARTITION_PREP:
|
|
+ case PED_PARTITION_IRST:
|
|
case PED_PARTITION_DIAG:
|
|
return 1;
|
|
|
|
Index: parted-3.1/libparted/labels/gpt.c
|
|
===================================================================
|
|
--- parted-3.1.orig/libparted/labels/gpt.c
|
|
+++ parted-3.1/libparted/labels/gpt.c
|
|
@@ -142,6 +142,10 @@ typedef struct
|
|
((efi_guid_t) { PED_CPU_TO_LE32 (0x5265636F), PED_CPU_TO_LE16 (0x7665), \
|
|
PED_CPU_TO_LE16 (0x11AA), 0xaa, 0x11, \
|
|
{ 0x00, 0x30, 0x65, 0x43, 0xEC, 0xAC }})
|
|
+#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
|
|
{
|
|
@@ -283,6 +287,7 @@ typedef struct _GPTPartitionData
|
|
int atvrecv;
|
|
int msftrecv;
|
|
int legacy_boot;
|
|
+ int irst;
|
|
} GPTPartitionData;
|
|
|
|
static PedDiskType gpt_disk_type;
|
|
@@ -885,6 +890,7 @@ _parse_part_entry (PedDisk *disk, GuidPa
|
|
= gpt_part_data->hidden = gpt_part_data->msftres
|
|
= gpt_part_data->msftrecv
|
|
= gpt_part_data->legacy_boot
|
|
+ = gpt_part_data->irst
|
|
= gpt_part_data->bios_grub = gpt_part_data->atvrecv = 0;
|
|
|
|
if (pte->Attributes.RequiredToFunction & 0x1)
|
|
@@ -908,6 +914,8 @@ _parse_part_entry (PedDisk *disk, GuidPa
|
|
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_IRST_GUID))
|
|
+ gpt_part_data->irst = 1;
|
|
|
|
return part;
|
|
}
|
|
@@ -1531,6 +1539,7 @@ gpt_partition_new (const PedDisk *disk,
|
|
gpt_part_data->msftrecv = 0;
|
|
gpt_part_data->atvrecv = 0;
|
|
gpt_part_data->legacy_boot = 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);
|
|
@@ -1634,6 +1643,11 @@ gpt_partition_set_system (PedPartition *
|
|
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)
|
|
{
|
|
@@ -1774,6 +1788,7 @@ gpt_partition_set_flag (PedPartition *pa
|
|
= gpt_part_data->hp_service
|
|
= gpt_part_data->msftres
|
|
= gpt_part_data->msftrecv
|
|
+ = gpt_part_data->irst
|
|
= gpt_part_data->atvrecv = 0;
|
|
return gpt_partition_set_system (part, part->fs_type);
|
|
case PED_PARTITION_BIOS_GRUB:
|
|
@@ -1785,6 +1800,7 @@ gpt_partition_set_flag (PedPartition *pa
|
|
= gpt_part_data->hp_service
|
|
= gpt_part_data->msftres
|
|
= gpt_part_data->msftrecv
|
|
+ = gpt_part_data->irst
|
|
= gpt_part_data->atvrecv = 0;
|
|
return gpt_partition_set_system (part, part->fs_type);
|
|
case PED_PARTITION_RAID:
|
|
@@ -1796,6 +1812,7 @@ gpt_partition_set_flag (PedPartition *pa
|
|
= gpt_part_data->hp_service
|
|
= gpt_part_data->msftres
|
|
= gpt_part_data->msftrecv
|
|
+ = gpt_part_data->irst
|
|
= gpt_part_data->atvrecv = 0;
|
|
return gpt_partition_set_system (part, part->fs_type);
|
|
case PED_PARTITION_LVM:
|
|
@@ -1807,6 +1824,7 @@ gpt_partition_set_flag (PedPartition *pa
|
|
= gpt_part_data->hp_service
|
|
= gpt_part_data->msftres
|
|
= gpt_part_data->msftrecv
|
|
+ = gpt_part_data->irst
|
|
= gpt_part_data->atvrecv = 0;
|
|
return gpt_partition_set_system (part, part->fs_type);
|
|
case PED_PARTITION_HPSERVICE:
|
|
@@ -1818,6 +1836,7 @@ gpt_partition_set_flag (PedPartition *pa
|
|
= gpt_part_data->bios_grub
|
|
= gpt_part_data->msftres
|
|
= gpt_part_data->msftrecv
|
|
+ = gpt_part_data->irst
|
|
= gpt_part_data->atvrecv = 0;
|
|
return gpt_partition_set_system (part, part->fs_type);
|
|
case PED_PARTITION_MSFT_RESERVED:
|
|
@@ -1829,6 +1848,7 @@ gpt_partition_set_flag (PedPartition *pa
|
|
= gpt_part_data->bios_grub
|
|
= gpt_part_data->hp_service
|
|
= gpt_part_data->msftrecv
|
|
+ = gpt_part_data->irst
|
|
= gpt_part_data->atvrecv = 0;
|
|
return gpt_partition_set_system (part, part->fs_type);
|
|
case PED_PARTITION_DIAG:
|
|
@@ -1840,6 +1860,7 @@ gpt_partition_set_flag (PedPartition *pa
|
|
= gpt_part_data->bios_grub
|
|
= gpt_part_data->hp_service
|
|
= gpt_part_data->msftres
|
|
+ = gpt_part_data->irst
|
|
= gpt_part_data->atvrecv = 0;
|
|
return gpt_partition_set_system (part, part->fs_type);
|
|
case PED_PARTITION_APPLE_TV_RECOVERY:
|
|
@@ -1851,8 +1872,21 @@ gpt_partition_set_flag (PedPartition *pa
|
|
= gpt_part_data->bios_grub
|
|
= gpt_part_data->hp_service
|
|
= gpt_part_data->msftres
|
|
+ = gpt_part_data->irst
|
|
= 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->msftrecv
|
|
+ = gpt_part_data->atvrecv = 0;
|
|
+ return gpt_partition_set_system (part, part->fs_type);
|
|
case PED_PARTITION_HIDDEN:
|
|
gpt_part_data->hidden = state;
|
|
return 1;
|
|
@@ -1897,6 +1931,8 @@ gpt_partition_get_flag (const PedPartiti
|
|
return gpt_part_data->hidden;
|
|
case PED_PARTITION_LEGACY_BOOT:
|
|
return gpt_part_data->legacy_boot;
|
|
+ case PED_PARTITION_IRST:
|
|
+ return gpt_part_data->irst;
|
|
case PED_PARTITION_SWAP:
|
|
case PED_PARTITION_LBA:
|
|
case PED_PARTITION_ROOT:
|
|
@@ -1922,6 +1958,7 @@ gpt_partition_is_flag_available (const P
|
|
case PED_PARTITION_APPLE_TV_RECOVERY:
|
|
case PED_PARTITION_HIDDEN:
|
|
case PED_PARTITION_LEGACY_BOOT:
|
|
+ case PED_PARTITION_IRST:
|
|
return 1;
|
|
case PED_PARTITION_SWAP:
|
|
case PED_PARTITION_ROOT:
|