summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Vignaud <thierry.vignaud@gmail.com>2019-04-21 01:35:23 +0200
committerMartin Whitaker <mageia@martin-whitaker.me.uk>2019-04-21 18:16:59 +0100
commit4347386dd56bd9de45eb6b393d2418c24142550b (patch)
treefa84828bb6a2702a7bd324dbd8524452b41dd31c
parentd31fd0c37b54b1c617ef3792550c13098976e579 (diff)
downloaddrakx-4347386dd56bd9de45eb6b393d2418c24142550b.tar
drakx-4347386dd56bd9de45eb6b393d2418c24142550b.tar.gz
drakx-4347386dd56bd9de45eb6b393d2418c24142550b.tar.bz2
drakx-4347386dd56bd9de45eb6b393d2418c24142550b.tar.xz
drakx-4347386dd56bd9de45eb6b393d2418c24142550b.zip
(_get_disk_type) factorize code after previous commits
-rw-r--r--perl-install/partition_table.pm15
1 files changed, 9 insertions, 6 deletions
diff --git a/perl-install/partition_table.pm b/perl-install/partition_table.pm
index 13715852f..230cdc6a3 100644
--- a/perl-install/partition_table.pm
+++ b/perl-install/partition_table.pm
@@ -258,6 +258,13 @@ sub default_type {
is_uefi() || $hd->{totalsectors} > 2 * 1024 * 1024 * 2048 ? 'gpt' : "dos";
}
+sub _get_disk_type {
+ my ($hd) = @_;
+ my $current = c::get_disk_type($hd->{file});
+ $current = 'dos' if $current eq 'msdos';
+ $hd->{current_pt_table_type} = $current;
+}
+
=item initialize($hd, $o_type)
Initialize a $hd object.
@@ -271,9 +278,7 @@ The optional $o_type parameter enables to override the detected disk type (eg: '
sub initialize {
my ($hd, $o_type) = @_;
- my $current = c::get_disk_type($hd->{file});
- $current = 'dos' if $current eq 'msdos';
- $hd->{current_pt_table_type} = $current;
+ my $current = _get_disk_type($hd);
my $type = $o_type || $current || default_type($hd);
$hd->{pt_table_type} = $type;
@@ -302,9 +307,7 @@ sub read_primary {
#- The libparted ped_disk_probe() function opens the raw device for R/W, which causes a
#- change event to be sent for every partition when the raw device is closed again. So
#- be careful not to call this function more than once. (mga#15752)
- my $current = c::get_disk_type($hd->{file});
- $current = 'dos' if $current eq 'msdos';
- $hd->{current_pt_table_type} = $current;
+ _get_disk_type($hd);
my @parttype = (
# gpt must be tried before dos as it presents a fake compatibility mbr