From a2dc60364263e54d4ce0e8aeb900d52456788e1d Mon Sep 17 00:00:00 2001 From: Mark Buechler Date: Thu, 14 Oct 2010 14:39:12 +0000 Subject: [PATCH] - Differentiate between hardware and virtual targets within the config file when using mixed type drivers. git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@2407 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scstadmin/scstadmin.sysfs/scstadmin | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/scstadmin/scstadmin.sysfs/scstadmin b/scstadmin/scstadmin.sysfs/scstadmin index bea14ea8a..7f8b6be24 100755 --- a/scstadmin/scstadmin.sysfs/scstadmin +++ b/scstadmin/scstadmin.sysfs/scstadmin @@ -1198,6 +1198,12 @@ sub writeConfiguration { my $attribute_buff; my $attribute_buff_nk; + + if (defined($$attributes{'hw_target'}) && + ($$attributes{'hw_target'}->{'value'} == TRUE)) { + $attribute_buff = "\t\tHW_TARGET\n\n"; + } + foreach my $attr (keys %{$attributes}) { next if ($$attributes{$attr}->{'static'} && !defined($$tgt_attrs{$attr})); @@ -1210,7 +1216,7 @@ sub writeConfiguration { $attribute_buff .= "\t\t$attr $value\n" if (defined($value)); } - } elsif (($attr eq 'enabled') || $nonkey) { + } elsif (($attr eq 'hw_target') || ($attr eq 'enabled') || $nonkey) { my $value = $$attributes{$attr}->{'value'}; $value = "\"$value\"" if ($value =~ /\s/); if ($attr eq 'enabled') { @@ -2030,6 +2036,11 @@ sub applyTargetAssignments { } my $attributes = configToAttr(\%_attributes); + + if (defined($$attributes{'HW_TARGET'})) { + immediateExit("Hardware target '$target' for driver '$driver' does not exist."); + } + filterCreateAttributes($possible, $attributes, FALSE); my $rc = addVirtualTarget($driver, $target, $attributes); @@ -3468,6 +3479,7 @@ sub setTargetAttributes { # add/change foreach my $attribute (keys %toset) { foreach my $value (keys %{$toset{$attribute}}) { + next if ($attribute eq 'HW_TARGET'); if (!defined($$existing{$attribute}) && $driverCap && !$SCST->checkTargetDynamicAttributes($driver, $attribute)) { addTargetDynamicAttribute($driver, $target, $attribute, $value);