summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2007-09-18 10:23:17 +0000
committerPascal Rigaux <pixel@mandriva.com>2007-09-18 10:23:17 +0000
commitce9f2f3dc52173a581d8a6c2ab41e2911d4a47e6 (patch)
tree8ecd87a34987081dc1ccd9fd596257fe0ae1f51f
parentd4dd27cd5b6a8c23baa75a0bb0eefaa6b0fa39f1 (diff)
downloaddrakx-backup-do-not-use-ce9f2f3dc52173a581d8a6c2ab41e2911d4a47e6.tar
drakx-backup-do-not-use-ce9f2f3dc52173a581d8a6c2ab41e2911d4a47e6.tar.gz
drakx-backup-do-not-use-ce9f2f3dc52173a581d8a6c2ab41e2911d4a47e6.tar.bz2
drakx-backup-do-not-use-ce9f2f3dc52173a581d8a6c2ab41e2911d4a47e6.tar.xz
drakx-backup-do-not-use-ce9f2f3dc52173a581d8a6c2ab41e2911d4a47e6.zip
transform ->clear_raw into the more generic ->initialize
(useful to have a more standard partition_table::lvm)
-rw-r--r--perl-install/fsedit.pm3
-rw-r--r--perl-install/partition_table/bsd.pm8
-rw-r--r--perl-install/partition_table/dos.pm8
-rw-r--r--perl-install/partition_table/gpt.pm9
-rw-r--r--perl-install/partition_table/lvm.pm4
-rw-r--r--perl-install/partition_table/mac.pm7
-rw-r--r--perl-install/partition_table/raw.pm4
-rw-r--r--perl-install/partition_table/sun.pm5
8 files changed, 29 insertions, 19 deletions
diff --git a/perl-install/fsedit.pm b/perl-install/fsedit.pm
index f202d0ef4..b9b0cf2dd 100644
--- a/perl-install/fsedit.pm
+++ b/perl-install/fsedit.pm
@@ -180,8 +180,7 @@ sub get_hds {
1;
} elsif ($type->{pt_type} == 0x8e) {
#- LVM on full disk
- require partition_table::lvm;
- partition_table::lvm::initialize($hd);
+ partition_table::lvm->initialize($hd);
1;
} else {
0;
diff --git a/perl-install/partition_table/bsd.pm b/perl-install/partition_table/bsd.pm
index 560a75fd9..d01f0ad7e 100644
--- a/perl-install/partition_table/bsd.pm
+++ b/perl-install/partition_table/bsd.pm
@@ -140,9 +140,11 @@ sub info {
};
}
-sub clear_raw {
- my ($hd) = @_;
- { raw => [ ({}) x $nb_primary ], info => info($hd) };
+sub initialize {
+ my ($class, $hd) = @_;
+ $hd->{primary} = { raw => [ ({}) x $nb_primary ], info => info($hd) };
+ bless $hd, $class;
+;
}
sub first_usable_sector { 2048 }
diff --git a/perl-install/partition_table/dos.pm b/perl-install/partition_table/dos.pm
index 43243259d..688626d7b 100644
--- a/perl-install/partition_table/dos.pm
+++ b/perl-install/partition_table/dos.pm
@@ -247,6 +247,12 @@ sub write {
1;
}
-sub clear_raw { { raw => [ ({}) x $nb_primary ] } }
+sub empty_raw { { raw => [ ({}) x $nb_primary ] } }
+
+sub initialize {
+ my ($class, $hd) = @_;
+ $hd->{primary} = empty_raw();
+ bless $hd, $class;
+}
1;
diff --git a/perl-install/partition_table/gpt.pm b/perl-install/partition_table/gpt.pm
index de83dadf8..ba9307df3 100644
--- a/perl-install/partition_table/gpt.pm
+++ b/perl-install/partition_table/gpt.pm
@@ -184,7 +184,7 @@ sub write {
{
# write the PMBR
- my $pmbr = partition_table::dos::clear_raw();
+ my $pmbr = partition_table::dos::empty_raw();
$pmbr->{raw}[0] = { pt_type => 0xee, local_start => $info->{myLBA}, size => $info->{alternateLBA} - $info->{myLBA} + 1 };
partition_table::dos::write($hd, $sector, $pmbr->{raw});
}
@@ -258,9 +258,10 @@ sub info {
};
}
-sub clear_raw {
- my ($hd) = @_;
- { raw => [], info => info($hd) };
+sub initialize {
+ my ($class, $hd) = @_;
+ $hd->{primary} = { raw => [], info => info($hd) };
+ bless $hd, $class;
}
1;
diff --git a/perl-install/partition_table/lvm.pm b/perl-install/partition_table/lvm.pm
index 91a9dfbc5..b0bc88cf3 100644
--- a/perl-install/partition_table/lvm.pm
+++ b/perl-install/partition_table/lvm.pm
@@ -13,7 +13,7 @@ use fs::type;
use lvm;
sub initialize {
- my ($hd) = @_;
+ my ($class, $hd) = @_;
my $part = { size => $hd->{totalsectors}, device => $hd->{device} };
add2hash($part, fs::type::type_name2subpart('Linux Logical Volume Manager'));
@@ -21,5 +21,5 @@ sub initialize {
$hd->{readonly} = $hd->{getting_rid_of_readonly_allowed} = 1;
$hd->{primary}{normal} = [ $part ];
- bless $hd, 'partition_table::lvm';
+ bless $hd, $class;
}
diff --git a/perl-install/partition_table/mac.pm b/perl-install/partition_table/mac.pm
index 8d653932f..779799188 100644
--- a/perl-install/partition_table/mac.pm
+++ b/perl-install/partition_table/mac.pm
@@ -357,8 +357,8 @@ sub info {
$info;
}
-sub clear_raw {
- my ($hd) = @_;
+sub initialize {
+ my ($class, $hd) = @_;
my @oldraw = @{$hd->{primary}{raw}};
my $pt = { raw => [ ({}) x 63 ], info => info($hd) };
@@ -389,7 +389,8 @@ sub clear_raw {
}
@{$pt->{info}{ddMap}} = @{$hd->{primary}{info}{ddMap}};
- $pt;
+ $hd->{primary} = $pt;
+ bless $hd, $class;
}
1;
diff --git a/perl-install/partition_table/raw.pm b/perl-install/partition_table/raw.pm
index f84876f04..d1549239d 100644
--- a/perl-install/partition_table/raw.pm
+++ b/perl-install/partition_table/raw.pm
@@ -218,8 +218,8 @@ sub default_type {
sub zero_MBR {
my ($hd) = @_;
#- force the standard partition type for the architecture
- bless $hd, default_type();
- $hd->{primary} = $hd->clear_raw;
+ my $type = default_type();
+ $type->initialize($hd);
delete $hd->{extended};
if (detect_devices::is_xbox()) {
my $part = { start => 1, size => 15632048, pt_type => 0x0bf, isFormatted => 1 };
diff --git a/perl-install/partition_table/sun.pm b/perl-install/partition_table/sun.pm
index 49228d0f8..d5d29e27b 100644
--- a/perl-install/partition_table/sun.pm
+++ b/perl-install/partition_table/sun.pm
@@ -186,7 +186,7 @@ sub info {
$info;
}
-sub clear_raw {
+sub initialize {
my ($hd) = @_;
my $pt = { raw => [ ({}) x $nb_primary ], info => info($hd) };
@@ -198,7 +198,8 @@ sub clear_raw {
size => $hd->{geom}{cylinders} * $hd->cylinder_size,
};
- $pt;
+ $hd->{primary} = $pt;
+ bless $hd, 'partition::sun';
}
1;