Merge branch 'svn-trunk'

This commit is contained in:
Bart Van Assche
2020-05-13 13:46:56 -07:00
3 changed files with 19 additions and 38 deletions

View File

@@ -512,7 +512,7 @@ index 8fa38d3e7538..f5bc4c046461 100644
EOF
;;
*) # CentOS 6.x and 7.x
2.6.32-*|3.10.0-*) # CentOS 6.x and 7.x
patch -p1 <<'EOF'
--- linux-3.10.0-1127.el7/include/linux/init.h.orig 2020-05-09 20:55:48.638956513 -0700
+++ linux-3.10.0-1127.el7/include/linux/init.h 2020-05-09 20:56:46.947612445 -0700

View File

@@ -464,37 +464,18 @@ struct scst_tgt *scst_register_target(struct scst_tgt_template *vtt,
TRACE_ENTRY();
BUG_ON(!target_name);
rc = scst_alloc_tgt(vtt, &tgt);
if (rc != 0)
goto out;
if (target_name != NULL) {
tgt->tgt_name = kstrdup(target_name, GFP_KERNEL);
if (tgt->tgt_name == NULL) {
PRINT_ERROR("Allocation of tgt name %s failed",
target_name);
rc = -ENOMEM;
goto out_free_tgt;
}
} else {
static int tgt_num; /* protected by scst_mutex */
PRINT_WARNING("Usage of autogenerated SCST target names "
"is deprecated and will be removed in one of the next "
"versions. It is strongly recommended to update target "
"driver %s to use hardware related persistent target "
"names instead", vtt->name);
tgt->tgt_name = kasprintf(GFP_KERNEL, "%s%s%d", vtt->name,
SCST_DEFAULT_TGT_NAME_SUFFIX, tgt_num);
if (tgt->tgt_name == NULL) {
PRINT_ERROR("Allocation of tgt name failed "
"(template name %s)", vtt->name);
rc = -ENOMEM;
goto out_free_tgt;
}
tgt_num++;
tgt->tgt_name = kstrdup(target_name, GFP_KERNEL);
if (tgt->tgt_name == NULL) {
PRINT_ERROR("Allocation of tgt name %s failed",
target_name);
rc = -ENOMEM;
goto out_free_tgt;
}
rc = mutex_lock_interruptible(&scst_mutex);

View File

@@ -1497,7 +1497,7 @@ sub serializeKeyAttr {
foreach my $key (keys %{$$attributes{$attribute}->{'keys'}}) {
my $value =
$$attributes{$attribute}->{'keys'}->{$key}->{'value'};
push (@values, $value) if ($value ne '');
push (@values, $value) if ($value);
}
foreach my $value (sort @values) {
$result .= "$prefix$attribute " . escapeMeta($value) . "\n";
@@ -1532,7 +1532,7 @@ sub serializeNkAttr {
&& $attribute ne 'enabled'
&& $attribute ne 'hw_target') {
my $value = $$attributes{$attribute}->{'value'};
if ($value ne '') {
if ($value) {
$result .= "$prefix$attribute " . escapeMeta($value) . "\n";
}
}
@@ -3140,7 +3140,7 @@ sub listDevices {
my $device = shift;
my $nonkey = shift;
return listDevice($device, $nonkey) if ($device ne '');
return listDevice($device, $nonkey) if ($device);
return listHandler();
}
@@ -3164,7 +3164,7 @@ sub listDeviceGroups {
my $group = shift;
my $showall = shift;
return listDeviceGroup($group) if ($group ne '');
return listDeviceGroup($group) if ($group);
my ($groups, $errorString) = $SCST->deviceGroups();
@@ -3244,7 +3244,7 @@ sub listTargetGroups {
my $indent = shift;
return listDeviceGroups(undef, TRUE) if ($group eq '');
return listTargetGroup($group, $tgroup) if ($tgroup ne '');
return listTargetGroup($group, $tgroup) if ($tgroup);
my ($tgroups, $errorString) = $SCST->targetGroups($group);
@@ -3304,7 +3304,7 @@ sub listDeviceGroupDevices {
my $group = shift;
my $device = shift;
return listDevice($device) if ($device ne '');
return listDevice($device) if ($device);
my ($devices, $errorString) = $SCST->deviceGroupDevices($group);
@@ -3332,7 +3332,7 @@ sub listDeviceGroupDevices {
sub listDrivers {
my $driver = shift;
return listTargets($driver, undef) if ($driver ne '');
return listTargets($driver, undef) if ($driver);
my ($drivers, $errorString) = $SCST->drivers();
@@ -3360,7 +3360,7 @@ sub listTargets {
my $target = shift;
my %toprint;
return listGroups($driver, $target, undef) if (($target ne '') && ($driver ne ''));
return listGroups($driver, $target, undef) if ($target and $driver);
my $got_driver = defined($driver);
@@ -3539,7 +3539,7 @@ sub listGroups {
my $group = shift;
my $found = FALSE;
if (($group ne '') && ($driver ne '') && ($target ne '')) {
if ($group and $driver and $target) {
return listGroup($driver, $target, $group);
}
@@ -3948,7 +3948,7 @@ sub listLunAttributes {
return TRUE if issueWarning($errorString);
if (!scalar(keys %{$attributes})) {
if ($group ne '') {
if ($group) {
print "No such driver/target/group/lun '$driver/$target/$group/$lun' found.\n";
} else {
print "No such driver/target/lun '$driver/$target/$lun' found.\n";