SCST.pm: Do not cache the driver list

Signed-off-by: Eugene Apollonsky <apollonskiy.E@raidix.com>


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6549 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Bart Van Assche
2015-10-20 18:15:51 +00:00
parent 0e3844a5be
commit 3d9ca3b2a6

View File

@@ -542,28 +542,26 @@ sub setScstAttribute {
SCST_C_ATTRIBUTE_STATIC);
}
my @_drivers;
sub drivers {
my $self = shift;
my $dHandle = new IO::Handle;
my $_path = SCST_TARGETS_DIR();
my @drivers;
if (!@_drivers) {
my $dHandle = new IO::Handle;
my $_path = SCST_TARGETS_DIR();
if (opendir $dHandle, $_path) {
foreach my $driver (readdir($dHandle)) {
next if (($driver eq '.') || ($driver eq '..'));
if (opendir($dHandle, $_path)) {
foreach my $driver (readdir($dHandle)) {
next if (($driver eq '.') || ($driver eq '..'));
if (-d make_path(SCST_TARGETS_DIR(), $driver)) {
push @_drivers, $driver;
}
if (-d make_path(SCST_TARGETS_DIR(), $driver)) {
push @drivers, $driver;
}
close $dHandle;
} else {
return (undef, "drivers(): Unable to read directory '$_path': $!");
}
close $dHandle;
} else {
return (undef, "drivers(): Unable to read directory '$_path': $!");
}
return (\@_drivers, undef);
return (\@drivers, undef);
}