summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2004-07-23 04:11:20 +0000
committerPascal Rigaux <pixel@mandriva.com>2004-07-23 04:11:20 +0000
commit4458a8a8985d3c7c66588ff1cf0748178ad23c17 (patch)
treea88ba2f5f2135cfeb37eee21471592a6e6e1d012
parent1d8347ff685c50364932f1b2e720a4a97c7d550c (diff)
downloaddrakx-backup-do-not-use-4458a8a8985d3c7c66588ff1cf0748178ad23c17.tar
drakx-backup-do-not-use-4458a8a8985d3c7c66588ff1cf0748178ad23c17.tar.gz
drakx-backup-do-not-use-4458a8a8985d3c7c66588ff1cf0748178ad23c17.tar.bz2
drakx-backup-do-not-use-4458a8a8985d3c7c66588ff1cf0748178ad23c17.tar.xz
drakx-backup-do-not-use-4458a8a8985d3c7c66588ff1cf0748178ad23c17.zip
replace pt_type2name($part->{pt_type}) with part2name($part)
(hoisting the dereferencing {pt_type})
-rw-r--r--perl-install/diskdrake/hd_gtk.pm2
-rw-r--r--perl-install/diskdrake/interactive.pm10
-rw-r--r--perl-install/fs.pm2
-rw-r--r--perl-install/fs/format.pm4
-rw-r--r--perl-install/install_any.pm2
-rw-r--r--perl-install/partition_table.pm9
6 files changed, 16 insertions, 13 deletions
diff --git a/perl-install/diskdrake/hd_gtk.pm b/perl-install/diskdrake/hd_gtk.pm
index 8ec9e80be..8479c3f3e 100644
--- a/perl-install/diskdrake/hd_gtk.pm
+++ b/perl-install/diskdrake/hd_gtk.pm
@@ -292,7 +292,7 @@ sub create_buttons4partitions {
last;
}
});
- $w->set_name("PART_" . pt_type2name($entry->{pt_type}));
+ $w->set_name("PART_" . part2name($entry));
$w->set_size_request($entry->{size} * $ratio + $minwidth, 0);
gtkpack__($kind->{display_box}, $w);
$w->grab_focus if $current_entry && fsedit::are_same_partitions($current_entry, $entry);
diff --git a/perl-install/diskdrake/interactive.pm b/perl-install/diskdrake/interactive.pm
index fb2676114..f4e73c885 100644
--- a/perl-install/diskdrake/interactive.pm
+++ b/perl-install/diskdrake/interactive.pm
@@ -460,7 +460,7 @@ sub Create {
#- including one less sector for start due to a capacity to increase the adjustement by
#- one.
my ($primaryOrExtended, $migrate_files);
- my $type_name = pt_type2name($part->{pt_type});
+ my $type_name = part2name($part);
my $mb_size = $part->{size} >> 11;
my $has_startsector = ($::expert || arch() !~ /i.86/) && !isLVM($hd);
@@ -566,7 +566,7 @@ sub Type {
#- when readonly, Type() is allowed only when changing between various { 0x83, 0x183, ... }
@types = grep { (name2pt_type($_) & 0xff) == 0x83 } @types if $hd->{readonly};
- my $type_name = pt_type2name($part->{pt_type});
+ my $type_name = part2name($part);
$in->ask_from_({ title => N("Change partition type"),
messages => N("Which filesystem do you want?"),
focus_first => 1,
@@ -874,7 +874,7 @@ sub Loopback {
}
delete $part->{mntpoint}; # we don't want the suggested mntpoint
- my $type_name = pt_type2name($part->{pt_type});
+ my $type_name = part2name($part);
my $mb_size = $part->{size} >> 11;
$in->ask_from(N("Loopback"), '', [
{ label => N("Loopback file name: "), val => \$part->{loopback_file} },
@@ -1166,7 +1166,7 @@ sub format_part_info {
$info .= N("Name: ") . $new_value . "\n";
}
} elsif ($part->{pt_type}) {
- my $type_name = substr(pt_type2name($part->{pt_type}), 0, 40); # limit the length
+ my $type_name = substr(part2name($part), 0, 40); # limit the length
$info .= N("Type: ") . $type_name . ($::expert ? sprintf " (0x%x)", $part->{pt_type} : '') . "\n";
} else {
$info .= N("Empty") . "\n";
@@ -1232,7 +1232,7 @@ sub format_raw_hd_info {
$info .= N("Mount point: ") . "$raw_hd->{mntpoint}\n" if $raw_hd->{mntpoint};
$info .= format_hd_info($raw_hd);
if ($raw_hd->{pt_type}) {
- my $type_name = substr(pt_type2name($raw_hd->{pt_type}), 0, 40); # limit the length
+ my $type_name = substr(part2name($raw_hd), 0, 40); # limit the length
$info .= N("Type: ") . $type_name . "\n";
}
if (my $s = $raw_hd->{options}) {
diff --git a/perl-install/fs.pm b/perl-install/fs.pm
index b19eaf9f1..efd1502db 100644
--- a/perl-install/fs.pm
+++ b/perl-install/fs.pm
@@ -119,7 +119,7 @@ sub merge_fstabs {
$p->{pt_type} && $p2->{pt_type} && $p->{pt_type} ne $p2->{pt_type} && type2fs($p) ne type2fs($p2) &&
$p->{pt_type} ne 'auto' && $p2->{pt_type} ne 'auto' and
log::l("err, fstab and partition table do not agree for $p->{device} type: " .
- (type2fs($p) || pt_type2name($p->{pt_type})) . " vs ", (type2fs($p2) || pt_type2name($p2->{pt_type})));
+ (type2fs($p) || part2name($p)) . " vs ", (type2fs($p2) || part2name($p2)));
}
@l;
}
diff --git a/perl-install/fs/format.pm b/perl-install/fs/format.pm
index 6f5dff294..ee72eadcb 100644
--- a/perl-install/fs/format.pm
+++ b/perl-install/fs/format.pm
@@ -44,7 +44,7 @@ sub part_raw {
my $dev = $part->{real_device} || $part->{device};
my @options = if_($part->{toFormatCheck}, "-c");
- log::l("formatting device $dev (type ", pt_type2name($part->{pt_type}), ")");
+ log::l("formatting device $dev (type ", part2name($part), ")");
my $fs_type = type2fs($part);
@@ -58,7 +58,7 @@ sub part_raw {
push @options, '-l', 'bootstrap';
}
- my $cmd = $cmds{$fs_type} or die N("I don't know how to format %s in type %s", $part->{device}, pt_type2name($part->{pt_type}));
+ my $cmd = $cmds{$fs_type} or die N("I don't know how to format %s in type %s", $part->{device}, part2name($part));
run_program::raw({ timeout => 60 * 60 }, $cmd, @options, devices::make($dev)) or die N("%s formatting of %s failed", $fs_type, $dev);
diff --git a/perl-install/install_any.pm b/perl-install/install_any.pm
index 5fd0b8c6f..286e88be8 100644
--- a/perl-install/install_any.pm
+++ b/perl-install/install_any.pm
@@ -1130,7 +1130,7 @@ sub getHds {
}
}
- my @sunos = grep { isSunOS($_) && pt_type2name($_->{pt_type}) =~ /root/i } @{$o->{fstab}}; #- take only into account root partitions.
+ my @sunos = grep { isSunOS($_) && part2name($_) =~ /root/i } @{$o->{fstab}}; #- take only into account root partitions.
if (@sunos) {
my $v = '';
map { $_->{mntpoint} = $_->{unsafeMntpoint} = "/mnt/sunos" . ($v && ++$v) } @sunos;
diff --git a/perl-install/partition_table.pm b/perl-install/partition_table.pm
index 3f6243ebe..812ed4826 100644
--- a/perl-install/partition_table.pm
+++ b/perl-install/partition_table.pm
@@ -6,7 +6,7 @@ use vars qw(@ISA %EXPORT_TAGS @EXPORT_OK @important_types @important_types2 @fie
@ISA = qw(Exporter);
%EXPORT_TAGS = (
- types => [ qw(pt_type2name type2fs name2pt_type fs2pt_type isExtended isExt2 isThisFs isTrueLocalFS isTrueFS isSwap isDos isWin isFat isFat_or_NTFS isSunOS isOtherAvailableFS isPrimary isRawLVM isRawRAID isRAID isLVM isMountableRW isNonMountable isPartOfLVM isPartOfRAID isPartOfLoopback isLoopback isMounted isBusy isSpecial maybeFormatted isApple isAppleBootstrap isEfi) ],
+ types => [ qw(part2name type2fs name2pt_type fs2pt_type isExtended isExt2 isThisFs isTrueLocalFS isTrueFS isSwap isDos isWin isFat isFat_or_NTFS isSunOS isOtherAvailableFS isPrimary isRawLVM isRawRAID isRAID isLVM isMountableRW isNonMountable isPartOfLVM isPartOfRAID isPartOfLoopback isLoopback isMounted isBusy isSpecial maybeFormatted isApple isAppleBootstrap isEfi) ],
);
@EXPORT_OK = map { @$_ } values %EXPORT_TAGS;
@@ -220,7 +220,10 @@ sub type2fs {
$pt_type2fs{$pt_type} || $pt_type =~ /^(\d+)$/ && $o_default || $pt_type;
}
sub fs2pt_type { $fs2pt_type{$_[0]} || $_[0] }
-sub pt_type2name { $pt_type2name{$_[0]} || $_[0] }
+sub part2name {
+ my ($part) = @_;
+ $pt_type2name{$part->{pt_type}} || $part->{pt_type};
+}
sub name2pt_type {
local ($_) = @_;
/0x(.*)/ ? hex $1 : $name2pt_type{$_} || $_;
@@ -278,7 +281,7 @@ sub description {
formatXiB($hd->{totalsectors} || $hd->{size}, 512),
$hd->{info} && ", $hd->{info}",
$hd->{mntpoint} && ", " . $hd->{mntpoint},
- $hd->{pt_type} && ", " . pt_type2name($hd->{pt_type});
+ $hd->{pt_type} && ", " . part2name($hd);
}
sub isPrimary {