summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2003-02-12 11:26:15 +0000
committerPascal Rigaux <pixel@mandriva.com>2003-02-12 11:26:15 +0000
commitab822df75cf6884051525b61dd3e21f2254994b4 (patch)
treeb7bdbb354bc01089ab9f410885e2d81fdb673f3f /perl-install
parent9836f3fe7d2fef5e86015234ebb223afe7ddb844 (diff)
downloaddrakx-ab822df75cf6884051525b61dd3e21f2254994b4.tar
drakx-ab822df75cf6884051525b61dd3e21f2254994b4.tar.gz
drakx-ab822df75cf6884051525b61dd3e21f2254994b4.tar.bz2
drakx-ab822df75cf6884051525b61dd3e21f2254994b4.tar.xz
drakx-ab822df75cf6884051525b61dd3e21f2254994b4.zip
perl_checker compliance ("ref" now need parentheses in many case)
Diffstat (limited to 'perl-install')
-rw-r--r--perl-install/any.pm2
-rw-r--r--perl-install/commands.pm4
-rw-r--r--perl-install/diskdrake/interactive.pm2
-rw-r--r--perl-install/install_steps.pm4
-rw-r--r--perl-install/install_steps_auto_install.pm4
-rw-r--r--perl-install/install_steps_gtk.pm2
-rw-r--r--perl-install/install_steps_interactive.pm2
-rw-r--r--perl-install/install_steps_newt.pm2
-rw-r--r--perl-install/install_steps_stdio.pm2
-rw-r--r--perl-install/interactive.pm4
-rw-r--r--perl-install/interactive/gtk.pm2
-rw-r--r--perl-install/modules.pm2
-rw-r--r--perl-install/network/netconnect.pm2
-rw-r--r--perl-install/partition_table.pm2
-rw-r--r--perl-install/raid.pm2
-rw-r--r--perl-install/run_program.pm4
-rw-r--r--perl-install/ugtk2.pm12
17 files changed, 27 insertions, 27 deletions
diff --git a/perl-install/any.pm b/perl-install/any.pm
index cdd24ffc6..c7cbafe02 100644
--- a/perl-install/any.pm
+++ b/perl-install/any.pm
@@ -419,7 +419,7 @@ N("Here are the entries on your boot menu so far.
You can create additional entries or change the existing ones."), [ {
format => sub {
my ($e) = @_;
- ref $e ?
+ ref($e) ?
"$e->{label} ($e->{kernel_or_dev})" . ($b->{default} eq $e->{label} && " *") :
translate($e);
}, list => $b->{entries},
diff --git a/perl-install/commands.pm b/perl-install/commands.pm
index 9e1d9b95c..ab8ab4885 100644
--- a/perl-install/commands.pm
+++ b/perl-install/commands.pm
@@ -267,8 +267,8 @@ sub dd {
$h{$1} = $2;
}
local (*IF, *OF); my ($tmp, $nb, $read);
- ref $h{if} eq 'GLOB' ? (*IF = $h{if}) : sysopen(IF, $h{if}, 0) || die "error: can't open file $h{if}\n";
- ref $h{of} eq 'GLOB' ? (*OF = $h{of}) : sysopen(OF, $h{of}, 0x41) || die "error: can't open file $h{of}\n";
+ ref($h{if}) eq 'GLOB' ? (*IF = $h{if}) : sysopen(IF, $h{if}, 0) || die "error: can't open file $h{if}\n";
+ ref($h{of}) eq 'GLOB' ? (*OF = $h{of}) : sysopen(OF, $h{of}, 0x41) || die "error: can't open file $h{of}\n";
$h{bs} = removeXiBSuffix($h{bs});
diff --git a/perl-install/diskdrake/interactive.pm b/perl-install/diskdrake/interactive.pm
index 2656f06b6..82a49bd30 100644
--- a/perl-install/diskdrake/interactive.pm
+++ b/perl-install/diskdrake/interactive.pm
@@ -790,7 +790,7 @@ sub Add2LVM {
write_partitions($in, $_) or return foreach isRAID($part) ? @{$all_hds->{hds}} : $hd;
my $lvm = $in->ask_from_listf_('', N("Choose an existing LVM to add to"),
- sub { ref $_[0] ? $_[0]{VG_name} : $_[0] },
+ sub { ref($_[0]) ? $_[0]{VG_name} : $_[0] },
[ @$lvms, N_("new") ]) or return;
require lvm;
if (!ref $lvm) {
diff --git a/perl-install/install_steps.pm b/perl-install/install_steps.pm
index 0d5a2a78a..5c1c1d817 100644
--- a/perl-install/install_steps.pm
+++ b/perl-install/install_steps.pm
@@ -36,7 +36,7 @@ use fs;
sub new($$) {
my ($type, $o) = @_;
- bless $o, ref $type || $type;
+ bless $o, ref($type) || $type;
return $o;
}
@@ -63,7 +63,7 @@ sub leavingStep {
my $reachable = 1;
if (my $needs = $o->{steps}{$s}{needs}) {
- my @l = ref $needs ? @$needs : $needs;
+ my @l = ref($needs) ? @$needs : $needs;
$reachable = min(map { $o->{steps}{$_}{done} || 0 } @l);
}
$o->{steps}{$s}{reachable} = 1 if $reachable;
diff --git a/perl-install/install_steps_auto_install.pm b/perl-install/install_steps_auto_install.pm
index bc2a07fe6..d13accd73 100644
--- a/perl-install/install_steps_auto_install.pm
+++ b/perl-install/install_steps_auto_install.pm
@@ -33,7 +33,7 @@ sub new {
goto &{$::{$interactiveClass . "::"}{new}};
} else {
@ISA = ('install_steps_auto_install_non_interactive', @ISA);
- (bless {}, ref $type || $type)->install_steps::new($o);
+ (bless {}, ref($type) || $type)->install_steps::new($o);
}
}
@@ -87,7 +87,7 @@ sub rebootNeeded {
}
sub ask_warn {
- log::l(ref $_[1] ? join " ", @{$_[1]} : $_[1]);
+ log::l(ref($_[1]) ? join " ", @{$_[1]} : $_[1]);
}
sub wait_message {}
diff --git a/perl-install/install_steps_gtk.pm b/perl-install/install_steps_gtk.pm
index a4577c7df..cc6b2e168 100644
--- a/perl-install/install_steps_gtk.pm
+++ b/perl-install/install_steps_gtk.pm
@@ -135,7 +135,7 @@ sub new($$) {
};
$ugtk2::force_center = [ $::rootwidth - $::windowwidth, $::logoheight, $::windowwidth, $::windowheight ];
- $o = (bless {}, ref $type || $type)->SUPER::new($o);
+ $o = (bless {}, ref($type) || $type)->SUPER::new($o);
$o->interactive::gtk::new;
$o;
}
diff --git a/perl-install/install_steps_interactive.pm b/perl-install/install_steps_interactive.pm
index c38ba4449..82590c618 100644
--- a/perl-install/install_steps_interactive.pm
+++ b/perl-install/install_steps_interactive.pm
@@ -137,7 +137,7 @@ sub selectInstallClass {
my $p = $o->ask_from_listf(N("Install/Upgrade"),
N("Is this an install or an upgrade?"),
sub {
- ref $_[0] ? (@l > 1 ?
+ ref($_[0]) ? (@l > 1 ?
N("Upgrade %s", $_[0]{release}) :
N("Upgrade")) :
translate($_[0]);
diff --git a/perl-install/install_steps_newt.pm b/perl-install/install_steps_newt.pm
index e3d10243e..36c6ec8cf 100644
--- a/perl-install/install_steps_newt.pm
+++ b/perl-install/install_steps_newt.pm
@@ -32,7 +32,7 @@ sub new {
#-PO This string must fit in a 80-char wide text screen
Newt::PushHelpLine(N(" <Tab>/<Alt-Tab> between elements | <Space> selects | <F12> next screen "));
- (bless {}, ref $type || $type)->SUPER::new($o);
+ (bless {}, ref($type) || $type)->SUPER::new($o);
}
sub enteringStep {
diff --git a/perl-install/install_steps_stdio.pm b/perl-install/install_steps_stdio.pm
index 66b104147..223c2f2b5 100644
--- a/perl-install/install_steps_stdio.pm
+++ b/perl-install/install_steps_stdio.pm
@@ -14,7 +14,7 @@ use lang;
sub new($$) {
my ($type, $o) = @_;
- (bless {}, ref $type || $type)->SUPER::new($o);
+ (bless {}, ref($type) || $type)->SUPER::new($o);
}
sub enteringStep {
diff --git a/perl-install/interactive.pm b/perl-install/interactive.pm
index 5d311b0ad..55c1d5c45 100644
--- a/perl-install/interactive.pm
+++ b/perl-install/interactive.pm
@@ -80,7 +80,7 @@ use common;
sub new($) {
my ($type) = @_;
- bless {}, ref $type || $type;
+ bless {}, ref($type) || $type;
}
sub vnew {
@@ -311,7 +311,7 @@ sub ask_from_normalize {
$e->{type} ||= 'combo';
if (!$e->{not_edit}) {
- die q(when using "not_edit" you must use strings, not a data structure) if ref ${$e->{val}} || any { ref $_ } @$li;
+ die q(when using "not_edit" you must use strings, not a data structure) if ref(${$e->{val}}) || any { ref $_ } @$li;
}
if ($e->{type} ne 'combo' || $e->{not_edit}) {
${$e->{val}} = $li->[0] if !member(may_apply($e->{format}, ${$e->{val}}), map { may_apply($e->{format}, $_) } @$li);
diff --git a/perl-install/interactive/gtk.pm b/perl-install/interactive/gtk.pm
index 935e8372a..cc065ec01 100644
--- a/perl-install/interactive/gtk.pm
+++ b/perl-install/interactive/gtk.pm
@@ -648,7 +648,7 @@ sub ask_fromW {
my $widget_to_focus =
$common->{focus_cancel} ? $mainw->{cancel} :
- @widgets && ($common->{focus_first} || !$mainw->{ok} || @widgets == 1 && member(ref $widgets[0]{focus_w}, "Gtk2::TreeView", "Gtk2::RadioButton")) ?
+ @widgets && ($common->{focus_first} || !$mainw->{ok} || @widgets == 1 && member(ref($widgets[0]{focus_w}), "Gtk2::TreeView", "Gtk2::RadioButton")) ?
$widgets[0]{focus_w} :
$mainw->{ok};
$widget_to_focus->grab_focus() if $widget_to_focus;
diff --git a/perl-install/modules.pm b/perl-install/modules.pm
index 764575341..b852c7e8e 100644
--- a/perl-install/modules.pm
+++ b/perl-install/modules.pm
@@ -28,7 +28,7 @@ sub load {
#- keeping the order of modules
my %options;
my @l = map {
- my ($name, @options) = ref $_ ? @$_ : $_;
+ my ($name, @options) = ref($_) ? @$_ : $_;
$options{$name} = \@options;
dependencies_closure($name);
} @_;
diff --git a/perl-install/network/netconnect.pm b/perl-install/network/netconnect.pm
index 37336a153..84fe157fe 100644
--- a/perl-install/network/netconnect.pm
+++ b/perl-install/network/netconnect.pm
@@ -466,7 +466,7 @@ sub get_net_device {
my $connect_file = "/etc/sysconfig/network-scripts/net_cnx_up";
my $network_file = "/etc/sysconfig/network";
if (cat_("$prefix$connect_file") =~ /network/) {
- ${ { getVarsFromSh("$prefix$network_file") } }{GATEWAYDEV};
+ ${{ getVarsFromSh("$prefix$network_file") }}{GATEWAYDEV};
} else {
"ppp+";
};
diff --git a/perl-install/partition_table.pm b/perl-install/partition_table.pm
index 8051142a8..0cd11e489 100644
--- a/perl-install/partition_table.pm
+++ b/perl-install/partition_table.pm
@@ -783,7 +783,7 @@ sub load {
}
$@ and die N("Restoring from file %s failed: %s", $file, $@);
- ref $h eq 'ARRAY' or die N("Bad backup file");
+ ref($h) eq 'ARRAY' or die N("Bad backup file");
my %h; @h{@fields2save} = @$h;
diff --git a/perl-install/raid.pm b/perl-install/raid.pm
index c59bc3021..83d5e7dd4 100644
--- a/perl-install/raid.pm
+++ b/perl-install/raid.pm
@@ -17,7 +17,7 @@ sub max_nb { 31 }
sub nb {
my ($nb) = @_;
- first((ref $nb ? $nb->{device} : $nb) =~ /(\d+)/);
+ first((ref($nb) ? $nb->{device} : $nb) =~ /(\d+)/);
}
sub new {
diff --git a/perl-install/run_program.pm b/perl-install/run_program.pm
index bb28acda3..025feae2d 100644
--- a/perl-install/run_program.pm
+++ b/perl-install/run_program.pm
@@ -40,13 +40,13 @@ sub rooted {
sub raw {
my ($options, $name, @args) = @_;
my $root = $options->{root} || '';
- my $str = ref $name ? $name->[0] : $name;
+ my $str = ref($name) ? $name->[0] : $name;
log::l("running: $str @args" . ($root ? " with root $root" : ""));
return 1 if $root && $<;
$root ? ($root .= '/') : ($root = '');
- install_any::check_prog(ref $name ? $name->[0] : $name) if !$root && $::isInstall;
+ install_any::check_prog(ref($name) ? $name->[0] : $name) if !$root && $::isInstall;
my ($stdout_raw, $stdout_mode, $stderr_raw, $stderr_mode);
diff --git a/perl-install/ugtk2.pm b/perl-install/ugtk2.pm
index 200374451..3ddf0b56d 100644
--- a/perl-install/ugtk2.pm
+++ b/perl-install/ugtk2.pm
@@ -285,7 +285,7 @@ sub create_scrolled_window {
my $w = Gtk2::ScrolledWindow->new(undef, undef);
$policy ||= [ 'automatic', 'automatic' ];
$w->set_policy(@{$policy});
- if (member(ref $W, qw(Gtk2::Layout Gtk2::Text Gtk2::TextView Gtk2::TreeView))) {
+ if (member(ref($W), qw(Gtk2::Layout Gtk2::Text Gtk2::TextView Gtk2::TreeView))) {
$w->add($W)
} else {
$w->add_with_viewport($W);
@@ -336,10 +336,10 @@ sub create_box_with_title {
1, gtkpack_($o->{box_title} = Gtk2::VBox->new(0,0),
1, Gtk2::HBox->new(0,0),
(map {
- my $w = ref $_ ? $_ : Gtk2::Label->new($_);
+ my $w = ref($_) ? $_ : Gtk2::Label->new($_);
$::isWizard and $w->set_justify("left");
(0, gtkset_name($w, "Title"));
- } map { ref $_ ? $_ : warp_text($_) } @_),
+ } map { ref($_) ? $_ : warp_text($_) } @_),
1, Gtk2::HBox->new(0,0),
)
),
@@ -348,10 +348,10 @@ sub create_box_with_title {
} else {
gtkpack__($box,
(map {
- my $w = ref $_ ? $_ : Gtk2::Label->new($_);
+ my $w = ref($_) ? $_ : Gtk2::Label->new($_);
$::isWizard and $w->set_justify("left");
gtkset_name($w, "Title");
- } map { ref $_ ? $_ : warp_text($_) } @_),
+ } map { ref($_) ? $_ : warp_text($_) } @_),
if_($a, Gtk2::HSeparator->new)
)
}
@@ -1225,7 +1225,7 @@ sub ask_browse_tree_info_given_widgets {
$common->{display_info} = sub { gtktext_insert($w->{info}, $common->{get_info}($curr)); 0 };
my $children = sub { map { my $v = $w->{tree_model}->get($_, 0); $_->free; $v } gtktreeview_children($w->{tree_model}, $_[0]) };
my $toggle = sub {
- if (ref $curr && !$_[0]) {
+ if (ref($curr) && !$_[0]) {
$w->{tree}->toggle_expansion(my $path = $w->{tree_model}->get_path($curr));
$path->free;
} else {
ze; u_short entry_count; void* apic_address; u_short extended_table_length; u_char extended_table_checksum; u_char reserved; } mpcth_t; typedef struct PROCENTRY { u_char type; u_char apicID; u_char apicVersion; u_char cpuFlags; u_long cpuSignature; u_long featureFlags; u_long reserved1; u_long reserved2; } ProcEntry; #define PROCENTRY_FLAG_EN 0x01 static void seekEntry( vm_offset_t addr ); static void apic_probe( vm_offset_t* paddr, int* where ); static void readEntry( void* entry, int size ); /* global data */ static int pfd; /* physical /dev/mem fd */ static int verbose = 0; static int grope = 0; static int readType() { u_char type; if ( read( pfd, &type, sizeof( u_char ) ) != sizeof( u_char ) ) { perror( "type read" ); fprintf( stderr, "\npfd: %d", pfd ); fflush( stderr ); exit( 1 ); } if ( lseek( pfd, -1, SEEK_CUR ) < 0 ) { perror( "type seek" ); exit( 1 ); } return (int)type; } static int intelDetectSMP(void) { vm_offset_t paddr; int where; mpfps_t mpfps; int rc = 0; int ncpus = 0; /* open physical memory for access to MP structures */ if ( (pfd = open( "/dev/mem", O_RDONLY )) < 0 ) { return 0; } /* probe for MP structures */ apic_probe( &paddr, &where ); if ( where <= 0 ) return 0; seekEntry( paddr ); readEntry( &mpfps, sizeof( mpfps_t ) ); if (mpfps.mpfb1) /* old style */ rc = 1; else { /* go to the config table */ mpcth_t cth; int count, i; paddr = (vm_offset_t) mpfps.pap; seekEntry( paddr ); readEntry( &cth, sizeof( cth ) ); /* if we don't have any entries, the kernel sure won't be able to set up mp. Needs at least one entry for smp kernel */ if (cth.entry_count <= 1) { close (pfd); return 0; } count = cth.entry_count; for (i = 0; i < count; i++) { if ( readType() == 0 ) { ProcEntry entry; readEntry( &entry, sizeof( entry ) ); if (entry.cpuFlags & PROCENTRY_FLAG_EN) ncpus++; } } if (ncpus > 1) rc = 1; } close (pfd); return rc; } /* * set PHYSICAL address of MP floating pointer structure */ #define NEXT(X) ((X) += 4) static void apic_probe( vm_offset_t* paddr, int* where ) { /* * c rewrite of apic_probe() by Jack F. Vogel */ int x; u_short segment; vm_offset_t target; u_int buffer[ BIOS_SIZE / sizeof( int ) ]; if ( verbose ) printf( "\n" ); /* search Extended Bios Data Area, if present */ if ( verbose ) printf( " looking for EBDA pointer @ 0x%04x, ", EBDA_POINTER ); seekEntry( (vm_offset_t)EBDA_POINTER ); readEntry( &segment, 2 ); if ( segment ) { /* search EBDA */ target = (vm_offset_t)segment << 4; if ( verbose ) printf( "found, searching EBDA @ 0x%08x\n", target ); seekEntry( target ); readEntry( buffer, ONE_KBYTE ); for ( x = 0; x < ONE_KBYTE / sizeof ( unsigned int ); NEXT(x) ) { if ( buffer[ x ] == MP_SIG ) { *where = 1; *paddr = (x * sizeof( unsigned int )) + target; return; } } } else { if ( verbose ) printf( "NOT found\n" ); } /* read CMOS for real top of mem */ seekEntry( (vm_offset_t)TOPOFMEM_POINTER ); readEntry( &segment, 2 ); --segment; /* less ONE_KBYTE */ target = segment * 1024; if ( verbose ) printf( " searching CMOS 'top of mem' @ 0x%08x (%dK)\n", target, segment ); seekEntry( target ); readEntry( buffer, ONE_KBYTE ); for ( x = 0; x < ONE_KBYTE / sizeof ( unsigned int ); NEXT(x) ) { if ( buffer[ x ] == MP_SIG ) { *where = 2; *paddr = (x * sizeof( unsigned int )) + target; return; } } /* we don't necessarily believe CMOS, check base of the last 1K of 640K */ if ( target != (DEFAULT_TOPOFMEM - 1024)) { target = (DEFAULT_TOPOFMEM - 1024); if ( verbose ) printf( " searching default 'top of mem' @ 0x%08x (%dK)\n", target, (target / 1024) ); seekEntry( target ); readEntry( buffer, ONE_KBYTE ); for ( x = 0; x < ONE_KBYTE / sizeof ( unsigned int ); NEXT(x) ) { if ( buffer[ x ] == MP_SIG ) { *where = 3; *paddr = (x * sizeof( unsigned int )) + target; return; } } } /* search the BIOS */ if ( verbose ) printf( " searching BIOS @ 0x%08x\n", BIOS_BASE ); seekEntry( BIOS_BASE ); readEntry( buffer, BIOS_SIZE ); for ( x = 0; x < BIOS_SIZE / sizeof( unsigned int ); NEXT(x) ) { if ( buffer[ x ] == MP_SIG ) { *where = 4; *paddr = (x * sizeof( unsigned int )) + BIOS_BASE; return; } } /* search the extended BIOS */ if ( verbose ) printf( " searching extended BIOS @ 0x%08x\n", BIOS_BASE2 ); seekEntry( BIOS_BASE2 ); readEntry( buffer, BIOS_SIZE ); for ( x = 0; x < BIOS_SIZE / sizeof( unsigned int ); NEXT(x) ) { if ( buffer[ x ] == MP_SIG ) { *where = 5; *paddr = (x * sizeof( unsigned int )) + BIOS_BASE2; return; } } if ( grope ) { /* search additional memory */ target = GROPE_AREA1; if ( verbose ) printf( " groping memory @ 0x%08x\n", target ); seekEntry( target ); readEntry( buffer, GROPE_SIZE ); for ( x = 0; x < GROPE_SIZE / sizeof( unsigned int ); NEXT(x) ) { if ( buffer[ x ] == MP_SIG ) { *where = 6; *paddr = (x * sizeof( unsigned int )) + GROPE_AREA1; return; } } target = GROPE_AREA2; if ( verbose ) printf( " groping memory @ 0x%08x\n", target ); seekEntry( target ); readEntry( buffer, GROPE_SIZE ); for ( x = 0; x < GROPE_SIZE / sizeof( unsigned int ); NEXT(x) ) { if ( buffer[ x ] == MP_SIG ) { *where = 7; *paddr = (x * sizeof( unsigned int )) + GROPE_AREA2; return; } } } *where = 0; *paddr = (vm_offset_t)0; } /* * */ static void seekEntry( vm_offset_t addr ) { if ( lseek( pfd, (off_t)addr, SEEK_SET ) < 0 ) { return; perror( "/dev/mem seek" ); exit( 1 ); } } /* * */ static void readEntry( void* entry, int size ) { if ( read( pfd, entry, size ) != size ) { return; perror( "readEntry" ); exit( 1 ); } } #endif /* __i386__ */ int detectSMP(void) { static int isSMP = -1; if (isSMP != -1) return isSMP; #ifdef __i386__ return isSMP = intelDetectSMP(); #elif __sparc__ return isSMP = sparcDetectSMP(); #elif __alpha__ return isSMP = alphaDetectSMP(); #elif __powerpc__ return isSMP = ppcDetectSMP(); #elif __ia64__ /* TODO: Update to check against /proc/pal/cpuX */ return isSMP = 1; #elif __x86_64__ /* TODO: Update when SMP machines are there */ return isSMP = 0; #else #error unknown architecture #endif } #if TEST int main() { if (detectSMP()) printf("has smp\n"); else printf("no smp\n"); } #endif