From: <mga...@us...> - 2010-09-02 15:45:36
|
Revision: 2034 http://scst.svn.sourceforge.net/scst/?rev=2034&view=rev Author: mgandalf Date: 2010-09-02 15:45:30 +0000 (Thu, 02 Sep 2010) Log Message: ----------- - Fixed clear_config not clearing driver dynamic attributes. - Removed requirement on special CREATE_ATTRIBUTES. Modified Paths: -------------- trunk/scstadmin/scstadmin.sysfs/scstadmin Modified: trunk/scstadmin/scstadmin.sysfs/scstadmin =================================================================== --- trunk/scstadmin/scstadmin.sysfs/scstadmin 2010-09-01 12:21:33 UTC (rev 2033) +++ trunk/scstadmin/scstadmin.sysfs/scstadmin 2010-09-02 15:45:30 UTC (rev 2034) @@ -1017,7 +1017,7 @@ foreach my $key (keys %{$$attributes{$attribute}->{'keys'}}) { my $value = $$attributes{$attribute}->{'keys'}->{$key}->{'value'}; $value = "\"$value\"" if ($value =~ / /); - $create_buff .= "\t\t\t$attribute $value\n" + $create_buff .= "\t\t$attribute $value\n" if (defined($value)); } # Shouldn't be any non-key create attributes @@ -1026,9 +1026,7 @@ } if ($create_buff) { - $attribute_buff .= "\t\tCREATE_ATTRIBUTES {\n"; $attribute_buff .= $create_buff; - $attribute_buff .= "\t\t}\n"; } } @@ -1574,19 +1572,19 @@ my %_attributes; my %_cattributes; foreach my $item (keys %{$$devices{$device}}) { - next if ($item eq 'CREATE_ATTRIBUTES'); $_attributes{$item} = $$devices{$device}->{$item}; } my $attributes = configToAttr(\%_attributes); + my $create_attrs = configToAttr(\%_attributes); + my $possible = $SCST->deviceCreateAttributes($handler); + immediateExit($SCST->errorString()); + filterCreateAttributes($possible, $create_attrs, FALSE); + filterCreateAttributes($possible, $attributes, TRUE); if (handlerHasDevice($handler, $device)) { - my $create_attrs = configToAttr($$devices{$device}->{'CREATE_ATTRIBUTES'}); my $old_create_attrs = $SCST->deviceAttributes($device); immediateExit($SCST->errorString()); - my $possible = $SCST->deviceCreateAttributes($handler); - immediateExit($SCST->errorString()); - filterCreateAttributes($possible, $old_create_attrs, FALSE); if (compareToKeyAttribute($create_attrs, $old_create_attrs)) { @@ -1608,7 +1606,6 @@ next; } - my $create_attrs = configToAttr($$devices{$device}->{'CREATE_ATTRIBUTES'}); openDevice($handler, $device, $create_attrs); setDeviceAttributes($device, $attributes, $deletions) @@ -1658,7 +1655,7 @@ my $possible = $SCST->lunCreateAttributes($driver, $target); immediateExit($SCST->errorString()); - filterCreateAttributes($possible, $c_attrs, TRUE); + filterCreateAttributes($possible, $c_attrs, FALSE); if (compareToKeyAttribute($c_attrs, $o_attrs)) { print "-> Assigned device '$device' in target '$target' at ". @@ -1700,7 +1697,7 @@ my $possible = $SCST->lunCreateAttributes($driver, $target, $group); immediateExit($SCST->errorString()); - filterCreateAttributes($possible, $c_attrs, TRUE); + filterCreateAttributes($possible, $c_attrs, FALSE); if (compareToKeyAttribute($c_attrs, $o_attrs)) { print "-> Assigned device '$device' in group '$group' ". @@ -1892,9 +1889,9 @@ my $keep = shift; foreach my $attribute (keys %{$attrs}) { - my $good = defined($$creates{$attribute}); + my $good = defined($$creates{$attribute}) ? TRUE : FALSE; - if (($keep && !$good) || (!$keep && !$good)) { + if (($keep && $good) || (!$keep && !$good)) { delete $$attrs{$attribute}; } } @@ -1944,7 +1941,7 @@ } } - removeDriverDynamicAttributes($driver); + clearDriverDynamicAttributes($driver); } my $handlers = $CURRENT{'handler'}; @@ -3887,15 +3884,15 @@ foreach my $option (split(/\|/, $options)) { if (defined($o_converts{$option})) { - %{$new{'HANDLER'}->{$_handler}->{'DEVICE'}->{$device}->{'CREATE_ATTRIBUTES'}->{$o_converts{$option}}->{'1'}} = (); + %{$new{'HANDLER'}->{$_handler}->{'DEVICE'}->{$device}->{$o_converts{$option}}->{'1'}} = (); } } %{$new{'HANDLER'}->{$_handler}->{'DEVICE'}->{$device}->{'t10_dev_id'}->{$t10}} = () if ($t10); - %{$new{'HANDLER'}->{$_handler}->{'DEVICE'}->{$device}->{'CREATE_ATTRIBUTES'}->{'filename'}->{$path}} = () + %{$new{'HANDLER'}->{$_handler}->{'DEVICE'}->{$device}->{'filename'}->{$path}} = () if ($path); - %{$new{'HANDLER'}->{$_handler}->{'DEVICE'}->{$device}->{'CREATE_ATTRIBUTES'}->{'blocksize'}->{$bsize}} = () + %{$new{'HANDLER'}->{$_handler}->{'DEVICE'}->{$device}->{'blocksize'}->{$bsize}} = () if ($bsize); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |