Mageia Bugzilla – Attachment 6316 Details for
Bug 15621
Installer/Live boot/drakxtools scanning hard disk partitions step very slow
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
New Account
|
Forgot Password
Patch to speed up reading of partition flags
partition_flag.patch (text/plain), 2.87 KB, created by
Martin Whitaker
on 2015-04-19 17:30:10 CEST
(
hide
)
Description:
Patch to speed up reading of partition flags
Filename:
MIME Type:
Creator:
Martin Whitaker
Created:
2015-04-19 17:30:10 CEST
Size:
2.87 KB
patch
obsolete
>diff --git a/perl-install/c/stuff.xs.pl b/perl-install/c/stuff.xs.pl >index 9d8c113..7806566 100755 >--- a/perl-install/c/stuff.xs.pl >+++ b/perl-install/c/stuff.xs.pl >@@ -700,12 +700,27 @@ 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 (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)) { >+ 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 +897,3 @@ print ' > > PROTOTYPES: DISABLE > '; >- >diff --git a/perl-install/partition_table/gpt.pm b/perl-install/partition_table/gpt.pm >index 1a284c2..0f0f45c 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)';
diff --git a/perl-install/c/stuff.xs.pl b/perl-install/c/stuff.xs.pl index 9d8c113..7806566 100755 --- a/perl-install/c/stuff.xs.pl +++ b/perl-install/c/stuff.xs.pl @@ -700,12 +700,27 @@ 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 (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)) { + 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 +897,3 @@ print ' PROTOTYPES: DISABLE '; - diff --git a/perl-install/partition_table/gpt.pm b/perl-install/partition_table/gpt.pm index 1a284c2..0f0f45c 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)';
View Attachment As Raw
Actions:
View
Attachments on
bug 15621
:
6178
|
6316
|
6317