From fe1738223ab39c2fc0caaa431ad1fdb34e382530 Mon Sep 17 00:00:00 2001 From: Maarten Vanraes Date: Wed, 18 May 2016 01:12:31 +0200 Subject: clean up a bit --- lib/ManaTools/Shared/disk_backend/Part.pm | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/ManaTools/Shared/disk_backend/Part.pm b/lib/ManaTools/Shared/disk_backend/Part.pm index d30e5864..941d0b5a 100644 --- a/lib/ManaTools/Shared/disk_backend/Part.pm +++ b/lib/ManaTools/Shared/disk_backend/Part.pm @@ -499,12 +499,13 @@ sub trychild { # try to look for the child if it exists already for my $child ($self->children()) { + # use the identification function if (!defined $identify || $identify->($child, $parameters)) { + # if it's the state we're looking for, just return it - if ($child->is_state($partstate)) { - return $child; - } + return $child if ($child->is_state($partstate)); + # assign a link to the others, in case we'll need to create it # this way, it'll be already linked to the others $parameters->{loaded} = $child if ($child->is_loaded()); -- cgit v1.2.1