summaryrefslogtreecommitdiffstats
path: root/perl-install/partition_table/sun.pm
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install/partition_table/sun.pm')
-rw-r--r--perl-install/partition_table/sun.pm19
1 files changed, 12 insertions, 7 deletions
diff --git a/perl-install/partition_table/sun.pm b/perl-install/partition_table/sun.pm
index 7c8a6beb9..e665d0168 100644
--- a/perl-install/partition_table/sun.pm
+++ b/perl-install/partition_table/sun.pm
@@ -1,4 +1,4 @@
-package partition_table::sun; # $Id$
+package partition_table::sun;
use diagnostics;
use strict;
@@ -9,6 +9,7 @@ use vars qw(@ISA);
use common;
use partition_table::raw;
use partition_table;
+use fs::type;
use c;
my ($main_format, $main_fields) = list2kv(
@@ -38,6 +39,8 @@ my $magic = 0xDABE;
my $nb_primary = 8;
my $offset = 0;
+sub use_pt_type { 1 }
+
sub adjustStart($$) {
my ($hd, $part) = @_;
my $end = $part->{start} + $part->{size};
@@ -70,7 +73,7 @@ sub compute_crc($) {
$crc;
}
-sub read($$) {
+sub read_one {
my ($hd, $sector) = @_;
my $tmp;
@@ -92,8 +95,9 @@ sub read($$) {
my @infos_up = unpack $format1 x $nb_primary, $info{infos};
my @partitions_up = unpack $format2 x $nb_primary, $info{partitions};
foreach (0..$nb_primary-1) {
- my $h = { pt_type => $infos_up[2 * $_], flag => $infos_up[1 + 2 * $_],
+ my $h = { flag => $infos_up[1 + 2 * $_],
start_cylinder => $partitions_up[2 * $_], size => $partitions_up[1 + 2 * $_] };
+ fs::type::set_pt_type($h, $infos_up[2 * $_]);
$h->{start} = $sector + $h->{start_cylinder} * $hd->cylinder_size;
$h->{pt_type} && $h->{size} or $h->{$_} = 0 foreach keys %$h;
push @pt, $h;
@@ -115,7 +119,7 @@ sub read($$) {
# write the partition table (and extended ones)
# for each entry, it uses fields: start, size, pt_type, active
sub write($$$;$) {
- my ($hd, $sector, $pt, $info) = @_;
+ my ($hd, $_handle, $sector, $pt, $info) = @_;
# my ($csize, $wdsize) = (0, 0);
#- handle testing for writing partition table on file only!
@@ -133,7 +137,7 @@ sub write($$$;$) {
# $csize += $_->{size} if $_->{pt_type} != 5;
# $wdsize += $_->{size} if $_->{pt_type} == 5;
$_->{flags} |= 0x10 if $_->{mntpoint} eq '/';
- $_->{flags} |= 0x01 if partition_table::isSwap($_);
+ $_->{flags} |= 0x01 if !isSwap($_);
local $_->{start_cylinder} = $_->{start} / $hd->cylinder_size - $sector;
pack($format1, @$_{@$fields1}), pack($format2, @$_{@$fields2});
} @$pt;
@@ -182,7 +186,7 @@ sub info {
$info;
}
-sub clear_raw {
+sub initialize {
my ($hd) = @_;
my $pt = { raw => [ ({}) x $nb_primary ], info => info($hd) };
@@ -194,7 +198,8 @@ sub clear_raw {
size => $hd->{geom}{cylinders} * $hd->cylinder_size,
};
- $pt;
+ $hd->{primary} = $pt;
+ bless $hd, 'partition::sun';
}
1;