From 6216226567ca70a3960c294d136b97b02a26bf1b Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Thu, 1 Nov 2018 04:38:33 +0000 Subject: [PATCH] scstadmin: Fix parsing of the soft links under the 'exported' directory git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/3.3.x@7580 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- .../scst-1.0.0/lib/SCST/SCST.pm | 25 ++++++++++++------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/scstadmin/scstadmin.sysfs/scst-1.0.0/lib/SCST/SCST.pm b/scstadmin/scstadmin.sysfs/scst-1.0.0/lib/SCST/SCST.pm index 175c55c53..7a3789502 100644 --- a/scstadmin/scstadmin.sysfs/scst-1.0.0/lib/SCST/SCST.pm +++ b/scstadmin/scstadmin.sysfs/scst-1.0.0/lib/SCST/SCST.pm @@ -2612,19 +2612,26 @@ sub deviceAttributes { my $linked = readlink make_path($pPath, $export); + my $t = SCST_TARGETS; my $g = SCST_GROUPS; my $l = SCST_LUNS; + my ($driver, $target, $group, $lun) = "" x 4; - if ($linked =~ /.*\/(.+)\/(.+)\/$g\/(.+)\/$l\/(\d+)/) { - my $driver = $1; - my $target = $2; - my $group = $3; - my $lun = $4; - - next if ($target eq 'copy_manager'); - $attributes{$attribute}->{'value'}->{$driver}->{$target}->{$group} = $lun; + if ($linked =~ /^(\.\.\/)*$t\/([^\/]+)\/([^\/]+)\/$g\/([^\/]+)\/$l\/(\d+)$/) { + $driver = $2; + $target = $3; + $group = $4; + $lun = $5; + } elsif ($linked =~ /^(\.\.\/)*$t\/([^\/]+)\/([^\/]+)\/$l\/(\d+)$/) { + $driver = $2; + $target = $3; + $lun = $4; + } else { + print("internal error: could not parse $linked\n"); + next; } - + next if ($driver eq 'copy_manager'); + $attributes{$attribute}->{'value'}->{$driver}->{$target}->{$group} = $lun; } if ($attributes{$attribute}->{'value'}) { $attributes{$attribute}->{'static'} = TRUE;