summaryrefslogtreecommitdiffstats
path: root/perl-install/diskdrake
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install/diskdrake')
-rw-r--r--perl-install/diskdrake/hd_gtk.pm24
1 files changed, 17 insertions, 7 deletions
diff --git a/perl-install/diskdrake/hd_gtk.pm b/perl-install/diskdrake/hd_gtk.pm
index 3ccc84d12..8b205df29 100644
--- a/perl-install/diskdrake/hd_gtk.pm
+++ b/perl-install/diskdrake/hd_gtk.pm
@@ -250,13 +250,8 @@ sub current_kind_changed {
my ($_in, $kind) = @_;
$_->destroy foreach $kind->{display_box}->get_children;
-
- my $v = $kind->{val};
- my @parts =
- $kind->{type} eq 'raid' ? grep { $_ } @$v :
- $kind->{type} eq 'loopback' ? @$v : fs::get::hds_fstab_and_holes($v);
- my $totalsectors =
- $kind->{type} =~ /raid|loopback/ ? sum(map { $_->{size} } @parts) : $v->{totalsectors};
+ my @parts = kind2parts($kind);
+ my $totalsectors = kind2sectors($kind, @parts);
create_buttons4partitions($kind, $totalsectors, @parts);
}
@@ -433,6 +428,21 @@ sub createOrChangeType {
}
}
+sub kind2parts {
+ my ($kind) = @_;
+ my $v = $kind->{val};
+ my @parts =
+ $kind->{type} eq 'raid' ? grep { $_ } @$v :
+ $kind->{type} eq 'loopback' ? @$v : fs::get::hds_fstab_and_holes($v);
+ @parts;
+}
+
+sub kind2sectors {
+ my ($kind, @parts) = @_;
+ my $v = $kind->{val};
+ $kind->{type} =~ /raid|loopback/ ? sum(map { $_->{size} } @parts) : $v->{totalsectors};
+}
+
################################################################################
# lvms: helpers
################################################################################