summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--perl-install/NEWS1
-rwxr-xr-xperl-install/c/stuff.xs.pl46
-rw-r--r--perl-install/install/NEWS1
-rw-r--r--perl-install/partition_table/gpt.pm8
4 files changed, 26 insertions, 30 deletions
diff --git a/perl-install/NEWS b/perl-install/NEWS
index bbfbddd5e..f9f2574a7 100644
--- a/perl-install/NEWS
+++ b/perl-install/NEWS
@@ -6,6 +6,7 @@
- ugtk2, ugtk3, harddrake2:
o do not "restore" mouse cursor on the root window, we haven't set it to
'wait' since 2005 and this causes a crash if we don't own it (mga#15729).
+- speed up reading of flags from GPT partition table (mga#15621).
Version 16.85 - 15 April 2015
diff --git a/perl-install/c/stuff.xs.pl b/perl-install/c/stuff.xs.pl
index 9d8c11375..229e3b8ab 100755
--- a/perl-install/c/stuff.xs.pl
+++ b/perl-install/c/stuff.xs.pl
@@ -132,6 +132,15 @@ PedPartitionFlag string_to_pedpartflag(char*type) {
return flag;
}
+int is_recovery_partition(PedPartition*part) {
+ /* FIXME: not sure everything is covered ... */
+ return ped_partition_get_flag(part, PED_PARTITION_HPSERVICE) // HP-UX service partition
+ || ped_partition_get_flag(part, PED_PARTITION_MSFT_RESERVED) // Microsoft Reserved Partition -> LDM metadata, ...
+ || ped_partition_get_flag(part, PED_PARTITION_DIAG) // ==> PARTITION_MSFT_RECOVERY (Windows Recovery Environment)
+ || ped_partition_get_flag(part, PED_PARTITION_APPLE_TV_RECOVERY)
+ || ped_partition_get_flag(part, PED_PARTITION_HIDDEN);
+}
+
MODULE = c::stuff PACKAGE = c::stuff
';
@@ -591,31 +600,6 @@ get_iso_volume_ids(int fd)
print '
int
-is_recovery_partition(char * device_path, int part_number)
- CODE:
- PedDevice *dev = ped_device_get(device_path);
- RETVAL = 0;
- if(dev) {
- PedDisk* disk = ped_disk_new(dev);
- if(disk) {
- PedPartition* part = ped_disk_get_partition(disk, part_number);
- if (!part) {
- printf("is_recovery_partition: failed to find partition\n");
- } else {
- /* FIXME: not sure everything is covered ... */
- RETVAL=ped_partition_get_flag(part, PED_PARTITION_HPSERVICE) // HP-UX service partition
- || ped_partition_get_flag(part, PED_PARTITION_MSFT_RESERVED) // Microsoft Reserved Partition -> LDM metadata, ...
- || ped_partition_get_flag(part, PED_PARTITION_DIAG) // ==> PARTITION_MSFT_RECOVERY (Windows Recovery Environment)
- || ped_partition_get_flag(part, PED_PARTITION_APPLE_TV_RECOVERY)
- || ped_partition_get_flag(part, PED_PARTITION_HIDDEN);
- }
- ped_disk_destroy(disk);
- }
- }
- OUTPUT:
- RETVAL
-
-int
get_partition_flag(char * device_path, int part_number, char *type)
CODE:
PedDevice *dev = ped_device_get(device_path);
@@ -700,12 +684,23 @@ get_disk_partitions(char * device_path)
continue;
}
char *path = ped_partition_get_path(part);
+ char *flag = "";
+ if (ped_partition_get_flag(part, PED_PARTITION_ESP)) {
+ flag = "ESP";
+ } else if (ped_partition_get_flag(part, PED_PARTITION_LVM)) {
+ flag = "LVM";
+ } else if (ped_partition_get_flag(part, PED_PARTITION_RAID)) {
+ flag = "RAID";
+ } else if (is_recovery_partition(part)) {
+ flag = "RECOVERY";
+ }
HV * rh = (HV *)sv_2mortal((SV *)newHV());
hv_store(rh, "part_number", 11, newSViv(part->num), 0);
hv_store(rh, "real_device", 11, newSVpv(path, 0), 0);
hv_store(rh, "start", 5, newSViv(part->geom.start), 0);
hv_store(rh, "size", 4, newSViv(part->geom.length), 0);
hv_store(rh, "pt_type", 7, newSViv(0xba), 0);
+ hv_store(rh, "flag", 4, newSVpv(flag, 0), 0);
free(path);
if(part->fs_type)
hv_store(rh, "fs_type", 7, newSVpv(part->fs_type->name, 0), 0);
@@ -882,4 +877,3 @@ print '
PROTOTYPES: DISABLE
';
-
diff --git a/perl-install/install/NEWS b/perl-install/install/NEWS
index 0f2cfbdac..5611c00a4 100644
--- a/perl-install/install/NEWS
+++ b/perl-install/install/NEWS
@@ -3,6 +3,7 @@
disk, not the last one across all disks (mga#15589)
o suggest up to 20GB/20% of the windows partition (whichever is larger),
previously 6GB/10% (mga#15589)
+- speed up reading of flags from GPT partition table (mga#15621).
Version 16.84 - 14 April 2015
diff --git a/perl-install/partition_table/gpt.pm b/perl-install/partition_table/gpt.pm
index 1a284c214..0f0f45c6a 100644
--- a/perl-install/partition_table/gpt.pm
+++ b/perl-install/partition_table/gpt.pm
@@ -111,13 +111,13 @@ sub read_one {
# FIXME: just use '@pt = map { ... } c::...' if part_numbers are always linear:
foreach (c::get_disk_partitions($hd->{file})) {
# fix detecting ESP (special case are they're detected through pt_type):
- if (c::get_partition_flag($hd->{file}, $_->{part_number}, 'ESP')) {
+ if ($_->{flag} eq 'ESP') {
$_->{pt_type} = 0xef;
- } elsif (c::get_partition_flag($hd->{file}, $_->{part_number}, 'LVM')) {
+ } elsif ($_->{flag} eq 'LVM') {
$_->{pt_type} = 0x8e;
- } elsif (c::get_partition_flag($hd->{file}, $_->{part_number}, 'RAID')) {
+ } elsif ($_->{flag} eq 'RAID') {
$_->{pt_type} = 0xfd;
- } elsif (c::is_recovery_partition($hd->{file}, $_->{part_number})) {
+ } elsif ($_->{flag} eq 'RECOVERY') {
$_->{pt_type} = 0x12;
}
$_->{fs_type} = 'swap' if $_->{fs_type} eq 'linux-swap(v1)';