summaryrefslogtreecommitdiffstats
path: root/perl-install/partition_table/dmcrypt.pm
diff options
context:
space:
mode:
authorAntoine Ginies <aginies@mandriva.com>2011-01-19 10:44:49 +0000
committerAntoine Ginies <aginies@mandriva.com>2011-01-19 10:44:49 +0000
commit530a16ec071db0e24e6e949e265a96848864967c (patch)
treefe40cacd28d67b98186754c551b7fd339ebc7e17 /perl-install/partition_table/dmcrypt.pm
downloaddrakx-backup-do-not-use-530a16ec071db0e24e6e949e265a96848864967c.tar
drakx-backup-do-not-use-530a16ec071db0e24e6e949e265a96848864967c.tar.gz
drakx-backup-do-not-use-530a16ec071db0e24e6e949e265a96848864967c.tar.bz2
drakx-backup-do-not-use-530a16ec071db0e24e6e949e265a96848864967c.tar.xz
drakx-backup-do-not-use-530a16ec071db0e24e6e949e265a96848864967c.zip
add mes5-2.6.33 branch
Diffstat (limited to 'perl-install/partition_table/dmcrypt.pm')
-rw-r--r--perl-install/partition_table/dmcrypt.pm41
1 files changed, 41 insertions, 0 deletions
diff --git a/perl-install/partition_table/dmcrypt.pm b/perl-install/partition_table/dmcrypt.pm
new file mode 100644
index 000000000..3eae783c6
--- /dev/null
+++ b/perl-install/partition_table/dmcrypt.pm
@@ -0,0 +1,41 @@
+package partition_table::dmcrypt; # $Id: $
+
+# dmcrypt on full disk
+
+use diagnostics;
+use strict;
+
+our @ISA = qw(partition_table::readonly);
+
+use common;
+use partition_table::readonly;
+use fs::type;
+
+sub _parts {
+ my ($hd) = @_;
+
+ my $part = { size => $hd->{totalsectors}, device => $hd->{device} };
+ add2hash($part, fs::type::type_name2subpart('Encrypted'));
+
+ require fs;
+ fs::get_major_minor([$part]); # to allow is_same_hd() in fs::dmcrypt
+
+ [ $part ];
+}
+
+sub read_primary {
+ my ($hd) = @_;
+
+ my $type = fs::type::type_subpart_from_magic($hd);
+
+ $type && $type->{type_name} eq 'Encrypted' or return;
+
+ partition_table::dmcrypt->initialize($hd);
+ 1;
+}
+
+sub initialize {
+ my ($class, $hd) = @_;
+
+ partition_table::readonly::initialize($class, $hd, _parts($hd));
+}