summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Spinler <spinler@us.ibm.com>2016-11-15 13:37:09 -0600
committerMatt Spinler <spinler@us.ibm.com>2016-11-15 13:37:09 -0600
commite546fc9b60909887505ecbcd4c7b893975ad7883 (patch)
treef4fc51b616100c142cc700c6a7d6c6651a874599
parente0f33b53fa87911f2ac8c1c7262044e820a9260b (diff)
downloadserverwiz-e546fc9b60909887505ecbcd4c7b893975ad7883.tar.gz
serverwiz-e546fc9b60909887505ecbcd4c7b893975ad7883.zip
Allow findConnections() to work off more than just direct children
findConnections() will now also search great granchildren and below when looking for connections. Also added getAllTargetChildren() to return an array of every generation of children. Signed-off-by: Matt Spinler <spinler@us.ibm.com>
-rw-r--r--scripts/Targets.pm28
1 files changed, 27 insertions, 1 deletions
diff --git a/scripts/Targets.pm b/scripts/Targets.pm
index a8e3a0c..4f460a2 100644
--- a/scripts/Targets.pm
+++ b/scripts/Targets.pm
@@ -936,7 +936,7 @@ sub findConnections
return "";
}
- foreach my $child (@{ $self->getTargetChildren($target) })
+ foreach my $child ($self->getAllTargetChildren($target))
{
my $child_bus_type = $self->getBusType($child);
if ($child_bus_type eq $bus_type)
@@ -1244,6 +1244,27 @@ sub getTargetChildren
return $target_ptr->{CHILDREN};
}
+## returns an array of all child (including grandchildren) target names
+sub getAllTargetChildren
+{
+ my $self = shift;
+ my $target = shift;
+ my @children;
+
+ my $targets = $self->getTargetChildren($target);
+ if ($targets ne "")
+ {
+ for my $child (@$targets)
+ {
+ push @children, $child;
+ my @more = $self->getAllTargetChildren($child);
+ push @children, @more;
+ }
+ }
+
+ return @children;
+}
+
sub getEnumValue
{
my $self = shift;
@@ -1556,6 +1577,11 @@ C<INDEX>.
Returns an array of target strings representing all the children of target
C<TARGET_STRING>.
+=item getAllTargetChildren(C<TARGET_STRING>)
+
+Returns an array of target strings representing all the children of target
+C<TARGET_STRING>, including grandchildren and below as well.
+
=item getEnumValue(C<ENUM_TYPE>,C<ENUM_NAME>)
Returns the enum value of type C<ENUM_TYPE> and name C<ENUM_NAME>. The
OpenPOWER on IntegriCloud