diff options
author | Pascal Rigaux <pixel@mandriva.com> | 1999-09-19 14:49:36 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 1999-09-19 14:49:36 +0000 |
commit | 4710960f1314ec790ea876f0e50250cac59e089c (patch) | |
tree | ebf7ffacad519615bc779e28e108af7fff27d14b /perl-install/partition_table_raw.pm | |
parent | bb1b2617bc36e258f13d375faaaec1bfff97080e (diff) | |
download | drakx-backup-do-not-use-4710960f1314ec790ea876f0e50250cac59e089c.tar drakx-backup-do-not-use-4710960f1314ec790ea876f0e50250cac59e089c.tar.gz drakx-backup-do-not-use-4710960f1314ec790ea876f0e50250cac59e089c.tar.bz2 drakx-backup-do-not-use-4710960f1314ec790ea876f0e50250cac59e089c.tar.xz drakx-backup-do-not-use-4710960f1314ec790ea876f0e50250cac59e089c.zip |
no_comment
Diffstat (limited to 'perl-install/partition_table_raw.pm')
-rw-r--r-- | perl-install/partition_table_raw.pm | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/perl-install/partition_table_raw.pm b/perl-install/partition_table_raw.pm index c97a8a094..bcb7ca588 100644 --- a/perl-install/partition_table_raw.pm +++ b/perl-install/partition_table_raw.pm @@ -4,6 +4,7 @@ use diagnostics; use strict; use common qw(:common :system); +use devices; use c; my @fields = qw(active start_head start_sec start_cyl type end_head end_sec end_cyl start size); @@ -13,8 +14,10 @@ my $nb_primary = 4; my $offset = $common::SECTORSIZE - length($magic) - $nb_primary * common::psizeof($format); -1; - +my @MBR_signatures = ( + [ 'LILO', 0x6, 'LILO' ], + [ 'DOS', 0xa0, '\x25\x03\x4E\x02\x\xCD\x13' ], +); sub compute_CHS($$) { my ($hd, $e) = @_; @@ -107,3 +110,28 @@ sub zero_MBR($) { $hd->{primary} = clear_raw(); delete $hd->{extended}; } + +sub typeOfMBR($) { + my $dev = devices::make($_[0]); + local *F; sysopen F, $dev, 0 or return; + + my $tmp + foreach (@MBR_signatures) { + my ($name, $offset, $signature) = @$_; + sysseek F, $offset, 0 or next; + sysread(F, $tmp, length $signature) && $tmp eq $signature and return $name; + } + undef; +} + +sub isFatFormatted($) { + my $dev = devices::make($_[0]); + local *F; sysopen F, $dev, 0 or return; + sysseek F, $common::SECTORSIZE - length($magic), 0; + + #- check magic number + my $tmp; + sysread(F, $tmp, length $magic) && $tmp eq $magic; +} + +1; |