From 20536e953f50f23a3af39e3092c977089f026264 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Fri, 19 Apr 2013 17:17:06 +0000 Subject: (save_crypttab_,read_crypttab_) split them out of (read|save)_crypttab_() thus enabling to choose to/from which crypttab file read/write-ing needed for next changes (mga#5661) --- perl-install/fs/dmcrypt.pm | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'perl-install') diff --git a/perl-install/fs/dmcrypt.pm b/perl-install/fs/dmcrypt.pm index bc611455e..0926ed87a 100644 --- a/perl-install/fs/dmcrypt.pm +++ b/perl-install/fs/dmcrypt.pm @@ -25,14 +25,14 @@ sub _ensure_initialized() { $initialized++ or init(); } -sub read_crypttab { - my ($all_hds) = @_; +sub read_crypttab_ { + my ($all_hds, $crypttab) = @_; - -e _crypttab() or return; + -e $crypttab or return; my @raw_parts = grep { fs::type::isRawLUKS($_) } fs::get::really_all_fstab($all_hds); - foreach (cat_(_crypttab())) { + foreach (cat_($crypttab)) { my ($dm_name, $dev) = split; my $raw_part = fs::get::device2part($dev, \@raw_parts) @@ -42,8 +42,13 @@ sub read_crypttab { } } -sub save_crypttab { +sub read_crypttab { my ($all_hds) = @_; + read_crypttab_($all_hds, _crypttab()); +} + +sub save_crypttab_ { + my ($all_hds, $crypttab) = @_; my @raw_parts = grep { $_->{dm_name} } fs::get::really_all_fstab($all_hds) or return; @@ -57,7 +62,12 @@ sub save_crypttab { if (eof) { $_ .= join('', map { "$_ $names{$_}\n" } sort keys %names); } - } _crypttab(); + } $crypttab; +} + +sub save_crypttab { + my ($all_hds) = @_; + save_crypttab_($all_hds, _crypttab()); } sub format_part { -- cgit v1.2.1