diff options
author | Maarten Vanraes <alien@mageia.org> | 2016-02-26 22:38:04 +0100 |
---|---|---|
committer | Maarten Vanraes <alien@mageia.org> | 2016-05-14 09:25:24 +0200 |
commit | d5d4b154868f5b7a2a03226b5c689cb7b5088a7a (patch) | |
tree | 402ecf49be16bd33375898cbe0d51c1f39bcaced | |
parent | d8b6e700b97302f2d0223422305bb42f7886a670 (diff) | |
download | manatools-d5d4b154868f5b7a2a03226b5c689cb7b5088a7a.tar manatools-d5d4b154868f5b7a2a03226b5c689cb7b5088a7a.tar.gz manatools-d5d4b154868f5b7a2a03226b5c689cb7b5088a7a.tar.bz2 manatools-d5d4b154868f5b7a2a03226b5c689cb7b5088a7a.tar.xz manatools-d5d4b154868f5b7a2a03226b5c689cb7b5088a7a.zip |
disk_backend: allow filtering on PartState
-rw-r--r-- | lib/ManaTools/Shared/disk_backend.pm | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/lib/ManaTools/Shared/disk_backend.pm b/lib/ManaTools/Shared/disk_backend.pm index 7159c667..9bacf9b4 100644 --- a/lib/ManaTools/Shared/disk_backend.pm +++ b/lib/ManaTools/Shared/disk_backend.pm @@ -363,6 +363,11 @@ sub probeio { =head2 findin +=head3 INPUT + + $io: ManaTools::Shared::disk_backend::IO + $state: ManaTools::Shared::disk_backend::Part::PartState|undef + =head3 OUTPUT array of Part @@ -377,14 +382,20 @@ sub probeio { sub findin { my $self = shift; my $io = shift; + my $state = shift; - return grep {grep {$io eq $_} $_->get_ins()} @{$self->parts}; + return grep {grep {$io eq $_} $_->get_ins() && (!defined $state || $_->is_state($state))} @{$self->parts}; } #============================================================= =head2 findout +=head3 INPUT + + $io: ManaTools::Shared::disk_backend::IO + $state: ManaTools::Shared::disk_backend::Part::PartState|undef + =head3 OUTPUT array of Part @@ -399,8 +410,9 @@ sub findin { sub findout { my $self = shift; my $io = shift; + my $state = shift; - return grep {grep {$io eq $_} $_->get_outs()} @{$self->parts}; + return grep {grep {$io eq $_} $_->get_outs() && (!defined $state || $_->is_state($state))} @{$self->parts}; } #============================================================= |