diff options
-rw-r--r-- | perl-install/partition_table.pm | 15 |
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 |