package SCST::SCST;
# Author: Mark R. Buechler
-# Copyright (c) 2005, 2006 Mark R. Buechler
+# License: GPLv2
+# Copyright (c) 2005-2007 Mark R. Buechler
use 5.005;
use IO::Handle;
$IOTYPE_VIRTUAL = 101;
$IOTYPE_PERFORMANCE = 102;
-$VERSION = 0.7.2;
+$VERSION = 0.7.3;
my $_SCST_MIN_MAJOR_ = 0;
my $_SCST_MIN_MINOR_ = 9;
$options = "";
}
- $devices{$vname}->{'OPTIONS'} = $self->cleanupString($options);
- $devices{$vname}->{'SIZE'} = $self->cleanupString($size);
- $devices{$vname}->{'PATH'} = $self->cleanupString($path);
- $devices{$vname}->{'BLOCKSIZE'} = $self->cleanupString($blocksize);
+ $devices{$vname}->{'OPTIONS'} = cleanupString($options);
+ $devices{$vname}->{'SIZE'} = cleanupString($size);
+ $devices{$vname}->{'PATH'} = cleanupString($path);
+ $devices{$vname}->{'BLOCKSIZE'} = cleanupString($blocksize);
}
close $io;
return 2;
}
- $options = $self->cleanupString($options);
+ $options = cleanupString($options);
my $cmd = "open $device $path $blocksize $options\n";
- $cmd = $self->cleanupString($cmd);
+ $cmd = cleanupString($cmd);
my $rc = $self->handler_private($handler_io, $cmd);
}
sub cleanupString {
- my $self = shift;
my $string = shift;
$string =~ s/^\s+//;
#!/usr/bin/perl
-$Version = 'SCST Configurator v0.7.1';
+$Version = 'SCST Configurator v0.7.3';
# Configures SCST
#
-# Written by Mark R. Buechler 12/07/04
+# Author: Mark R. Buechler
+# License: GPLv2
+# Copyright (c) 2005-2007 Mark R. Buechler
sub usage
{
# Assign new devices to groups..
foreach my $group (keys %used_assignments) {
+ if (!defined($GROUPS{$group})) {
+ # Looks like we're lacking a group. We'll create an empty one
+
+ print "\t-> WARNING: Auto-creating an empty group '$group' since none was configured.\n";
+
+ if (addGroup($group)) {
+ $errs++;
+ } else {
+ $changes++;
+ }
+ }
+
if (!defined($GROUPS{$group})) {
print "\t-> WARNING: Unable to assign to non-existant group '$group'.\n";
$errs += 1;
$line = cleanupString($line);
if ($line =~ /^\[(.*)\]$/) {
- $last_arg = $arg;
- $last_section = $section;
($section, $arg) = split(/\s+/, $1, 2);
- if ($last_arg && ($last_arg ne $arg) && !$config{$last_section}->{$last_arg}) {
+ if ($last_arg && ($last_section ne $section) &&
+ !defined($config{$last_section}->{$last_arg})) {
$config{$last_section}->{$last_arg} = \%empty;
}
+
+ $last_arg = $arg;
+ $last_section = $section;
} elsif ($section && $arg && $line) {
my($parameter, $value) = split(/\s+/, $line, 2);